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