コード例 #1
0
        /// <summary>
        /// Called to retrieve all tokens that match a particular contextId. WCF will call this
        /// </summary>
        /// <param name="contextId"></param>
        /// <returns></returns>
        public Collection <SecurityContextSecurityToken> GetAllContexts(System.Xml.UniqueId contextId)
        {
            Collection <SecurityContextSecurityToken> tokens = new Collection <SecurityContextSecurityToken>();

            IEnumerable <SessionSecurityToken> cachedTokens = _tokenCache.GetAll(_claimsHandler.EndpointId, contextId);

            if (cachedTokens != null)
            {
                foreach (SessionSecurityToken sessionSct in cachedTokens)
                {
                    if (sessionSct != null && sessionSct.IsSecurityContextSecurityTokenWrapper)
                    {
                        SecurityContextSecurityToken sctToken = SecurityContextSecurityTokenHelper.ConvertSessionTokenToSecurityContextSecurityToken(sessionSct);
                        tokens.Add(sctToken);
                    }
                }
            }

            return(tokens);
        }
コード例 #2
0
 public IEnumerable <SessionSecurityToken> GetAll(string endpointId, string contextId)
 {
     // Delegates to the default, in-memory MruSessionSecurityTokenCache employed by WIF
     return(internalCache.GetAll(endpointId, GetContextId(contextId)));
 }