Share via


AuthorizationContext.ClaimSets 속성

정의

권한 부여 정책과 연결된 클레임 집합을 가져옵니다.

public:
 abstract property System::Collections::ObjectModel::ReadOnlyCollection<System::IdentityModel::Claims::ClaimSet ^> ^ ClaimSets { System::Collections::ObjectModel::ReadOnlyCollection<System::IdentityModel::Claims::ClaimSet ^> ^ get(); };
public abstract System.Collections.ObjectModel.ReadOnlyCollection<System.IdentityModel.Claims.ClaimSet> ClaimSets { get; }
member this.ClaimSets : System.Collections.ObjectModel.ReadOnlyCollection<System.IdentityModel.Claims.ClaimSet>
Public MustOverride ReadOnly Property ClaimSets As ReadOnlyCollection(Of ClaimSet)

속성 값

클레임 집합이 포함된 ReadOnlyCollection<T> 형식의 ClaimSet입니다.

예제

// 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;
        }
    }
}
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

설명

사용 된 ClaimSets 클레임 집합을 가져오기 위해 속성을 권한 부여 정책에 의해 추가 된 합니다. 에서 ServiceAuthorizationManager 파생되는 클래스는 클레임을 사용하여 권한 부여 결정을 내릴 수 있습니다.

적용 대상