示例#1
0
        public virtual async Task AuthorizeAsync(CancellationToken cancellationToken)
        {
            var authorizationAttributes = _apiActionAuthorizationProvider.Get(GetType());

            if (authorizationAttributes == null || authorizationAttributes.Length == 0)
            {
                return;
            }

            var results = await Task.WhenAll(authorizationAttributes.Select(a =>
                                                                            a.AuthorizeAsync(_httpContext, AbstractModel, cancellationToken)));

            ActionResponse = ActionResponse ?? results.FirstOrDefault(r => r != null);
        }
示例#2
0
 // ReSharper disable once MemberCanBePrivate.Global
 protected ApiActionResponse Response(ApiActionResponse response)
 {
     ActionResponse = response;
     return(response);
 }