diff --git a/pkg/handler/handler.go b/pkg/handler/handler.go index acff12a..cfcb231 100644 --- a/pkg/handler/handler.go +++ b/pkg/handler/handler.go @@ -156,6 +156,10 @@ func (s *Standalone) Login(w http.ResponseWriter, r *http.Request) { sess, _ := s.SessionManager.Get(r) if sess != nil { + if sid := sess.ExternalSessionID(); sid != "" { + fields["sid"] = sid + } + err := s.SessionManager.Delete(r.Context(), sess) if err != nil && !errors.Is(err, session.ErrNotFound) { s.InternalError(w, r, fmt.Errorf("login: destroying session: %w", err)) diff --git a/pkg/session/session.go b/pkg/session/session.go index 1016bd1..006adee 100644 --- a/pkg/session/session.go +++ b/pkg/session/session.go @@ -84,7 +84,11 @@ func (in *Session) AuthTime() string { } func (in *Session) ExternalSessionID() string { - return in.data.ExternalSessionID + if in.data != nil { + return in.data.ExternalSessionID + } + + return "" } func (in *Session) IDToken() string {