Skip to content

Commit

Permalink
fix(saml): make saml email address configurable (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Gruel authored and cfieber committed Sep 18, 2019
1 parent 13ce30d commit cf493fe
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class SamlSsoConfig extends WebSecurityConfigurerAdapter {
String roles = "memberOf"
String rolesDelimiter = ";"
String username
String email
}

@Autowired
Expand Down Expand Up @@ -212,8 +213,9 @@ class SamlSsoConfig extends WebSecurityConfigurerAdapter {
def attributes = extractAttributes(assertion)
def userAttributeMapping = samlSecurityConfigProperties.userAttributeMapping

def email = assertion.getSubject().nameID.value
String username = attributes[userAttributeMapping.username]?.get(0) ?: email
def subjectNameId = assertion.getSubject().nameID.value
def email = attributes[userAttributeMapping.email]?.get(0) ?: subjectNameId
String username = attributes[userAttributeMapping.username]?.get(0) ?: subjectNameId
def roles = extractRoles(email, attributes, userAttributeMapping)

if (samlSecurityConfigProperties.requiredRoles) {
Expand Down

0 comments on commit cf493fe

Please sign in to comment.