-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
OpenIndiana hipster
The attributes UPN and sAMAccountName are independent.
UPN=a@b.c.d and sAMAccountName=e are valid values for an user object in AD.
The method getPrincipalName is wrong when the user used the sAMAccountName in the login form and sAMAccountName is unequal from the first token before the @ in the UPN.
And this is the case if you follow the recommendations from Microsoft.
See here https://msdn.microsoft.com/en-us/library/ms680857(v=vs.85).aspx
This is just true for a special case and will fail in all other cases_
String samAccountName = userPrincipalName.substring(0, userPrincipalName.indexOf('@'));