mirror of
https://github.com/openziti/zrok.git
synced 2025-06-24 19:51:32 +02:00
set the cookie jar domain handler to the root domain
This commit is contained in:
parent
0c2e83fb9d
commit
67a981980b
@ -6,6 +6,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
@ -43,7 +44,15 @@ func configureGithubOauth(cfg *OauthConfig, tls bool) error {
|
|||||||
|
|
||||||
key := []byte(cfg.HashKeyRaw)
|
key := []byte(cfg.HashKeyRaw)
|
||||||
|
|
||||||
cookieHandler := zhttp.NewCookieHandler(key, key, zhttp.WithUnsecure(), zhttp.WithDomain(cfg.RedirectUrl))
|
u, err := url.Parse(redirectUrl)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("unable to parse redirect url: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
parts := strings.Split(u.Hostname(), ".")
|
||||||
|
domain := parts[len(parts)-2] + "." + parts[len(parts)-1]
|
||||||
|
|
||||||
|
cookieHandler := zhttp.NewCookieHandler(key, key, zhttp.WithUnsecure(), zhttp.WithDomain(domain))
|
||||||
|
|
||||||
options := []rp.Option{
|
options := []rp.Option{
|
||||||
rp.WithCookieHandler(cookieHandler),
|
rp.WithCookieHandler(cookieHandler),
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
@ -44,7 +45,15 @@ func configureGoogleOauth(cfg *OauthConfig, tls bool) error {
|
|||||||
|
|
||||||
key := []byte(cfg.HashKeyRaw)
|
key := []byte(cfg.HashKeyRaw)
|
||||||
|
|
||||||
cookieHandler := zhttp.NewCookieHandler(key, key, zhttp.WithUnsecure(), zhttp.WithDomain(cfg.RedirectUrl))
|
u, err := url.Parse(redirectUrl)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("unable to parse redirect url: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
parts := strings.Split(u.Hostname(), ".")
|
||||||
|
domain := parts[len(parts)-2] + "." + parts[len(parts)-1]
|
||||||
|
|
||||||
|
cookieHandler := zhttp.NewCookieHandler(key, key, zhttp.WithUnsecure(), zhttp.WithDomain(domain))
|
||||||
|
|
||||||
options := []rp.Option{
|
options := []rp.Option{
|
||||||
rp.WithCookieHandler(cookieHandler),
|
rp.WithCookieHandler(cookieHandler),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user