Beispiel #1
0
        public static RoleBasedAuthorizationSetting GetRoleBaseAuthorizationSetting(this ServiceConfiguration self)
        {
            var fullName = self.FullName;
            RoleBasedAuthorizationSetting result = null;

            if (configurationPool.TryGetValue(fullName, out result))
            {
                return(result);
            }

            if (self.Raw.ContainsKey("roleBasedAuthorization"))
            {
                result = self.Raw["roleBasedAuthorization"].ToObject <RoleBasedAuthorizationSetting>();
            }
            else
            {
                result = new RoleBasedAuthorizationSetting(Enumerable.Empty <string>());
            }

            configurationPool.AddOrUpdate(fullName, result, (k, old) => result);
            return(result);
        }
Beispiel #2
0
        public static bool IsIgnoreUrl(this RoleBasedAuthorizationSetting self, string url)
        {
            var target = url ?? "";

            return(self.IgnoreUrls.Any(ig => url.StartsWith(ig, true, null)));
        }