Browse Source

Remove overrideWithMissingCustomEmailClaim

Signed-off-by: Happy2C0de <46957159+Happy2C0de@users.noreply.github.com>
pull/2233/head
Happy2C0de 5 years ago
parent
commit
419db81c67
  1. 4
      connector/oidc/oidc.go
  2. 17
      connector/oidc/oidc_test.go

4
connector/oidc/oidc.go

@ -314,10 +314,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 && c.overrideClaimMapping {
// If override is enabled but claim was not found, empty string is preferred over fallback.
email, found = "", true
}
}
if !found && hasEmailScope {

17
connector/oidc/oidc_test.go

@ -110,23 +110,6 @@ func TestHandleCallback(t *testing.T) {
"email_verified": true,
},
},
{
name: "overrideWithMissingCustomEmailClaim",
userIDKey: "", // not configured
userNameKey: "", // not configured
overrideClaimMapping: true,
emailKey: "custommail",
expectUserID: "subvalue",
expectUserName: "namevalue",
expectedEmailField: "",
token: map[string]interface{}{
// no "custommail" claim
"sub": "subvalue",
"name": "namevalue",
"email": "emailvalue",
"email_verified": true,
},
},
{
name: "email_verified not in claims, configured to be skipped",
insecureSkipEmailVerified: true,

Loading…
Cancel
Save