Exemple #1
0
        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]);
            }
        }
Exemple #2
0
        /// <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)));
        }
Exemple #3
0
 public void Then_CannAddAnotherCustomAuthorizationProvider()
 {
     authUsingCustom.AuthorizeUsingCustomProviderNamed <CustomAuthorizationProvider>("another");
     Assert.AreEqual(2, AuthorizationProviders.Count());
 }
Exemple #4
0
        public void Then_CustomAuthorizationProviderDataHasAppropriateType()
        {
            var customAuthZProvider = AuthorizationProviders.OfType <CustomAuthorizationProviderData>().First();

            Assert.AreEqual(typeof(CustomAuthorizationProvider), customAuthZProvider.Type);
        }
Exemple #5
0
        public void Then_CustomAuthorizationProviderDataHasAppropriateName()
        {
            var customAuthZProvider = AuthorizationProviders.OfType <CustomAuthorizationProviderData>().First();

            Assert.AreEqual("custom provider", customAuthZProvider.Name);
        }
Exemple #6
0
 public void Then_CustomAuthorizationProviderDataIsAddedToSecurityConfiguration()
 {
     Assert.AreEqual(1, AuthorizationProviders.OfType <CustomAuthorizationProviderData>().Count());
 }