question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UserPrincipal.FindByIdentity usage

See original GitHub issue

Dear Sirs,

At the moment, ABP queries LDAP for any identity type. Unfortunately, this may cause problems. As stated here:

The identity of the user principal. This parameter can be any format that is contained in the IdentityType enumeration. But as stated here, if identity type is not specified name attribute will be searched as well. Unfortunately, name attribute in LDAP is not unique and You can get exception System.DirectoryServices.AccountManagement.MultipleMatchesException: Multiple principals contain a matching Identity.. So, method with signature containing IdentityType should be used with identity types SamAccountName and UserPrincipalName.

Sorry, I will not be able to supply an example, as not only ABP code is necessary to recreate this situation, but LDAP server as well. To recreate this, You need to have LDAP server, where two different users have the same “Name” attribute value.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
easyestcommented, Feb 28, 2022

BTW, You made this ticket closed, so I do not think anybody will take another look 😃

0reactions
easyestcommented, Feb 28, 2022

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Principal.FindByIdentity Method (System.DirectoryServices. ...
Returns a principal object that matches the specified identity type, and value. This version of the FindByIdentity(PrincipalContext, IdentityType, String) ...
Read more >
UserPrincipal.FindByIdentity() always returns null
By using IdentityType.Name , you're telling it that the value you're passing is the name of the account (which is the cn attribute)....
Read more >
How to Get User Details from Active Directory - Sensible Dev
Now, in order to grab AD properties, I use the PrincipalContext class, which is much ... FindByIdentity(context, username); if(user != null) { ViewBag....
Read more >
Checks if user is part of Active Directory group
PrincipalContext , GroupPrincipal and UserPrincipal are implementing the IDisposable interface, hence its best practice to enclose the usage ...
Read more >
SourceOne for Files Systems: Users cannot retrieve files ...
var domain = new PrincipalContext(ContextType.Domain); var user = UserPrincipal.FindByIdentity(domain, userName);
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found