RolePrincipal 생성자

정의

클래스의 새 인스턴스를 RolePrincipal 만듭니다.

오버로드

Name Description
RolePrincipal(IIdentity)

지정된 RolePrincipalidentity 대한 개체를 인스턴스화합니다.

RolePrincipal(SerializationInfo, StreamingContext)

지정된 개체에 포함된 정보와 지정된 RolePrincipal 스트리밍 컨텍스트를 사용하여 클래스의 SerializationInfo 새 인스턴스를 초기화합니다.

RolePrincipal(IIdentity, String)

지정된 역할 정보를 사용하여 RolePrincipal 지정된 identity 개체를 인스턴스화합니다 encryptedTicket.

RolePrincipal(String, IIdentity)

지정된 RolePrincipal개체를 identity 사용하여 지정된 providerName 개체를 인스턴스화합니다.

RolePrincipal(String, IIdentity, String)

지정한 개체와 RolePrincipal 지정된 identity 역할 정보를 사용하여 지정된 providerName 개체를 인스턴스화합니다 encryptedTicket.

RolePrincipal(IIdentity)

지정된 RolePrincipalidentity 대한 개체를 인스턴스화합니다.

public:
 RolePrincipal(System::Security::Principal::IIdentity ^ identity);
public RolePrincipal(System.Security.Principal.IIdentity identity);
new System.Web.Security.RolePrincipal : System.Security.Principal.IIdentity -> System.Web.Security.RolePrincipal
Public Sub New (identity As IIdentity)

매개 변수

identity
IIdentity

for를 만들 사용자 ID입니다 RolePrincipal .

예외

identitynull입니다.

예제

다음 코드 예제에서는 새 RolePrincipal 개체를 만듭니다. 이 경우 CacheRolesInCookie 이 예제에서는 true속성으로 RolePrincipal 식별된 CookieName 쿠키에서 쿠키 정보를 만듭니다.

RolePrincipal r;

if (Roles.CacheRolesInCookie)
{
  string roleCookie = "";

  HttpCookie cookie = HttpContext.Current.Request.Cookies[Roles.CookieName];
  if (cookie != null) { roleCookie = cookie.Value; }

  r = new RolePrincipal(User.Identity, roleCookie);
}
else
{
  r = new RolePrincipal(User.Identity);
}
Dim r As RolePrincipal

If Roles.CacheRolesInCookie Then
  Dim roleCookie As String = ""

  Dim cookie As HttpCookie = HttpContext.Current.Request.Cookies(Roles.CookieName)
  If Not cookie Is Nothing Then roleCookie = cookie.Value

  r = New RolePrincipal(User.Identity, roleCookie)
Else
  r = new RolePrincipal(User.Identity)
End If

설명

생성자의 이 오버로드는 RolePrincipalRolePrincipal 개체를 만들고 해당 속성 값을 초기화합니다. 캐시된 역할 정보는 속성으로 식별된 CookieName 쿠키에서 읽지 않습니다. 속성은 ProviderName 기본 역할 공급자로 설정 Name 됩니다.

역할 관리를 사용하도록 설정하는 방법에 대한 자세한 내용은 클래스를 참조하세요 Roles .

추가 정보

적용 대상

RolePrincipal(SerializationInfo, StreamingContext)

지정된 개체에 포함된 정보와 지정된 RolePrincipal 스트리밍 컨텍스트를 사용하여 클래스의 SerializationInfo 새 인스턴스를 초기화합니다.

protected:
 RolePrincipal(System::Runtime::Serialization::SerializationInfo ^ info, System::Runtime::Serialization::StreamingContext context);
