Skip to content

Commit dd88dab

Browse files
MM53orange-hbenmabrouk
authored andcommitted
Store offline sessions only if they were requested by the user (dexidp#3125)
Signed-off-by: MM53 <2821Signed-off-by: MM53 <[email protected]> Signed-off-by: Houssem Ben Mabrouk <[email protected]>
1 parent 6439317 commit dd88dab

File tree

2 files changed

+249
-126
lines changed

2 files changed

+249
-126
lines changed

server/handlers.go

+11
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,17 @@ func (s *Server) finalizeLogin(identity connector.Identity, authReq storage.Auth
539539
return returnURL, false, nil
540540
}
541541

542+
offlineAccessRequested := false
543+
for _, scope := range authReq.Scopes {
544+
if scope == scopeOfflineAccess {
545+
offlineAccessRequested = true
546+
break
547+
}
548+
}
549+
if !offlineAccessRequested {
550+
return returnURL, false, nil
551+
}
552+
542553
// Try to retrieve an existing OfflineSession object for the corresponding user.
543554
session, err := s.storage.GetOfflineSessions(identity.UserID, authReq.ConnectorID)
544555
if err != nil {

0 commit comments

Comments
 (0)