Example #1
0
 public bool CheckAuthorisation(JwtSecurityToken token, ActivityHandlerAttribute attribute)
 {
     if (!_requiresAuthorisation || attribute.SkipAuthorisation)
     {
         return(true);
     }
     if (token == null)
     {
         return(false);
     }
     string[] usersRoles = token.Claims.Where(c => c.Type == "role").Select(c => c.Value).ToArray();
     return(ActivityRoles.ContainsKey(attribute.ActivityName) &&
            ActivityRoles[attribute.ActivityName].Any(usersRoles.Contains));
 }
Example #2
0
 public bool CheckAuthorisation(JwtSecurityToken token, ActivityHandlerAttribute attribute)
 {
     throw new InvalidOperationException("Authorisation checking is performed by ASP.NET Core.");
 }