コード例 #1
0
 /// <summary>
 /// Processes instance of an <see cref="AuthorizeDescriptorResult"/>, adding failed authorizations to the AuthorizationFailures collection
 /// </summary>
 /// <param name="result">Result to process</param>
 public void ProcessAuthorizeDescriptorResult(AuthorizeDescriptorResult result)
 {
     if (!result.IsAuthorized)
     {
         _authorizationFailures.Add(result);
     }
 }
コード例 #2
0
        public AuthorizeDescriptorResult Authorize(object instanceToAuthorize)
        {
            var result = new AuthorizeDescriptorResult();

            foreach (var action in Actions.Where(a => a.CanAuthorize(instanceToAuthorize)))
            {
                result.ProcessAuthorizeActionResult(action.Authorize(instanceToAuthorize));
            }
            return(result);
        }