Merge pull request #8822 from owncloud/backport/stable5/same-site-cookie-setting

backport enhancement: same site strict cookies to stable 5
This commit is contained in:
Michael Barz
2024-04-10 12:24:02 +02:00
committed by GitHub
18 changed files with 136 additions and 56 deletions
@@ -0,0 +1,12 @@
Enhancement: Make IDP cookies same site strict
To enhance the security of our application and prevent Cross-Site Request Forgery (CSRF) attacks, we have updated the
SameSite attribute of the build in Identity Provider (IDP) cookies to Strict.
This change restricts the browser from sending these cookies with any cross-site requests,
thereby limiting the exposure of the user's session to potential threats.
This update does not impact the existing functionality of the application but provides an additional layer of security
where needed.
https://github.com/owncloud/ocis/pull/8716
+1 -1
View File
@@ -56,7 +56,7 @@ require (
github.com/justinas/alice v1.2.0 github.com/justinas/alice v1.2.0
github.com/leonelquinteros/gotext v1.5.3-0.20230317130943-71a59c05b2c1 github.com/leonelquinteros/gotext v1.5.3-0.20230317130943-71a59c05b2c1
github.com/libregraph/idm v0.4.1-0.20231213140724-56a222fb4215 github.com/libregraph/idm v0.4.1-0.20231213140724-56a222fb4215
github.com/libregraph/lico v0.61.2 github.com/libregraph/lico v0.61.3-0.20240322112242-72cf9221d3a7
github.com/mitchellh/mapstructure v1.5.0 github.com/mitchellh/mapstructure v1.5.0
github.com/mna/pigeon v1.2.1 github.com/mna/pigeon v1.2.1
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
+2 -2
View File
@@ -1623,8 +1623,8 @@ github.com/leonelquinteros/gotext v1.5.3-0.20230317130943-71a59c05b2c1 h1:k56sFO
github.com/leonelquinteros/gotext v1.5.3-0.20230317130943-71a59c05b2c1/go.mod h1:AT4NpQrOmyj1L/+hLja6aR0lk81yYYL4ePnj2kp7d6M= github.com/leonelquinteros/gotext v1.5.3-0.20230317130943-71a59c05b2c1/go.mod h1:AT4NpQrOmyj1L/+hLja6aR0lk81yYYL4ePnj2kp7d6M=
github.com/libregraph/idm v0.4.1-0.20231213140724-56a222fb4215 h1:Yw/I6l/0S/zDq2Hnibvwy8cVLpMaBwDe0aUSv/FNU6U= github.com/libregraph/idm v0.4.1-0.20231213140724-56a222fb4215 h1:Yw/I6l/0S/zDq2Hnibvwy8cVLpMaBwDe0aUSv/FNU6U=
github.com/libregraph/idm v0.4.1-0.20231213140724-56a222fb4215/go.mod h1:h/B7mB5OqrsrobydErMGewHxonYDKjGOaJsFabXyRo8= github.com/libregraph/idm v0.4.1-0.20231213140724-56a222fb4215/go.mod h1:h/B7mB5OqrsrobydErMGewHxonYDKjGOaJsFabXyRo8=
github.com/libregraph/lico v0.61.2 h1:sU8eQ2E9Uq5wnTkD33YX5+gRj59MkPLgDVoB72L1q8w= github.com/libregraph/lico v0.61.3-0.20240322112242-72cf9221d3a7 h1:fcPgiBu7DGyGeokE0Qk+S+GW/3n+QWu1dIjw0TqadhI=
github.com/libregraph/lico v0.61.2/go.mod h1:TgZGBAYzVRQSRdBC8PgGQKjYhtXuTr6UCM3ZZyGTleQ= github.com/libregraph/lico v0.61.3-0.20240322112242-72cf9221d3a7/go.mod h1:TgZGBAYzVRQSRdBC8PgGQKjYhtXuTr6UCM3ZZyGTleQ=
github.com/libregraph/oidc-go v1.0.0 h1:l2tE/EwLyLXVy0B5BuVKgIFX9pNpz/5J3x5IBw0KEhc= github.com/libregraph/oidc-go v1.0.0 h1:l2tE/EwLyLXVy0B5BuVKgIFX9pNpz/5J3x5IBw0KEhc=
github.com/libregraph/oidc-go v1.0.0/go.mod h1:7TRHrY/H1Vg6JqFjV0oAe1+kN+mGFBqXYvclSyvhRyc= github.com/libregraph/oidc-go v1.0.0/go.mod h1:7TRHrY/H1Vg6JqFjV0oAe1+kN+mGFBqXYvclSyvhRyc=
github.com/linode/linodego v0.25.3/go.mod h1:GSBKPpjoQfxEfryoCRcgkuUOCuVtGHWhzI8OMdycNTE= github.com/linode/linodego v0.25.3/go.mod h1:GSBKPpjoQfxEfryoCRcgkuUOCuVtGHWhzI8OMdycNTE=
+13 -6
View File
@@ -25,6 +25,7 @@ import (
"github.com/libregraph/lico/identifier" "github.com/libregraph/lico/identifier"
"github.com/libregraph/lico/identity" "github.com/libregraph/lico/identity"
"github.com/libregraph/lico/identity/managers" "github.com/libregraph/lico/identity/managers"
cs3 "github.com/owncloud/ocis/v2/services/idp/pkg/backends/cs3/identifier" cs3 "github.com/owncloud/ocis/v2/services/idp/pkg/backends/cs3/identifier"
) )
@@ -88,12 +89,18 @@ func NewIdentityManager(bs bootstrap.Bootstrap) (identity.Manager, error) {
activeIdentifier, err := identifier.NewIdentifier(&identifier.Config{ activeIdentifier, err := identifier.NewIdentifier(&identifier.Config{
Config: config.Config, Config: config.Config,
BaseURI: config.IssuerIdentifierURI, BaseURI: config.IssuerIdentifierURI,
PathPrefix: bs.MakeURIPath(bootstrap.APITypeSignin, ""), PathPrefix: bs.MakeURIPath(bootstrap.APITypeSignin, ""),
StaticFolder: config.IdentifierClientPath, StaticFolder: config.IdentifierClientPath,
LogonCookieName: "__Secure-KKT", // Kopano-Konnect-Token ScopesConf: config.IdentifierScopesConf,
ScopesConf: config.IdentifierScopesConf, WebAppDisabled: config.IdentifierClientDisabled,
WebAppDisabled: config.IdentifierClientDisabled,
LogonCookieName: "__Secure-KKT", // Kopano-Konnect-Token
LogonCookieSameSite: config.CookieSameSite,
ConsentCookieSameSite: config.CookieSameSite,
StateCookieSameSite: config.CookieSameSite,
AuthorizationEndpointURI: fullAuthorizationEndpointURL, AuthorizationEndpointURI: fullAuthorizationEndpointURL,
SignedOutEndpointURI: fullSignedOutEndpointURL, SignedOutEndpointURI: fullSignedOutEndpointURL,
+2
View File
@@ -2,6 +2,7 @@ package config
import ( import (
"context" "context"
"net/http"
"github.com/owncloud/ocis/v2/ocis-pkg/shared" "github.com/owncloud/ocis/v2/ocis-pkg/shared"
) )
@@ -112,6 +113,7 @@ type Settings struct {
CookieBackendURI string CookieBackendURI string
CookieNames []string CookieNames []string
CookieSameSite http.SameSite
AccessTokenDurationSeconds uint64 `yaml:"access_token_duration_seconds" env:"IDP_ACCESS_TOKEN_EXPIRATION" desc:"'Access token lifespan in seconds (time before an access token is expired).'" introductionVersion:"pre5.0"` AccessTokenDurationSeconds uint64 `yaml:"access_token_duration_seconds" env:"IDP_ACCESS_TOKEN_EXPIRATION" desc:"'Access token lifespan in seconds (time before an access token is expired).'" introductionVersion:"pre5.0"`
IDTokenDurationSeconds uint64 `yaml:"id_token_duration_seconds" env:"IDP_ID_TOKEN_EXPIRATION" desc:"ID token lifespan in seconds (time before an ID token is expired)." introductionVersion:"pre5.0"` IDTokenDurationSeconds uint64 `yaml:"id_token_duration_seconds" env:"IDP_ID_TOKEN_EXPIRATION" desc:"ID token lifespan in seconds (time before an ID token is expired)." introductionVersion:"pre5.0"`
@@ -1,6 +1,7 @@
package defaults package defaults
import ( import (
"net/http"
"path/filepath" "path/filepath"
"strings" "strings"
@@ -64,6 +65,7 @@ func DefaultConfig() *config.Config {
ValidationKeysPath: "", ValidationKeysPath: "",
CookieBackendURI: "", CookieBackendURI: "",
CookieNames: nil, CookieNames: nil,
CookieSameSite: http.SameSiteStrictMode,
AccessTokenDurationSeconds: 60 * 5, // 5 minutes AccessTokenDurationSeconds: 60 * 5, // 5 minutes
IDTokenDurationSeconds: 60 * 5, // 5 minutes IDTokenDurationSeconds: 60 * 5, // 5 minutes
RefreshTokenDurationSeconds: 60 * 60 * 24 * 30, // 30 days RefreshTokenDurationSeconds: 60 * 60 * 24 * 30, // 30 days
+12 -6
View File
@@ -127,12 +127,18 @@ func NewIdentityManager(bs bootstrap.Bootstrap) (identity.Manager, error) {
activeIdentifier, err := identifier.NewIdentifier(&identifier.Config{ activeIdentifier, err := identifier.NewIdentifier(&identifier.Config{
Config: config.Config, Config: config.Config,
BaseURI: config.IssuerIdentifierURI, BaseURI: config.IssuerIdentifierURI,
PathPrefix: bs.MakeURIPath(bootstrap.APITypeSignin, ""), PathPrefix: bs.MakeURIPath(bootstrap.APITypeSignin, ""),
StaticFolder: config.IdentifierClientPath, StaticFolder: config.IdentifierClientPath,
LogonCookieName: "__Secure-KKT", // Kopano-Konnect-Token ScopesConf: config.IdentifierScopesConf,
ScopesConf: config.IdentifierScopesConf, WebAppDisabled: config.IdentifierClientDisabled,
WebAppDisabled: config.IdentifierClientDisabled,
LogonCookieName: "__Secure-KKT", // Kopano-Konnect-Token
LogonCookieSameSite: config.CookieSameSite,
ConsentCookieSameSite: config.CookieSameSite,
StateCookieSameSite: config.CookieSameSite,
AuthorizationEndpointURI: fullAuthorizationEndpointURL, AuthorizationEndpointURI: fullAuthorizationEndpointURL,
SignedOutEndpointURI: fullSignedOutEndpointURL, SignedOutEndpointURI: fullSignedOutEndpointURL,
@@ -110,12 +110,18 @@ func NewIdentityManager(bs bootstrap.Bootstrap) (identity.Manager, error) {
activeIdentifier, err := identifier.NewIdentifier(&identifier.Config{ activeIdentifier, err := identifier.NewIdentifier(&identifier.Config{
Config: config.Config, Config: config.Config,
BaseURI: config.IssuerIdentifierURI, BaseURI: config.IssuerIdentifierURI,
PathPrefix: bs.MakeURIPath(bootstrap.APITypeSignin, ""), PathPrefix: bs.MakeURIPath(bootstrap.APITypeSignin, ""),
StaticFolder: config.IdentifierClientPath, StaticFolder: config.IdentifierClientPath,
LogonCookieName: "__Secure-KKT", // Kopano-Konnect-Token ScopesConf: config.IdentifierScopesConf,
ScopesConf: config.IdentifierScopesConf, WebAppDisabled: config.IdentifierClientDisabled,
WebAppDisabled: config.IdentifierClientDisabled,
LogonCookieName: "__Secure-KKT", // Kopano-Konnect-Token
LogonCookieSameSite: config.CookieSameSite,
ConsentCookieSameSite: config.CookieSameSite,
StateCookieSameSite: config.CookieSameSite,
AuthorizationEndpointURI: fullAuthorizationEndpointURL, AuthorizationEndpointURI: fullAuthorizationEndpointURL,
SignedOutEndpointURI: fullSignedOutEndpointURL, SignedOutEndpointURI: fullSignedOutEndpointURL,
+14 -4
View File
@@ -26,6 +26,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"net" "net"
"net/http"
"net/url" "net/url"
"os" "os"
"path/filepath" "path/filepath"
@@ -58,6 +59,7 @@ const (
DefaultSigningKeyBits = 2048 DefaultSigningKeyBits = 2048
DefaultGuestIdentityManagerName = "guest" DefaultGuestIdentityManagerName = "guest"
DefaultCookieSameSite = http.SameSiteNoneMode
) )
// Bootstrap is a data structure to hold configuration required to start // Bootstrap is a data structure to hold configuration required to start
@@ -332,6 +334,12 @@ func (bs *bootstrap) initialize(settings *Settings) error {
} }
bs.config.DyamicClientSecretDurationSeconds = settings.DyamicClientSecretDurationSeconds bs.config.DyamicClientSecretDurationSeconds = settings.DyamicClientSecretDurationSeconds
// add setting to allow setting the same site attribute of the cookies
bs.config.CookieSameSite = settings.CookieSameSite
if bs.config.CookieSameSite == 0 {
bs.config.CookieSameSite = DefaultCookieSameSite
}
return nil return nil
} }
@@ -472,11 +480,13 @@ func (bs *bootstrap) setupOIDCProvider(ctx context.Context) (*oidcProvider.Provi
CheckSessionIframePath: bs.MakeURIPath(APITypeKonnect, "/session/check-session.html"), CheckSessionIframePath: bs.MakeURIPath(APITypeKonnect, "/session/check-session.html"),
RegistrationPath: registrationPath, RegistrationPath: registrationPath,
BrowserStateCookiePath: bs.MakeURIPath(APITypeKonnect, "/session/"), BrowserStateCookiePath: bs.MakeURIPath(APITypeKonnect, "/session/"),
BrowserStateCookieName: "__Secure-KKBS", // Kopano-Konnect-Browser-State BrowserStateCookieName: "__Secure-KKBS", // Kopano-Konnect-Browser-State
BrowserStateCookieSameSite: bs.config.CookieSameSite,
SessionCookiePath: sessionCookiePath, SessionCookiePath: sessionCookiePath,
SessionCookieName: "__Secure-KKCS", // Kopano-Konnect-Client-Session SessionCookieName: "__Secure-KKCS", // Kopano-Konnect-Client-Session
SessionCookieSameSite: bs.config.CookieSameSite,
AccessTokenDuration: time.Duration(bs.config.AccessTokenDurationSeconds) * time.Second, AccessTokenDuration: time.Duration(bs.config.AccessTokenDurationSeconds) * time.Second,
IDTokenDuration: time.Duration(bs.config.IDTokenDurationSeconds) * time.Second, IDTokenDuration: time.Duration(bs.config.IDTokenDurationSeconds) * time.Second,
+3
View File
@@ -21,6 +21,7 @@ import (
"crypto" "crypto"
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
"net/http"
"net/url" "net/url"
"github.com/golang-jwt/jwt/v4" "github.com/golang-jwt/jwt/v4"
@@ -64,4 +65,6 @@ type Config struct {
IDTokenDurationSeconds uint64 IDTokenDurationSeconds uint64
RefreshTokenDurationSeconds uint64 RefreshTokenDurationSeconds uint64
DyamicClientSecretDurationSeconds uint64 DyamicClientSecretDurationSeconds uint64
CookieSameSite http.SameSite
} }
+5
View File
@@ -17,6 +17,10 @@
package bootstrap package bootstrap
import (
"net/http"
)
// Settings is a typed application config which represents the user accessible // Settings is a typed application config which represents the user accessible
// boostrap settings params. // boostrap settings params.
type Settings struct { type Settings struct {
@@ -48,6 +52,7 @@ type Settings struct {
ValidationKeysPath string ValidationKeysPath string
CookieBackendURI string CookieBackendURI string
CookieNames []string CookieNames []string
CookieSameSite http.SameSite
AccessTokenDurationSeconds uint64 AccessTokenDurationSeconds uint64
IDTokenDurationSeconds uint64 IDTokenDurationSeconds uint64
RefreshTokenDurationSeconds uint64 RefreshTokenDurationSeconds uint64
+10 -3
View File
@@ -18,6 +18,7 @@
package identifier package identifier
import ( import (
"net/http"
"net/url" "net/url"
"github.com/libregraph/lico/config" "github.com/libregraph/lico/config"
@@ -28,9 +29,15 @@ import (
type Config struct { type Config struct {
Config *config.Config Config *config.Config
BaseURI *url.URL BaseURI *url.URL
LogonCookieName string ScopesConf string
ScopesConf string
LogonCookieName string
LogonCookieSameSite http.SameSite
ConsentCookieSameSite http.SameSite
StateCookieSameSite http.SameSite
PathPrefix string PathPrefix string
StaticFolder string StaticFolder string
+6 -6
View File
@@ -37,7 +37,7 @@ func (i *Identifier) setLogonCookie(rw http.ResponseWriter, value string) error
Path: i.pathPrefix + "/identifier/_/", Path: i.pathPrefix + "/identifier/_/",
Secure: true, Secure: true,
HttpOnly: true, HttpOnly: true,
SameSite: http.SameSiteNoneMode, SameSite: i.logonCookieSameSite,
} }
http.SetCookie(rw, &cookie) http.SetCookie(rw, &cookie)
@@ -55,7 +55,7 @@ func (i *Identifier) removeLogonCookie(rw http.ResponseWriter) error {
Path: i.pathPrefix + "/identifier/_/", Path: i.pathPrefix + "/identifier/_/",
Secure: true, Secure: true,
HttpOnly: true, HttpOnly: true,
SameSite: http.SameSiteNoneMode, SameSite: i.logonCookieSameSite,
Expires: farPastExpiryTime, Expires: farPastExpiryTime,
} }
@@ -78,7 +78,7 @@ func (i *Identifier) setConsentCookie(rw http.ResponseWriter, cr *ConsentRequest
Path: i.pathPrefix + "/identifier/_/", Path: i.pathPrefix + "/identifier/_/",
Secure: true, Secure: true,
HttpOnly: true, HttpOnly: true,
SameSite: http.SameSiteNoneMode, SameSite: i.consentCookieSameSite,
} }
http.SetCookie(rw, &cookie) http.SetCookie(rw, &cookie)
@@ -106,7 +106,7 @@ func (i *Identifier) removeConsentCookie(rw http.ResponseWriter, req *http.Reque
Path: i.pathPrefix + "/identifier/_/", Path: i.pathPrefix + "/identifier/_/",
Secure: true, Secure: true,
HttpOnly: true, HttpOnly: true,
SameSite: http.SameSiteNoneMode, SameSite: i.consentCookieSameSite,
Expires: farPastExpiryTime, Expires: farPastExpiryTime,
} }
@@ -150,7 +150,7 @@ func (i *Identifier) setStateCookie(rw http.ResponseWriter, scope string, state
Path: i.pathPrefix + "/identifier/" + scope, Path: i.pathPrefix + "/identifier/" + scope,
Secure: true, Secure: true,
HttpOnly: true, HttpOnly: true,
SameSite: http.SameSiteNoneMode, SameSite: i.stateCookieSameSite,
} }
http.SetCookie(rw, &cookie) http.SetCookie(rw, &cookie)
@@ -178,7 +178,7 @@ func (i *Identifier) removeStateCookie(rw http.ResponseWriter, req *http.Request
Path: i.pathPrefix + "/identifier/" + scope, Path: i.pathPrefix + "/identifier/" + scope,
Secure: true, Secure: true,
HttpOnly: true, HttpOnly: true,
SameSite: http.SameSiteNoneMode, SameSite: i.stateCookieSameSite,
Expires: farPastExpiryTime, Expires: farPastExpiryTime,
} }
+18 -5
View File
@@ -32,8 +32,10 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/longsleep/rndm" "github.com/longsleep/rndm"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
jose "gopkg.in/square/go-jose.v2" "gopkg.in/square/go-jose.v2"
jwt "gopkg.in/square/go-jose.v2/jwt" "gopkg.in/square/go-jose.v2/jwt"
"github.com/libregraph/oidc-go"
konnect "github.com/libregraph/lico" konnect "github.com/libregraph/lico"
"github.com/libregraph/lico/identifier/backends" "github.com/libregraph/lico/identifier/backends"
@@ -44,7 +46,6 @@ import (
"github.com/libregraph/lico/identity/clients" "github.com/libregraph/lico/identity/clients"
"github.com/libregraph/lico/managers" "github.com/libregraph/lico/managers"
"github.com/libregraph/lico/utils" "github.com/libregraph/lico/utils"
"github.com/libregraph/oidc-go"
) )
// audienceMarker defines the value which gets included in logon cookies. Valid // audienceMarker defines the value which gets included in logon cookies. Valid
@@ -62,10 +63,16 @@ type Identifier struct {
baseURI *url.URL baseURI *url.URL
pathPrefix string pathPrefix string
staticFolder string staticFolder string
logonCookieName string
scopesConf string scopesConf string
webappIndexHTML []byte webappIndexHTML []byte
logonCookieName string
logonCookieSameSite http.SameSite
consentCookieSameSite http.SameSite
stateCookieSameSite http.SameSite
authorizationEndpointURI *url.URL authorizationEndpointURI *url.URL
signedOutEndpointURI *url.URL signedOutEndpointURI *url.URL
oauth2CbEndpointURI *url.URL oauth2CbEndpointURI *url.URL
@@ -114,10 +121,16 @@ func NewIdentifier(c *Config) (*Identifier, error) {
baseURI: c.BaseURI, baseURI: c.BaseURI,
pathPrefix: c.PathPrefix, pathPrefix: c.PathPrefix,
staticFolder: staticFolder, staticFolder: staticFolder,
logonCookieName: c.LogonCookieName,
scopesConf: c.ScopesConf, scopesConf: c.ScopesConf,
webappIndexHTML: webappIndexHTML, webappIndexHTML: webappIndexHTML,
logonCookieName: c.LogonCookieName,
logonCookieSameSite: c.LogonCookieSameSite,
consentCookieSameSite: c.ConsentCookieSameSite,
stateCookieSameSite: c.StateCookieSameSite,
authorizationEndpointURI: c.AuthorizationEndpointURI, authorizationEndpointURI: c.AuthorizationEndpointURI,
signedOutEndpointURI: c.SignedOutEndpointURI, signedOutEndpointURI: c.SignedOutEndpointURI,
oauth2CbEndpointURI: oauth2CbEndpointURI, oauth2CbEndpointURI: oauth2CbEndpointURI,
+7 -4
View File
@@ -18,6 +18,7 @@
package provider package provider
import ( import (
"net/http"
"time" "time"
"github.com/libregraph/lico/config" "github.com/libregraph/lico/config"
@@ -37,11 +38,13 @@ type Config struct {
CheckSessionIframePath string CheckSessionIframePath string
RegistrationPath string RegistrationPath string
BrowserStateCookiePath string BrowserStateCookiePath string
BrowserStateCookieName string BrowserStateCookieName string
BrowserStateCookieSameSite http.SameSite
SessionCookiePath string SessionCookiePath string
SessionCookieName string SessionCookieName string
SessionCookieSameSite http.SameSite
AccessTokenDuration time.Duration AccessTokenDuration time.Duration
IDTokenDuration time.Duration IDTokenDuration time.Duration
+4 -4
View File
@@ -29,7 +29,7 @@ func (p *Provider) setBrowserStateCookie(rw http.ResponseWriter, value string) e
Path: p.browserStateCookiePath, Path: p.browserStateCookiePath,
Secure: true, Secure: true,
HttpOnly: false, // This Cookie is intended to be read by Javascript. HttpOnly: false, // This Cookie is intended to be read by Javascript.
SameSite: http.SameSiteNoneMode, SameSite: p.browserStateCookieSameSite,
} }
http.SetCookie(rw, &cookie) http.SetCookie(rw, &cookie)
@@ -43,7 +43,7 @@ func (p *Provider) removeBrowserStateCookie(rw http.ResponseWriter) error {
Path: p.browserStateCookiePath, Path: p.browserStateCookiePath,
Secure: true, Secure: true,
HttpOnly: false, // This Cookie is intended to be read by Javascript. HttpOnly: false, // This Cookie is intended to be read by Javascript.
SameSite: http.SameSiteNoneMode, SameSite: p.browserStateCookieSameSite,
Expires: farPastExpiryTime, Expires: farPastExpiryTime,
} }
@@ -60,7 +60,7 @@ func (p *Provider) setSessionCookie(rw http.ResponseWriter, value string) error
Path: p.sessionCookiePath, Path: p.sessionCookiePath,
Secure: true, Secure: true,
HttpOnly: true, HttpOnly: true,
SameSite: http.SameSiteNoneMode, SameSite: p.sessionCookieSameSite,
} }
http.SetCookie(rw, &cookie) http.SetCookie(rw, &cookie)
@@ -83,7 +83,7 @@ func (p *Provider) removeSessionCookie(rw http.ResponseWriter) error {
Path: p.sessionCookiePath, Path: p.sessionCookiePath,
Secure: true, Secure: true,
HttpOnly: true, HttpOnly: true,
SameSite: http.SameSiteNoneMode, SameSite: p.sessionCookieSameSite,
Expires: farPastExpiryTime, Expires: farPastExpiryTime,
} }
+12 -8
View File
@@ -73,11 +73,13 @@ type Provider struct {
validationKeys map[string]crypto.PublicKey validationKeys map[string]crypto.PublicKey
certificates map[string][]*x509.Certificate certificates map[string][]*x509.Certificate
browserStateCookiePath string browserStateCookiePath string
browserStateCookieName string browserStateCookieName string
browserStateCookieSameSite http.SameSite
sessionCookiePath string sessionCookiePath string
sessionCookieName string sessionCookieName string
sessionCookieSameSite http.SameSite
accessTokenDuration time.Duration accessTokenDuration time.Duration
idTokenDuration time.Duration idTokenDuration time.Duration
@@ -105,11 +107,13 @@ func NewProvider(c *Config) (*Provider, error) {
validationKeys: make(map[string]crypto.PublicKey), validationKeys: make(map[string]crypto.PublicKey),
certificates: make(map[string][]*x509.Certificate), certificates: make(map[string][]*x509.Certificate),
browserStateCookiePath: c.BrowserStateCookiePath, browserStateCookiePath: c.BrowserStateCookiePath,
browserStateCookieName: c.BrowserStateCookieName, browserStateCookieName: c.BrowserStateCookieName,
browserStateCookieSameSite: c.BrowserStateCookieSameSite,
sessionCookiePath: c.SessionCookiePath, sessionCookiePath: c.SessionCookiePath,
sessionCookieName: c.SessionCookieName, sessionCookieName: c.SessionCookieName,
sessionCookieSameSite: c.SessionCookieSameSite,
accessTokenDuration: c.AccessTokenDuration, accessTokenDuration: c.AccessTokenDuration,
idTokenDuration: c.IDTokenDuration, idTokenDuration: c.IDTokenDuration,
+1 -1
View File
@@ -1265,7 +1265,7 @@ github.com/libregraph/idm/server
github.com/libregraph/idm/server/handler github.com/libregraph/idm/server/handler
github.com/libregraph/idm/server/handler/boltdb github.com/libregraph/idm/server/handler/boltdb
github.com/libregraph/idm/server/handler/ldif github.com/libregraph/idm/server/handler/ldif
# github.com/libregraph/lico v0.61.2 # github.com/libregraph/lico v0.61.3-0.20240322112242-72cf9221d3a7
## explicit; go 1.18 ## explicit; go 1.18
github.com/libregraph/lico github.com/libregraph/lico
github.com/libregraph/lico/bootstrap github.com/libregraph/lico/bootstrap