Xamarin Public Jenkins (auto-signing) e79aa3c0ed Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
2016-08-03 10:59:49 +00:00

59 lines
1.8 KiB
C#

//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.IdentityModel.Tokens
{
using System.IdentityModel.Claims;
using System.IdentityModel.Policy;
using SysClaim = System.IdentityModel.Claims.Claim;
/// <summary>
/// This class serves as a dummy AuthorizationPolicy on an issued token so that when
/// WCF renews a token it can match the identity of the issuer with the renewer. This is
/// required as in the IDFX layer we throw the WCF generated AuthorizationPolicy ( UnconditionalPolicy )
/// </summary>
internal class SctAuthorizationPolicy : IAuthorizationPolicy
{
ClaimSet _issuer;
string _id = UniqueId.CreateUniqueId();
internal SctAuthorizationPolicy( SysClaim claim )
{
_issuer = new DefaultClaimSet( claim );
}
#region IAuthorizationPolicy Members
bool IAuthorizationPolicy.Evaluate( EvaluationContext evaluationContext, ref object state )
{
if ( evaluationContext == null )
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "evaluationContext" );
}
evaluationContext.AddClaimSet( this, _issuer );
return true;
}
ClaimSet IAuthorizationPolicy.Issuer
{
get
{
return _issuer;
}
}
#endregion
#region IAuthorizationComponent Members
string IAuthorizationComponent.Id
{
get
{
return _id;
}
}
#endregion
}
}