Created
February 15, 2015 21:23
-
-
Save davidknipe/9aaddbc39fd5c3260f85 to your computer and use it in GitHub Desktop.
Custom SynchronizingUserService implementation for Auth0 when using EPiServer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Auth0SynchronizingUserService : SynchronizingUserService | |
{ | |
public override Task SynchronizeAsync(ClaimsIdentity identity) | |
{ | |
//Transform the passed http:/schemas.auth0.com/roles claims to System.Security.Claims | |
foreach (var claim in identity.Claims) | |
{ | |
if (claim.Type == "http://schemas.auth0.com/roles") | |
{ | |
identity.AddClaim(new Claim(ClaimTypes.Role, claim.Value)); | |
} | |
} | |
return base.SynchronizeAsync(identity); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment