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

82 lines
2.4 KiB
C#

//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.IdentityModel.Tokens
{
using System.IdentityModel.Claims;
using System.IdentityModel.Policy;
/// <summary>
/// Implementation of IAuthorizationPolicy that contains endpoint specific
/// AuthorizationPolicy.
/// </summary>
internal class EndpointAuthorizationPolicy : IAuthorizationPolicy
{
string _endpointId;
string _id = UniqueId.CreateUniqueId();
/// <summary>
/// Creates an instance of <see cref="EndpointAuthorizationPolicy"/>
/// </summary>
/// <param name="endpointId">Identifier of the Endpoint to which the token should be restricted.</param>
public EndpointAuthorizationPolicy( string endpointId )
{
if ( endpointId == null )
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull( "endpointId" );
}
_endpointId = endpointId;
}
/// <summary>
/// Gets the EndpointId for the AuthorizationPolicy
/// </summary>
public string EndpointId
{
get { return _endpointId; }
}
#region IAuthorizationPolicy Members
/// <summary>
/// Check if the claims in the EvaluationContext.
/// </summary>
/// <param name="evaluationContext">The current evaluationContext</param>
/// <param name="state">Any custom state.</param>
/// <returns>Returns true by default.</returns>
bool IAuthorizationPolicy.Evaluate( EvaluationContext evaluationContext, ref object state )
{
return true;
}
/// <summary>
/// Gets the Issuer ClaimSet. Returns null by default.
/// </summary>
ClaimSet IAuthorizationPolicy.Issuer
{
get
{
return null;
}
}
#endregion
#region IAuthorizationComponent Members
/// <summary>
/// Gets the Id.
/// </summary>
string IAuthorizationComponent.Id
{
get
{
return _id;
}
}
#endregion
}
}