역활 기반 보안은 .Net Framework 1.0 부터 사용해왔다. Identity 와 Iprincipal 은 역할 기반 보안을 구현하기 위해 .Net Framwork 에서 제공하는 두 가지 추상적인 개념이다.

(그림: IPrincipal 그리고 IIdentity 구현된 클래스)

사용자 정의 시나리오를 위한 GenericIdentity와 GenericPrincipal 클래스.

윈도우 인증 기반의 시나리오를 위한 WindowIdentity와 WindowPrincipal 클래스 

IPrincipal 인터페이스 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
    // Summary:
    //     Defines the basic functionality of a principal object.
    [ComVisible(true)]
    public interface IPrincipal
    {
        // Summary:
        //     Gets the identity of the current principal.
        //
        // Returns:
        //     The System.Security.Principal.IIdentity object associated with the current
        //     principal.
        IIdentity Identity { get; }
 
        // Summary:
        //     Determines whether the current principal belongs to the specified role.
        //
        // Parameters:
        //   role:
        //     The name of the role for which to check membership.
        //
        // Returns:
        //     true if the current principal is a member of the specified role; otherwise,
        //     false.
        bool IsInRole(string role);
    }
cs

Identity 인터페이스 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 // Summary:
    //     Defines the basic functionality of an identity object.
    [ComVisible(true)]
    public interface IIdentity
    {
        // Summary:
        //     Gets the type of authentication used.
        //
        // Returns:
        //     The type of authentication used to identify the user.
        string AuthenticationType { get; }
        //
        // Summary:
        //     Gets a value that indicates whether the user has been authenticated.
        //
        // Returns:
        //     true if the user was authenticated; otherwise, false.
        bool IsAuthenticated { get; }
        //
        // Summary:
        //     Gets the name of the current user.
        //
        // Returns:
        //     The name of the user on whose behalf the code is running.
        string Name { get; }
    }
cs



Posted by Hoya0415
,