Unindent session updates on finalizeLogin

This commit is contained in:
Joel Speed 2019-09-25 21:27:31 +01:00
parent 77fcf9ad77
commit d9095073c8
No known key found for this signature in database
GPG Key ID: 6E80578D6751DEFB

View File

@ -505,7 +505,12 @@ func (s *Server) finalizeLogin(identity connector.Identity, authReq storage.Auth
s.logger.Infof("login successful: connector %q, username=%q, preferred_username=%q, email=%q, groups=%q",
authReq.ConnectorID, claims.Username, claims.PreferredUsername, email, claims.Groups)
if _, ok := conn.(connector.RefreshConnector); ok {
returnURL := path.Join(s.issuerURL.Path, "/approval") + "?req=" + authReq.ID
_, ok := conn.(connector.RefreshConnector)
if !ok {
return returnURL, nil
}
// Try to retrieve an existing OfflineSession object for the corresponding user.
if session, err := s.storage.GetOfflineSessions(identity.UserID, authReq.ConnectorID); err != nil {
if err != storage.ErrNotFound {
@ -536,11 +541,9 @@ func (s *Server) finalizeLogin(identity connector.Identity, authReq storage.Auth
s.logger.Errorf("failed to update offline session: %v", err)
return "", err
}
}
}
return path.Join(s.issuerURL.Path, "/approval") + "?req=" + authReq.ID, nil
return returnURL, nil
}
func (s *Server) handleApproval(w http.ResponseWriter, r *http.Request) {