Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group Augmentation fails with email and AD #22

Closed
mrbubble62 opened this issue Oct 3, 2017 · 6 comments
Closed

Group Augmentation fails with email and AD #22

mrbubble62 opened this issue Oct 3, 2017 · 6 comments
Assignees
Labels

Comments

@mrbubble62
Copy link

When requestInfo.IncomingEntity.Value type is email

adUser = UserPrincipal.FindByIdentity(principalContext, requestInfo.IncomingEntity.Value)

FindByIdentity always returns null

@mrbubble62
Copy link
Author

mrbubble62 commented Oct 4, 2017

This solution works for email but will break every other type..

using (PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, directoryDomainFqdn))
{

   using (UserPrincipal user_principal = new UserPrincipal(principalContext) { Enabled = true, EmailAddress = requestInfo.IncomingEntity.Value })
  
using (PrincipalSearcher user_searcher = new PrincipalSearcher(user_principal))
 
 using (PrincipalSearchResult<Principal> results = user_searcher.FindAll())
    {
       UserPrincipal adUser = (UserPrincipal)results.First();
       if (adUser == null) return groups;
...

@Yvand
Copy link
Owner

Yvand commented Oct 4, 2017

I will investigate this and let you know my findings

@Yvand Yvand self-assigned this Oct 4, 2017
@mrbubble62
Copy link
Author

I think you'll find UserPrincipal.FindByIdentity's IdentityType does not support email.

https://msdn.microsoft.com/en-us/library/bb356425%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

@Yvand
Copy link
Owner

Yvand commented Oct 9, 2017

Thank you for your analysis, you are correct, current implementation doesn't work with emails.
I'm updating the code to check if current claim type is an email, and if so implement basically your solution.

@Yvand Yvand added the bug label Oct 9, 2017
@Yvand
Copy link
Owner

Yvand commented Oct 10, 2017

I published a new release (v2017-10) that fixes this bug. Can you please try it out?

@Yvand
Copy link
Owner

Yvand commented Oct 18, 2017

Closing as I got no feedback from @mrbubble62

@Yvand Yvand closed this as completed Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants