-
-
Save CoderBK/2ac36078f3b14bfaf821bf3cda53173d to your computer and use it in GitHub Desktop.
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
/// <summary> | |
/// Use Attribute which will help to check token | |
/// </summary> | |
/// <param name="req"></param> | |
/// <param name="log"></param> | |
/// <returns></returns> | |
[FunctionName(nameof(HttpTriggerFunction.TestAuthorization))] | |
public IActionResult TestAuthorization( | |
[HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req, | |
ILogger log, | |
[JWTAuthorization()] JWTClaim jwtClaim) { | |
log.LogInformation("C# HTTP trigger function processed a request."); | |
// Check token is valid or not | |
if (jwtClaim == null) | |
{ | |
return new UnauthorizedObjectResult("Invalid token"); | |
} | |
return new OkObjectResult("Valid Token"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment