feat(handler/login): log existing sid on prompt

This commit is contained in:
Trong Huu Nguyen
2023-12-19 12:18:12 +01:00
parent 50e53330b9
commit 55839d72f0
2 changed files with 9 additions and 1 deletions

View File

@@ -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))

View File

@@ -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 {