AuthorizationContext 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
보낸 메시지의 토큰에서 사용 가능한 모든 권한 부여 정책을 평가하고 메서드를 GetAuthorizationPolicies(OperationContext) 호출한 결과입니다.
public ref class AuthorizationContext abstract : System::IdentityModel::Policy::IAuthorizationComponent
public abstract class AuthorizationContext : System.IdentityModel.Policy.IAuthorizationComponent
type AuthorizationContext = class
interface IAuthorizationComponent
Public MustInherit Class AuthorizationContext
Implements IAuthorizationComponent
- 상속
-
AuthorizationContext
- 구현
예제
protected override bool CheckAccessCore(OperationContext operationContext)
{
// Extract the action URI from the OperationContext. Match this against the claims
// in the AuthorizationContext.
string action = operationContext.RequestContext.RequestMessage.Headers.Action;
Console.WriteLine("action: {0}", action);
// Iterate through the various claim sets in the AuthorizationContext.
foreach (ClaimSet cs in operationContext.ServiceSecurityContext.AuthorizationContext.ClaimSets)
{
// Examine only those claim sets issued by System.
if (cs.Issuer == ClaimSet.System)
{
// Iterate through claims of type "http://example.org/claims/allowedoperation".
foreach (Claim c in cs.FindClaims("http://example.org/claims/allowedoperation", Rights.PossessProperty))
{
// Write the Claim resource to the console.
Console.WriteLine("resource: {0}", c.Resource.ToString());
// If the Claim resource matches the action URI then return true to allow access.
if (action == c.Resource.ToString())
return true;
}
}
}
// If this point is reached, return false to deny access.
return false;
}
Protected Overrides Function CheckAccessCore(ByVal operationContext As OperationContext) As Boolean
' Extract the action URI from the OperationContext. Match this against the claims
' in the AuthorizationContext.
Dim action As String = operationContext.RequestContext.RequestMessage.Headers.Action
Console.WriteLine("action: {0}", action)
' Iterate through the various claim sets in the AuthorizationContext.
Dim cs As ClaimSet
For Each cs In operationContext.ServiceSecurityContext.AuthorizationContext.ClaimSets
' Examine only those claim sets issued by System.
If cs.Issuer Is ClaimSet.System Then
' Iterate through claims of type "http://example.org/claims/allowedoperation".
Dim c As Claim
For Each c In cs.FindClaims("http://example.org/claims/allowedoperation", Rights.PossessProperty)
' Write the Claim resource to the console.
Console.WriteLine("resource: {0}", c.Resource.ToString())
' If the Claim resource matches the action URI then return true to allow access.
If action = c.Resource.ToString() Then
Return True
End If
Next c
End If
Next cs
' If we get here, return false, denying access.
Return False
End Function
설명
권한 부여 관리자에서 모든 권한 부여 정책을 평가하면 개체 집합 ClaimSet 이 생성됩니다. 이러한 개체는 권한 부여 컨텍스트를 구성합니다.
권한 부여 컨텍스트에는 클레임 집합 개체 집합, 권한 부여 컨텍스트가 유효한 시간 범위를 지정하는 만료 시간 및 고유 식별자가 포함됩니다.
AuthorizationContext 현재 작업에 대 한 속성을 통해 AuthorizationContext 액세스할 수 있습니다.
생성자
| Name | Description |
|---|---|
| AuthorizationContext() |
AuthorizationContext 클래스의 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| ClaimSets |
권한 부여 정책과 연결된 클레임 집합을 가져옵니다. |
| ExpirationTime |
이 AuthorizationContext 개체가 더 이상 유효하지 않은 날짜와 시간을 가져옵니다. |
| Id |
이 AuthorizationContext 개체의 고유 식별자를 가져옵니다. |
| Properties |
이 AuthorizationContext 개체와 연결된 클레임이 아닌 속성의 컬렉션을 가져옵니다. |
메서드
| Name | Description |
|---|---|
| CreateDefaultAuthorizationContext(IList<IAuthorizationPolicy>) |
지정된 권한 부여 정책을 모두 평가하고 .를 만듭니다 AuthorizationContext. |
| Equals(Object) |
지정된 개체가 현재 개체와 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetHashCode() |
기본 해시 함수로 사용됩니다. (다음에서 상속됨 Object) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |