public AuthorizationModel Get(AuthorizationRequestModel request) { var rules = new Cache <string, AuthorizationRuleModel>(r => new AuthorizationRuleModel(r)); _behaviorGraph .Behaviors .Each(chain => { var authorizor = _authorizationDescriptor.AuthorizorFor(chain); authorizor .RulesDescriptions() .Each(r => rules[r].AddRoute(new AuthorizedRouteModel(chain.UniqueId, chain.Route == null ? "(no route)" : chain.Route.Pattern))); }); return(new AuthorizationModel { Rules = rules }); }
public override string ValueFor(BehaviorChain chain) { var rules = _descriptor.AuthorizorFor(chain).RulesDescriptions(); return(rules.Any() ? rules.Join(", ") : "None"); }