RolePrincipal 생성자

정의

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

오버로드

RolePrincipal(IIdentity)

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

RolePrincipal(SerializationInfo, StreamingContext)

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

RolePrincipal(IIdentity, String)

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

RolePrincipal(String, IIdentity)

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

RolePrincipal(String, IIdentity, String)

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

RolePrincipal(IIdentity)

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

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

RolePrincipal을 만들 사용자 ID입니다.

예외

identity이(가) null인 경우

예제

다음 코드 예제에서는 새 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)

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

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

RolePrincipal을 만들 사용자 ID입니다.

encryptedTicket
String

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

예외

identity이(가) null인 경우

또는 encryptedTicket이(가) null인 경우

예제

다음 코드 예제에서는 새 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 개체를 만들고 해당 속성 값을 초기화합니다. 현재 사용자의 역할 정보는 제공된 encryptedTicket 사용자로부터 읽고 개체와 함께 RolePrincipal 캐시됩니다. 속성은 ProviderName 기본 역할 공급자로 설정 Name 됩니다.

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

추가 정보

적용 대상

RolePrincipal(String, IIdentity)

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

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

RolePrincipal을 만들 사용자 ID입니다.

예외

identity이(가) null인 경우

providerName이(가) null인 경우

또는 providerName이 애플리케이션의 구성에 없는 역할 공급자를 참조하는 경우

설명

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

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

추가 정보

적용 대상

RolePrincipal(String, IIdentity, String)

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

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

RolePrincipal을 만들 사용자 ID입니다.

encryptedTicket
String

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

예외

identity이(가) null인 경우

또는 encryptedTicket이(가) null인 경우

providerName이(가) null인 경우

또는 providerName이 애플리케이션의 구성에 없는 역할 공급자를 참조하는 경우

설명

중요

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

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

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

추가 정보

적용 대상