ServiceAuthorizationBehavior.RoleProvider 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
사용자 지정 역할 공급자를 가져오거나 설정합니다.
public:
property System::Web::Security::RoleProvider ^ RoleProvider { System::Web::Security::RoleProvider ^ get(); void set(System::Web::Security::RoleProvider ^ value); };
public System.Web.Security.RoleProvider RoleProvider { get; set; }
member this.RoleProvider : System.Web.Security.RoleProvider with get, set
Public Property RoleProvider As RoleProvider
속성 값
사용자 지정 역할 공급자입니다.
예외
동작이 읽기 전용인 경우
예제
다음 코드에서는 이 속성을 가져오는 방법을 보여 줍니다.
public class MyServiceAuthorizationManager : ServiceAuthorizationManager
{
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;
}
}
Public Class MyServiceAuthorizationManager
Inherits ServiceAuthorizationManager
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.
For Each cs As ClaimSet 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".
For Each c As Claim 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 this point is reached, return false to deny access.
Return False
End Function
End Class
설명
반환된 RoleProvider 개체는 사용자 지정 역할 공급자의 구현입니다.