How to get Claims Principal in Azure Function running Node?

289 views Asked by At

I found an example of getting Claims Principal in C# Azure Function:

public static class SampleFunction
{
    [FunctionName("Sample")]
    public static async Task<IActionResult> Run(
        [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "sample")] HttpRequest req,
        ILogger log, 
        ClaimsPrincipal principal) // <=here
    {
        var roles = principal.Claims.Where(e => e.Type == "roles").Select(e => e.Value);
        ...
    }
}

How do I get the same principal in a NodeJS Azure Function?

0

There are 0 answers