本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例6: Evaluate
public bool Evaluate(EvaluationContext evaluationContext, ref object state)
{
evaluationContext.AddClaimSet(this, issuance);
evaluationContext.RecordExpirationTime(DateTime.UtcNow.AddDays(1.0));
return true;
}
示例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;
}
示例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