Skip to content

Commit

Permalink
feat(saml): fix to prevent null user id
Browse files Browse the repository at this point in the history
Signed-off-by: ThibaultHerard <[email protected]>
  • Loading branch information
ThibHrrd committed Oct 17, 2022
1 parent 2366410 commit 141a9a3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions selfservice/strategy/saml/strategy_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import (
// Handle SAML Assertion and process to either login or register
func (s *Strategy) processLoginOrRegister(w http.ResponseWriter, r *http.Request, loginFlow *login.Flow, provider Provider, claims *Claims) (*flow.Flow, error) {

// If the user'ID is null, we have to handler error
if claims.Subject == "" {
return nil, s.handleError(w, r, loginFlow, provider.Config().ID, nil, errors.New("the user ID is empty: the problem probably comes from the mapping between the SAML attributes and the identity attributes"))
}

// This is a check to see if the user exists in the database
i, c, err := s.d.PrivilegedIdentityPool().FindByCredentialsIdentifier(r.Context(), identity.CredentialsTypeSAML, uid(provider.Config().ID, claims.Subject))

Expand Down

0 comments on commit 141a9a3

Please sign in to comment.