Remove false failed errors.

Signed-off-by: Happy2C0de <46957159+Happy2C0de@users.noreply.github.com>
This commit is contained in:
Happy2C0de 2021-08-19 13:23:02 +02:00
parent 2b6bb1997c
commit 1608b473eb
2 changed files with 2 additions and 8 deletions

View file

@ -299,10 +299,7 @@ func (c *oidcConnector) createIdentity(ctx context.Context, identity connector.I
preferredUsername, found := claims[prefUsername].(string)
if (!found || c.overrideClaimMapping) && c.preferredUsernameKey != "" {
prefUsername = c.preferredUsernameKey
preferredUsername, found = claims[prefUsername].(string)
if !found {
return identity, fmt.Errorf("missing \"%s\" claim", prefUsername)
}
preferredUsername, _ = claims[prefUsername].(string)
}
hasEmailScope := false
@ -319,9 +316,6 @@ func (c *oidcConnector) createIdentity(ctx context.Context, identity connector.I
if (!found || c.overrideClaimMapping) && c.emailKey != "" {
emailKey = c.emailKey
email, found = claims[emailKey].(string)
if !found {
return identity, fmt.Errorf("missing \"%s\" claim", emailKey)
}
}
if !found && hasEmailScope {

View file

@ -253,7 +253,7 @@ func TestHandleCallback(t *testing.T) {
},
},
{
name: "customGroupsKeyButGroupsProvidedButOverride",
name: "customGroupsKeyDespiteGroupsProvidedButOverride",
overrideClaimMapping: true,
groupsKey: "cognito:groups",
expectUserID: "subvalue",