mirror of
https://github.com/nais/wonderwall.git
synced 2026-02-14 17:49:54 +00:00
feat(handler): set legacy cookie for sso server
This commit is contained in:
@@ -148,6 +148,14 @@ func EncryptAndSet(w http.ResponseWriter, key, value string, opts Options, crypt
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetLegacyCookie(w http.ResponseWriter, value string, opts Options) {
|
||||
c := Make(loginservice, value, opts.
|
||||
WithSameSite(http.SameSiteNoneMode).
|
||||
WithPath("/"))
|
||||
c.UnsetExpiry()
|
||||
Set(w, c)
|
||||
}
|
||||
|
||||
func ClearLegacyCookies(w http.ResponseWriter, opts Options) {
|
||||
// TODO - remove when legacy services are sunset and shut down
|
||||
Clear(w, loginservice, opts.
|
||||
|
||||
@@ -210,6 +210,11 @@ func (s *Standalone) LoginCallback(w http.ResponseWriter, r *http.Request) {
|
||||
"jti": tokens.IDToken.GetJwtID(),
|
||||
}
|
||||
|
||||
// TODO - remove when legacy services are sunset and shut down
|
||||
if s.Config.SSO.IsServer() && s.Config.OpenID.Provider == config.ProviderIDPorten {
|
||||
cookie.SetLegacyCookie(w, tokens.AccessToken, opts)
|
||||
}
|
||||
|
||||
mw.LogEntryFrom(r).WithFields(fields).Info("callback: successful login")
|
||||
metrics.ObserveLogin(tokens.IDToken.GetAmrClaim(), redirect)
|
||||
cookie.Clear(w, cookie.Retry, s.GetCookieOptions(r))
|
||||
|
||||
Reference in New Issue
Block a user