protected RolePrincipal(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
new System.Web.Security.RolePrincipal : System.Runtime.Serialization.SerializationInfo * System.Runtime.Serialization.StreamingContext -> System.Web.Security.RolePrincipal
Protected Sub New (info As SerializationInfo, context As StreamingContext)

매개 변수

info
SerializationInfo

SerializationInfo 데이터로 채울 개체입니다.

context
StreamingContext

이 serialization의 대상입니다.

적용 대상

RolePrincipal(IIdentity, String)

지정된 역할 정보를 사용하여 RolePrincipal 지정된 identity 개체를 인스턴스화합니다 encryptedTicket.

public:
 RolePrincipal(System::Security::Principal::IIdentity ^ identity, System::String ^ encryptedTicket);
public RolePrincipal(System.Security.Principal.IIdentity identity, string encryptedTicket);
new System.Web.Security.RolePrincipal : System.Security.Principal.IIdentity * string -> System.Web.Security.RolePrincipal
Public Sub New (identity As IIdentity, encryptedTicket As String)

매개 변수

identity
IIdentity

for를 만들 사용자 ID입니다 RolePrincipal .

encryptedTicket
String

암호화된 역할 정보를 포함하는 문자열입니다.

예외

identitynull입니다.

-또는-

encryptedTicketnull입니다.

예제

다음 코드 예제에서는 새 RolePrincipal 개체를 만듭니다. 이 경우 CacheRolesInCookie 이 예제에서는 true속성으로 RolePrincipal 식별된 CookieName 쿠키에서 쿠키 정보를 만듭니다.

RolePrincipal r;

if (Roles.CacheRolesInCookie)
{
  string roleCookie = "";

  HttpCookie cookie = HttpContext.Current.Request.Cookies[Roles.CookieName];
  if (cookie != null) { roleCookie = cookie.Value; }

  r = new RolePrincipal(User.Identity, roleCookie);
}
else
{
  r = new RolePrincipal(User.Identity);
}
Dim r As RolePrincipal

If Roles.CacheRolesInCookie Then
  Dim roleCookie As String = ""

  Dim cookie As HttpCookie = HttpContext.Current.Request.Cookies(Roles.CookieName)
  If Not cookie Is Nothing Then roleCookie = cookie.Value

  r = New RolePrincipal(User.Identity, roleCookie)
Else
  r = new RolePrincipal(User.Identity)
End If

설명

Important

신뢰할 수 없는 데이터와 함께 이 형식의 인스턴스를 사용하는 것은 보안 위험입니다. 신뢰할 수 있는 데이터에서만 이 개체를 사용합니다. 자세한 내용은 모든 입력 유효성 검사참조하세요.

생성자의 이 오버로드는 RolePrincipalRolePrincipal 개체를 만들고 해당 속성 값을 초기화합니다. 현재 사용자의 역할 정보는 제공된 encryptedTicket 사용자로부터 읽고 개체와 함께 RolePrincipal 캐시됩니다. 속성은 ProviderName 기본 역할 공급자로 설정 Name 됩니다.

역할 관리를 사용하도록 설정하는 방법에 대한 자세한 내용은 클래스를 참조하세요 Roles .

추가 정보

적용 대상

RolePrincipal(String, IIdentity)

지정된 RolePrincipal개체를 identity 사용하여 지정된 providerName 개체를 인스턴스화합니다.

public:
 RolePrincipal(System::String ^ providerName, System::Security::Principal::IIdentity ^ identity);
public RolePrincipal(string providerName, System.Security.Principal.IIdentity identity);
new System.Web.Security.RolePrincipal : string * System.Security.Principal.IIdentity -> System.Web.Security.RolePrincipal
Public Sub New (providerName As String, identity As IIdentity)

매개 변수

providerName
String

사용자에 대한 역할 공급자의 이름입니다.

identity
IIdentity

for를 만들 사용자 ID입니다 RolePrincipal .

예외

identitynull입니다.

providerNamenull입니다.

-또는-

providerName 는 애플리케이션에 대한 구성에 없는 역할 공급자를 나타냅니다.

설명

생성자의 이 오버로드는 RolePrincipalRolePrincipal 개체를 만들고 해당 속성 값을 초기화합니다. 속성이 ProviderName 매개 변수에 지정된 값으로 providerName 설정됩니다.

역할 관리를 사용하도록 설정하는 방법에 대한 자세한 내용은 클래스를 참조하세요 Roles .

추가 정보

적용 대상

RolePrincipal(String, IIdentity, String)

지정한 개체와 RolePrincipal 지정된 identity 역할 정보를 사용하여 지정된 providerName 개체를 인스턴스화합니다 encryptedTicket.

public:
 RolePrincipal(System::String ^ providerName, System::Security::Principal::IIdentity ^ identity, System::String ^ encryptedTicket);
public RolePrincipal(string providerName, System.Security.Principal.IIdentity identity, string encryptedTicket);
new System.Web.Security.RolePrincipal : string * System.Security.Principal.IIdentity * string -> System.Web.Security.RolePrincipal
Public Sub New (providerName As String, identity As IIdentity, encryptedTicket As String)

매개 변수

providerName
String

사용자에 대한 역할 공급자의 이름입니다.

identity
IIdentity

for를 만들 사용자 ID입니다 RolePrincipal .

encryptedTicket
String

암호화된 역할 정보를 포함하는 문자열입니다.

예외

identitynull입니다.

-또는-

encryptedTicketnull입니다.

providerNamenull입니다.

-또는-

providerName 는 애플리케이션에 대한 구성에 없는 역할 공급자를 나타냅니다.

설명

Important

신뢰할 수 없는 데이터와 함께 이 형식의 인스턴스를 사용하는 것은 보안 위험입니다. 신뢰할 수 있는 데이터에서만 이 개체를 사용합니다. 자세한 내용은 모든 입력 유효성 검사참조하세요.

생성자의 이 오버로드는 RolePrincipalRolePrincipal 개체를 만들고 해당 속성 값을 초기화합니다. 현재 사용자의 역할 정보는 제공된 encryptedTicket 사용자로부터 읽고 개체와 함께 RolePrincipal 캐시됩니다. 속성이 ProviderName 매개 변수에 지정된 값으로 providerName 설정됩니다.

역할 관리를 사용하도록 설정하는 방법에 대한 자세한 내용은 클래스를 참조하세요 Roles .

추가 정보

적용 대상