private async Task <bool> HasAccess(TRequest message) { var requestAuthorizationAttribute = requestAuthorizationAttributeCache.Get(message.GetType()); if (requestAuthorizationAttribute == null) { return(true); } var context = new AuthorizationContext(userContext.Principal, requestAuthorizationAttribute.Name); return(await authorizationManager.CheckAccessAsync(context).ConfigureAwait(true)); }
public async Task <bool> AuthorizeActivity(Type requestType) { var attribute = attributeCache.Get(requestType); if (attribute != null) { var activity = attribute.Name; return(await AuthorizeActivity(activity)); } else { return(true); } }