Beispiel #1
0
        public override bool Equals(object obj)
        {
            if (obj != null)
            {
                if (obj.GetType() == this.GetType())
                {
                    CardspacePolicyInfo policyToCompare = (CardspacePolicyInfo)obj;
                    bool includesAllClaims = true;
                    foreach (string claim in policyToCompare.RequiredClaims)
                    {
                        if (!this.RequiredClaims.Contains(claim))
                        {
                            includesAllClaims = false;
                        }
                    }

                    return(policyToCompare.IdentityProvider == this.IdentityProvider &&
                           policyToCompare.RelyingParty == this.RelyingParty &&
                           policyToCompare.Certificate == this.Certificate &&
                           includesAllClaims);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
 public override bool Equals(object obj)
 {
     if (obj != null)
     {
         if (obj.GetType() == this.GetType())
         {
             CardspacePolicyInfo policyToCompare = (CardspacePolicyInfo)obj;
             return(policyToCompare.IdentityProvider == this.IdentityProvider &&
                    policyToCompare.RelyingParty == this.RelyingParty &&
                    policyToCompare.Certificate == this.Certificate);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Beispiel #3
0
        //-----------------------------------------

        //-----------------------------------------
        // Constructors
        //-----------------------------------------
        protected override SecurityToken GetInfoCardSecurityToken(bool requiresInfoCard, System.IdentityModel.Selectors.CardSpacePolicyElement[] chain, System.IdentityModel.Selectors.SecurityTokenSerializer tokenSerializer)
        {
            CardspacePolicyInfo policyInfo    = new CardspacePolicyInfo(chain);
            TimeZone            localTimeZone = TimeZone.CurrentTimeZone;

            if (    //Does the cache contain a token with the specified policy info?
                _cachedInformationCardTokens.ContainsKey(policyInfo) &&
                //Is the token is still valid?
                localTimeZone.ToLocalTime(_cachedInformationCardTokens[policyInfo].ValidFrom) < DateTime.Now &&
                localTimeZone.ToLocalTime(_cachedInformationCardTokens[policyInfo].ValidTo) > DateTime.Now
                )
            {
                return(CachedInformationCardTokens[policyInfo]);
            }
            else
            {
                lock (CachedInformationCardTokens)
                {
                    SecurityToken newInformationCardToken = base.GetInfoCardSecurityToken(requiresInfoCard, chain, tokenSerializer);
                    CachedInformationCardTokens.Add(policyInfo, newInformationCardToken);
                    return(newInformationCardToken);
                }
            }
        }