mirror of
https://github.com/openziti/zrok.git
synced 2024-11-07 08:44:14 +01: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"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
@ -43,7 +44,15 @@ func configureGithubOauth(cfg *OauthConfig, tls bool) error {
|
||||
|
||||
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{
|
||||
rp.WithCookieHandler(cookieHandler),
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
@ -44,7 +45,15 @@ func configureGoogleOauth(cfg *OauthConfig, tls bool) error {
|
||||
|
||||
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{
|
||||
rp.WithCookieHandler(cookieHandler),
|
||||
|
Loading…
Reference in New Issue
Block a user