From 919d491cdc186017641cd24a7489d32dde3ff218 Mon Sep 17 00:00:00 2001 From: Kevin Kreitner Date: Sun, 12 Jan 2025 17:34:43 +0100 Subject: [PATCH] Use less deep nesting Co-authored-by: Jan Larwig --- providers/cidaas.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/providers/cidaas.go b/providers/cidaas.go index 90c70d23..766f9e27 100644 --- a/providers/cidaas.go +++ b/providers/cidaas.go @@ -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