IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Question: Getting Authenticated User's Roles/Groups from Windows AD

Open kenneth-y opened this issue 9 years ago • 5 comments

Hi,

I'm using IdentityServer4 in my application using Windows Integrated authentication (Active Directory).

Quite new to using IdentityServer4. :) Does IdentityServer4 by default returns the authenticated user's AD Groups? Or, do I need to explicitly request that info?

Appreciate your inputs.

Thanks!

kenneth-y avatar Apr 26 '17 09:04 kenneth-y

You would need to capture the Windows groups at login time - like here

https://github.com/IdentityServer/IdentityServer4.Quickstart.UI/blob/release/Quickstart/Account/AccountController.cs#L138

This would make them available to your profile service - which in turn can then put them into a token.

leastprivilege avatar Apr 26 '17 12:04 leastprivilege

thanks for the response @leastprivilege. i do see the claims being added from the AccountController when I placed a breakpoint on code block below.

image

Tried enumerating the claims of the authenticated user from my MVC Web App (client) but i could not see the roles. So I guess i need to extend the IProfileService interface, is that right?

Also tried inspecting the claims inside in GetProfileDataAsync() method of my custom IUserProfileService i only see 5 claims.

image

Thanks in advance for your inputs :)

kenneth-y avatar Apr 27 '17 04:04 kenneth-y

@leastprivilege i managed to retrieve the claims in my custom IProfileService. I added the role claims inside ExternalLoginCallback() action of the AccountController.

image

pls let me know your thoughts if its the correct way of doing it. :)

kenneth-y avatar Apr 28 '17 06:04 kenneth-y

looks good.

leastprivilege avatar Apr 28 '17 21:04 leastprivilege

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 14 '20 18:01 lock[bot]