public virtual bool Evaluate(EvaluationContext evaluationContext, ref object state)
        {
            ThrowIfDisposed();
            if (_issuance != null)
            {
                evaluationContext.AddClaimSet(this, _issuance);
            }
            else
            {
                for (int i = 0; i < _issuances.Count; ++i)
                {
                    if (_issuances[i] != null)
                    {
                        evaluationContext.AddClaimSet(this, _issuances[i]);
                    }
                }
            }

            // Preferably Non-Anonymous
            if (this.PrimaryIdentity != null && this.PrimaryIdentity != SecurityUtils.AnonymousIdentity)
            {
                IList <IIdentity> identities;
                object            obj;
                if (!evaluationContext.Properties.TryGetValue(SecurityUtils.Identities, out obj))
                {
                    identities = new List <IIdentity>(1);
                    evaluationContext.Properties.Add(SecurityUtils.Identities, identities);
                }
                else
                {
                    // null if other overrides the property with something else
                    identities = obj as IList <IIdentity>;
                }

                if (identities != null)
                {
                    identities.Add(this.PrimaryIdentity);
                }
            }

            evaluationContext.RecordExpirationTime(_expirationTime);
            return(true);
        }
		// This method is expected to be thread safe
		public bool Evaluate (EvaluationContext ec, ref object state)
		{
			lock (ec) {
				ec.AddClaimSet (this, CreateClaims ());
				List<IIdentity> list;
				if (!ec.Properties.ContainsKey ("Identities")) {
					list = new List<IIdentity> ();
					ec.Properties ["Identities"] = list;
				} else {
					IList<IIdentity> ilist = (IList<IIdentity>) ec.Properties ["Identities"];
					list = ilist as List<IIdentity>;
					if (list == null) {
						list = new List<IIdentity> (ilist);
						ec.Properties ["Identities"] = list;
					}
				}
				list.Add (CreateIdentity ());
				ec.RecordExpirationTime (ExpirationTime);
			}
			// FIXME: is it correct that this should always return true?
			return true;
		}
 public virtual bool Evaluate(EvaluationContext evaluationContext, ref object state)
 {
     this.ThrowIfDisposed();
     if (this.issuance != null)
     {
         evaluationContext.AddClaimSet(this, this.issuance);
     }
     else
     {
         for (int i = 0; i < this.issuances.Count; i++)
         {
             if (this.issuances[i] != null)
             {
                 evaluationContext.AddClaimSet(this, this.issuances[i]);
             }
         }
     }
     if ((this.PrimaryIdentity != null) && (this.PrimaryIdentity != System.IdentityModel.SecurityUtils.AnonymousIdentity))
     {
         IList <IIdentity> list;
         object            obj2;
         if (!evaluationContext.Properties.TryGetValue("Identities", out obj2))
         {
             list = new List <IIdentity>(1);
             evaluationContext.Properties.Add("Identities", list);
         }
         else
         {
             list = obj2 as IList <IIdentity>;
         }
         if (list != null)
         {
             list.Add(this.PrimaryIdentity);
         }
     }
     evaluationContext.RecordExpirationTime(this.expirationTime);
     return(true);
 }
        public virtual bool Evaluate(EvaluationContext evaluationContext, ref object state)
        {
            ThrowIfDisposed();
            if (this.issuance != null)
            {
                evaluationContext.AddClaimSet(this, this.issuance);
            }
            else
            {
                for (int i = 0; i < this.issuances.Count; ++i)
                {
                    if (this.issuances[i] != null)
                    {
                        evaluationContext.AddClaimSet(this, this.issuances[i]);
                    }
                }
            }

            // Preferably Non-Anonymous
            if (this.PrimaryIdentity != null && this.PrimaryIdentity != SecurityUtils.AnonymousIdentity)
            {
                IList<IIdentity> identities;
                object obj;
                if (!evaluationContext.Properties.TryGetValue(SecurityUtils.Identities, out obj))
                {
                    identities = new List<IIdentity>(1);
                    evaluationContext.Properties.Add(SecurityUtils.Identities, identities);
                }
                else
                {
                    // null if other overrides the property with something else
                    identities = obj as IList<IIdentity>;
                }

                if (identities != null)
                {
                    identities.Add(this.PrimaryIdentity);
                }
            }

            evaluationContext.RecordExpirationTime(this.expirationTime);
            return true;
        }
			public bool Evaluate (EvaluationContext ec, ref Object state)
			{
				ec.AddClaimSet (this, new DefaultClaimSet (Claim.CreateRsaClaim (rsa)));
				ec.RecordExpirationTime (DateTime.MaxValue.AddDays (-1));
				return true;
			}
            public bool Evaluate(EvaluationContext evaluationContext, ref object state)
            {
                for (int i = 0; i < this.claimSets.Count; ++i)
                {
                    evaluationContext.AddClaimSet(this, this.claimSets[i]);
                }

                if (this.identities != null)
                {
                    object obj;
                    if (!evaluationContext.Properties.TryGetValue(SecurityUtils.Identities, out obj))
                    {
                        evaluationContext.Properties.Add(SecurityUtils.Identities, this.identities);
                    }
                    else
                    {
                        // null if other overrides the property with something else
                        List<IIdentity> dstIdentities = obj as List<IIdentity>;
                        if (dstIdentities != null)
                        {
                            dstIdentities.AddRange(this.identities);
                        }
                    }
                }
                evaluationContext.RecordExpirationTime(this.expirationTime);
                return true;
            }
 public bool Evaluate(EvaluationContext evaluationContext, ref object state)
 {
     for (int num1 = 0; num1 < this.claimSets.Count; num1++)
     {
         evaluationContext.AddClaimSet(this, this.claimSets[num1]);
     }
     if (this.identities != null)
     {
         object obj;
         if (!evaluationContext.Properties.TryGetValue("Identities", out obj))
         {
             evaluationContext.Properties.Add("Identities", (object)this.identities);
         }
         else
         {
             List<IIdentity> identities = obj as List<IIdentity>;
             if (identities != null)
             {
                 identities.AddRange(this.identities);
             }
         }
     }
     evaluationContext.RecordExpirationTime(this.expirationTime);
     return true;
 }
 public bool Evaluate(EvaluationContext evaluationContext, ref object state)
 {
     evaluationContext.AddClaimSet(this, issuance);
     evaluationContext.RecordExpirationTime(DateTime.UtcNow.AddDays(1.0));
     return true;
 }
        public bool Evaluate(EvaluationContext evaluationContext, ref object state)
        {
            evaluationContext.AddClaimSet(this, this.issuance);

            if (this.identities != null)
            {
                object value;
                IList<IIdentity> contextIdentities;
                if (!evaluationContext.Properties.TryGetValue("Identities", out value))
                {
                    contextIdentities = new List<IIdentity>(this.identities.Count);
                    evaluationContext.Properties.Add("Identities", contextIdentities);
                }
                else
                {
                    contextIdentities = value as IList<IIdentity>;
                }
                foreach (IIdentity identity in this.identities)
                {
                    contextIdentities.Add(identity);
                }
            }

            evaluationContext.RecordExpirationTime(this.expirationTime);
            return true;
        }
 public bool Evaluate(EvaluationContext evaluationContext, ref object state)
 {
     for (int i = 0; i < this.claimSets.Count; i++)
     {
         evaluationContext.AddClaimSet(this, this.claimSets[i]);
     }
     if (this.identities != null)
     {
         object obj2;
         if (!evaluationContext.Properties.TryGetValue("Identities", out obj2))
         {
             evaluationContext.Properties.Add("Identities", this.identities);
         }
         else
         {
             List<IIdentity> list = obj2 as List<IIdentity>;
             if (list != null)
             {
                 list.AddRange(this.identities);
             }
         }
     }
     evaluationContext.RecordExpirationTime(this.expirationTime);
     return true;
 }