Use less deep nesting

Co-authored-by: Jan Larwig <jan@larwig.com>
This commit is contained in:
Kevin Kreitner 2025-01-12 17:34:43 +01:00 committed by Jan Larwig
parent 4fb6043b04
commit 919d491cdc
No known key found for this signature in database
GPG Key ID: C2172BFA220A037A
1 changed files with 4 additions and 5 deletions

View File

@ -66,11 +66,10 @@ func (p *CIDAASProvider) RefreshSession(ctx context.Context, s *sessions.Session
// EnrichSession data to add email an groups
func (p *CIDAASProvider) EnrichSession(ctx context.Context, s *sessions.SessionState) error {
if p.ProfileURL.String() == "" {
if s.Email == "" {
return errors.New("id_token did not contain an email and profileURL is not defined")
}
return nil
if p.ProfileURL.String() == "" && s.Email == "" {
return errors.New("id_token did not contain an email and profileURL is not defined")
} else if p.ProfileURL.String() == "" {
return nil
}
// Try to get missing emails or groups from a profileURL