public void Then_CustomAuthorizationProviderDataHasAppropriateAttributes() { var customAuthZProvider = AuthorizationProviders.OfType <CustomAuthorizationProviderData>().First(); Assert.AreEqual(attributes.Count, customAuthZProvider.Attributes.Count); foreach (string key in attributes) { Assert.AreEqual(attributes[key], customAuthZProvider.Attributes[key]); } }
/// <summary> /// /// </summary> /// <returns></returns> public IEnumerable <TypeRegistration> GetRegistrations(IConfigurationSource configurationSource) { var defaultLoggerRegistrations = GetDefaultSecurityEventLoggerRegistrations(configurationSource); var authorizationProviderRegistrations = AuthorizationProviders.SelectMany(azp => azp.GetRegistrations(configurationSource)); authorizationProviderRegistrations = SetDefaultAuthorizationProvider(authorizationProviderRegistrations); var securityCacheProviderRegistrations = SecurityCacheProviders.SelectMany(scp => scp.GetRegistrations(configurationSource)); securityCacheProviderRegistrations = SetDefaultSecurityCacheProvider(securityCacheProviderRegistrations); return(defaultLoggerRegistrations .Concat(authorizationProviderRegistrations) .Concat(securityCacheProviderRegistrations) .Select(r => MarkAsPublicName <IAuthorizationProvider>(r)) .Select(r => MarkAsPublicName <ISecurityCacheProvider>(r))); }
public void Then_CannAddAnotherCustomAuthorizationProvider() { authUsingCustom.AuthorizeUsingCustomProviderNamed <CustomAuthorizationProvider>("another"); Assert.AreEqual(2, AuthorizationProviders.Count()); }
public void Then_CustomAuthorizationProviderDataHasAppropriateType() { var customAuthZProvider = AuthorizationProviders.OfType <CustomAuthorizationProviderData>().First(); Assert.AreEqual(typeof(CustomAuthorizationProvider), customAuthZProvider.Type); }
public void Then_CustomAuthorizationProviderDataHasAppropriateName() { var customAuthZProvider = AuthorizationProviders.OfType <CustomAuthorizationProviderData>().First(); Assert.AreEqual("custom provider", customAuthZProvider.Name); }
public void Then_CustomAuthorizationProviderDataIsAddedToSecurityConfiguration() { Assert.AreEqual(1, AuthorizationProviders.OfType <CustomAuthorizationProviderData>().Count()); }