Skip to content

Instantly share code, notes, and snippets.

@davidknipe
Created February 15, 2015 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidknipe/9aaddbc39fd5c3260f85 to your computer and use it in GitHub Desktop.
Save davidknipe/9aaddbc39fd5c3260f85 to your computer and use it in GitHub Desktop.
Custom SynchronizingUserService implementation for Auth0 when using EPiServer
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