當前位置: 首頁>>代碼示例>>C#>>正文


C# EvaluationContext.RecordExpirationTime方法代碼示例

本文整理匯總了C#中System.IdentityModel.Policy.EvaluationContext.RecordExpirationTime方法的典型用法代碼示例。如果您正苦於以下問題:C# EvaluationContext.RecordExpirationTime方法的具體用法?C# EvaluationContext.RecordExpirationTime怎麽用?C# EvaluationContext.RecordExpirationTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.IdentityModel.Policy.EvaluationContext的用法示例。


在下文中一共展示了EvaluationContext.RecordExpirationTime方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Evaluate

		// 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;
		}
開發者ID:nlhepler,項目名稱:mono,代碼行數:23,代碼來源:SystemIdentityAuthorizationPolicy.cs

示例2: Evaluate

        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;
        }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:43,代碼來源:UnconditionalPolicy.cs

示例3: Evaluate

			public bool Evaluate (EvaluationContext ec, ref Object state)
			{
				ec.AddClaimSet (this, new DefaultClaimSet (Claim.CreateRsaClaim (rsa)));
				ec.RecordExpirationTime (DateTime.MaxValue.AddDays (-1));
				return true;
			}
開發者ID:nlhepler,項目名稱:mono,代碼行數:6,代碼來源:RsaSecurityTokenAuthenticator.cs

示例4: Evaluate

            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;
            }
開發者ID:krytht,項目名稱:DotNetReferenceSource,代碼行數:27,代碼來源:SecurityContextCookieSerializer.cs

示例5: Evaluate

 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;
 }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:25,代碼來源:SerializableAuthorizationContext.cs

示例6: Evaluate

 public bool Evaluate(EvaluationContext evaluationContext, ref object state)
 {
     evaluationContext.AddClaimSet(this, issuance);
     evaluationContext.RecordExpirationTime(DateTime.UtcNow.AddDays(1.0));
     return true;
 }
開發者ID:svn2github,項目名稱:ehi,代碼行數:6,代碼來源:DummyAuthorizationPolicy.cs

示例7: Evaluate

        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;
        }
開發者ID:spzenk,項目名稱:sfdocsamples,代碼行數:26,代碼來源:MyTokenAuthenticator.cs

示例8: Evaluate

 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;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:25,代碼來源:SecurityContextCookieSerializer.cs


注:本文中的System.IdentityModel.Policy.EvaluationContext.RecordExpirationTime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。