Beispiel #1
0
 /// <summary>
 /// Processes an <see cref="AuthorizeActorResult"/> for an <see cref="ISecurityActor"> Actor</see>, adding it to the AuthorizationFailures collection if appropriate.
 /// </summary>
 /// <param name="authorizeActorResult">Result to process.</param>
 public void ProcessAuthorizeActorResult(AuthorizeActorResult authorizeActorResult)
 {
     if (!authorizeActorResult.IsAuthorized)
     {
         _authorizationFailures.Add(authorizeActorResult);
     }
 }
        public AuthorizeActorResult IsAuthorized(object actionToAuthorize)
        {
            var result = new AuthorizeActorResult(this);

            foreach (var rule in _rules)
            {
                try
                {
                    if (!rule.IsAuthorized(actionToAuthorize))
                    {
                        result.AddBrokenRule(rule);
                    }
                }
                catch (Exception ex)
                {
                    result.AddErrorRule(rule, ex);
                }
            }
            return(result);
        }