Reputation: 77
Can anyone advise how I might be able to retrieve the current logged on Active Directory user?
I have been looking through how this would normally be done in JSF:
javax.faces.context.FacesContext.getCurrentInstance().getExternalContext().getRequest().getUserPrincipal()
Unfortunately this always seems to retrieve the domino user.
Upvotes: 0
Views: 882
Reputation: 11
If you use the LDAP distinguishedName attribute as Domino suggests you may be able to get an LDAP authenticated user's name using a formula like this:
@If(
@NameLookup([NoUpdate]:[NoSearching]; @UserName ;"Fullname")!=""; @Name([CN];@UserName);
@NameLookup([NoUpdate]:[TrustedOnly]; @UserName; "cn")=@Name([CN];@UserName); @NameLookup( [NoUpdate]:[TrustedOnly]; @UserName ;"displayName");
@UserName );
But in Xpages I think you'll need to use Java to do an LDAP lookup.
Upvotes: 1
Reputation: 20384
There is no such thing as "Active Directory User". When you authenticate with a Domino server you always get a "Domino user" regardless of what you authenticated your user against. I would suspect that the AD is delivering a "Domino user" name on authentication which can look different from the AD credentials depending on your configuration. So your course of action would then be a LDAP lookup into AD to get the matching AD user.
Upvotes: 2