Skip to content

Instantly share code, notes, and snippets.

@arnabdas
Last active April 24, 2018 11:21
Show Gist options
  • Save arnabdas/ee66d59e3a6c7f0603b31816a9a21d55 to your computer and use it in GitHub Desktop.
Save arnabdas/ee66d59e3a6c7f0603b31816a9a21d55 to your computer and use it in GitHub Desktop.
Print claims
public class CustomAuthorizeAttribute : AuthorizeAttribute
{
protected override bool IsAuthorized(HttpActionContext actionContext)
{
var principal = actionContext.RequestContext.Principal as ClaimsPrincipal;
System.Text.StringBuilder s = new System.Text.StringBuilder();
s.AppendLine("Type,Value,ValueType");
principal.Claims.ToList().ForEach(c => s.AppendLine($"{c.Type},{c.Value},{c.ValueType}"));
System.Diagnostics.Debug.WriteLine(s.ToString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment