Ejemplo n.º 1
0
 //public override bool TryAddEntry(object key, SecurityToken value)
 public override void AddOrUpdate(SessionSecurityTokenCacheKey key, SessionSecurityToken value, DateTime expiryTime)
 {
     Log.DebugFormat("Key: {0} Value: {1} Expiry: {2}", key, value.Id, expiryTime);
     Log.DebugFormat("Adding or updating in memory cache");
     m_MemoryCache.AddOrUpdate(key, value, expiryTime);
     Log.DebugFormat("Adding or updating in persistent store");
     m_SessionSecurityTokenStore.UpdateTokenInStore(key, value, expiryTime);
 }
Ejemplo n.º 2
0
        public void AddContext(SecurityContextSecurityToken token)
        {
            //
            // WCF will cache the token first before calling the WrappedSessionSecurityTokenHandler.OnTokenIssued.
            // We need to map the claims here so we will be caching the correct token with Geneva Claims substitued
            // in place of the WCF claims.
            //
            _claimsHandler.SetPrincipalBootstrapTokensAndBindIdfxAuthPolicy(token);

            SessionSecurityTokenCacheKey key          = new SessionSecurityTokenCacheKey(_claimsHandler.EndpointId, token.ContextId, token.KeyGeneration);
            SessionSecurityToken         sessionToken = SecurityContextSecurityTokenHelper.ConvertSctToSessionToken(token, SecureConversationVersion.Default);
            DateTime expiryTime = DateTimeUtil.Add(sessionToken.ValidTo, _claimsHandler.SecurityTokenHandlerCollection.Configuration.MaxClockSkew);

            _tokenCache.AddOrUpdate(key, sessionToken, expiryTime);
        }
Ejemplo n.º 3
0
 public void AddOrUpdate(string endpointId, string contextId, string keyGeneration, SessionSecurityToken value, DateTime expiryTime)
 {
     internalCache.AddOrUpdate(
         new SessionSecurityTokenCacheKey(endpointId, GetContextId(contextId), GetKeyGeneration(keyGeneration)),
         value,
         expiryTime);
 }
        public override void AddOrUpdate(SessionSecurityTokenCacheKey key, SessionSecurityToken value, DateTime expiryTime)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            inner.AddOrUpdate(key, value, expiryTime);
            var item = new TokenCacheItem
            {
                Key     = key.ToString(),
                Expires = expiryTime,
                Token   = TokenToBytes(value),
            };

            tokenCacheRepository.AddOrUpdate(item);
        }