public void InMemorySaveWithNullIdentityTestFixture()
        {
            ISecurityCacheProvider securityCache = SecurityCacheFactory.GetSecurityCacheProvider();
            IToken token = securityCache.SaveIdentity(null);

            if (token != null)
            {
                Assert.Fail();
            }
        }
        public void SaveIdentityWithDefaultExpiration()
        {
            ISecurityCacheProvider securityCache = SecurityCacheFactory.GetSecurityCacheProvider();

            Assert.IsNotNull(securityCache);

            IToken token = securityCache.SaveIdentity(identity);

            Assert.IsNotNull(token);
            Assert.IsNotNull(token.Value);
        }
Exemple #3
0
        public void SavePrincipalWithTokenFromPreviouslyCachedItem()
        {
            ISecurityCacheProvider securityCache = SecurityCacheFactory.GetSecurityCacheProvider(defaultInstance);

            Assert.IsNotNull(securityCache);

            IIdentity identity = new GenericIdentity("zman", "testauthtype");

            IToken token = securityCache.SaveIdentity(identity);

            Assert.IsNotNull(token);
            Assert.IsNotNull(token.Value);

            securityCache.SavePrincipal(principal, token);
        }
        public void RetreiveCachedIdentity()
        {
            ISecurityCacheProvider securityCache = SecurityCacheFactory.GetSecurityCacheProvider();

            Assert.IsNotNull(securityCache);

            IToken token = securityCache.SaveIdentity(identity);

            Assert.IsNotNull(token);
            Assert.IsNotNull(token.Value);

            IIdentity cachedIdentity = securityCache.GetIdentity(token);

            Assert.IsNotNull(cachedIdentity);
            Assert.AreEqual(cachedIdentity.Name, "zman");
        }
        public void ExplicitlyExpireIdentity()
        {
            ISecurityCacheProvider securityCache = SecurityCacheFactory.GetSecurityCacheProvider();

            Assert.IsNotNull(securityCache);

            IToken token = securityCache.SaveIdentity(identity);

            Assert.IsNotNull(token);
            Assert.IsNotNull(token.Value);

            securityCache.ExpireIdentity(token);

            IIdentity cachedIdentity = securityCache.GetIdentity(token);

            Assert.IsNull(cachedIdentity);
        }
Exemple #6
0
        public void SaveProfileWithTokenFromPreviouslyCachedItem()
        {
            ISecurityCacheProvider securityCache = SecurityCacheFactory.GetSecurityCacheProvider(defaultInstance);

            Assert.IsNotNull(securityCache);

            IIdentity identity = new GenericIdentity("zman", "testauthtype");

            IToken token = securityCache.SaveIdentity(identity);

            Assert.IsNotNull(token);

            securityCache.SaveProfile(profile, token);
            Assert.IsNotNull(token);
            Assert.IsNotNull(token.Value);

            object tmpProfile = securityCache.GetProfile(token);

            Assert.IsNotNull(tmpProfile);
            Assert.AreEqual(tmpProfile.ToString(), "testprofile");
        }
        public void SaveIdentityWithTokenFromPreviousCachedItem()
        {
            ISecurityCacheProvider securityCache = SecurityCacheFactory.GetSecurityCacheProvider();

            Assert.IsNotNull(securityCache);

            string[]   roles     = new string[] { "admin", "manager" };
            IPrincipal principal = new GenericPrincipal(identity, roles);

            IToken token = securityCache.SavePrincipal(principal);

            Assert.IsNotNull(token);

            securityCache.SaveIdentity(identity, token);
            Assert.IsNotNull(token);
            Assert.IsNotNull(token.Value);

            IIdentity cachedIdentity = securityCache.GetIdentity(token);

            Assert.IsNotNull(cachedIdentity);
            Assert.AreEqual(cachedIdentity.Name, "zman");
        }