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)); }
public bool CheckAuthorisation(JwtSecurityToken token, ActivityHandlerAttribute attribute) { throw new InvalidOperationException("Authorisation checking is performed by ASP.NET Core."); }