Skip to content
Permalink
Browse files
Merge pull request #12 from nieuwtje/upn-login-double-domain
[FIXED JENKINS-26737] AD can not log on with email address
  • Loading branch information
fbelzunc committed Mar 4, 2016
2 parents 5372151 + 7c04f78 commit 3a5ee3bf2007beabcde04844e8fba57bacad2255
Showing 1 changed file with 4 additions and 4 deletions.
@@ -376,16 +376,16 @@ private String getStringAttribute(Attributes user, String name) throws NamingExc
/**
* Returns the full user principal name of the form "joe@europe.contoso.com".
*
* If people type in 'foo@bar' or 'bar\\foo', it should be treated as
* 'foo@bar.acme.org' (where 'acme.org' part comes from the given domain name)
* If people type in 'foo@bar' or 'bar\foo' or just 'foo', it should be treated as
* 'foo@bar' (where 'bar' represents the given domain name)
*/
private String getPrincipalName(String username, String domainName) {
String principalName;
int slash = username.indexOf('\\');
if (slash>0) {
principalName = username.substring(slash+1)+'@'+username.substring(0, slash)+'.'+domainName;
principalName = username.substring(slash+1)+'@'+domainName;
} else if (username.contains("@"))
principalName = username+'.'+domainName;
principalName = username;
else
principalName = username+'@'+domainName;
return principalName;

0 comments on commit 3a5ee3b

Please sign in to comment.