C# 클래스 Sholo.Web.Security.Authentication.User.UserAuthentication

UserAuthentication exposes a public API for use in working with stateful Forms Authentication in the .NET Framework.
파일 보기 프로젝트 열기: scottt732/SholoWebSecurity

공개 프로퍼티들

프로퍼티 타입 설명
GuidStringLength int
HashAlgorithmByteLength int
HashAlgorithmStringLength int

공개 메소드들

메소드 설명
CalculateFormsAuthTicketHash ( System.Web.Security.FormsAuthenticationTicket formsAuthenticationTicket ) : string

Calculates the hash of the FormsAuthenticationTicket's properties concatenated together with the salt. This is used as a first line of defense against ticket tampering to potentially avoid an unnecessary read from the Provider.

ClearAuthCookie ( ) : void

Sends a blank and expired FormsAuthentication cookie to the client response. This effectively removes the FormsAuthentication cookie and revokes the FormsAuthenticationTicket. It also removes the cookie from the current Request object, preventing subsequent code from being able to access it during the execution of the current request. And just for good measure, it also replaces any existing principal in the current request pipeline with an anonymous one.

CreateFormsAuthTicket ( string username, string cookiePath, string serverKey, System.DateTime validFromDate, System.DateTime validUntilDate, bool persistent ) : System.Web.Security.FormsAuthenticationTicket

Creates a FormsAuthenticationTicket for storage on the client. The UserData field contains the server key, which can be used by the server-side Provider to retrieve validation data and additional details about the ticket (e.g. IP address)

GetAuthCookie ( System.Web.Security.FormsAuthenticationTicket ticket ) : System.Web.HttpCookie

Creates an HttpCookie containing an encrypted FormsAuthenticationTicket. The ticket must contain an hash and key into the Provider.

Initialize ( ) : void

Initializes configuration-related properties and validates configuration.

SetAuthCookie ( System.Web.Security.FormsAuthenticationTicket clientTicket, bool overwriteRequestCookie, bool writeResponseCookie ) : void

Encrypts a FormsAuthenticationTicket in an HttpCookie (using GetAuthCookie) and includes it in the current Request's Cookies collection and/or the Response's outbound Cookies collection.

ValidateFormsAuthTicketHash ( System.Web.Security.FormsAuthenticationTicket formsAuthenticationTicket, string expectedHash ) : bool

Calculates the hash of the formsAuthenticationTicket and compares it to the expected hash

비공개 메소드들

메소드 설명
UserAuthentication ( ) : System

Static constructor

메소드 상세

CalculateFormsAuthTicketHash() 공개 정적인 메소드

Calculates the hash of the FormsAuthenticationTicket's properties concatenated together with the salt. This is used as a first line of defense against ticket tampering to potentially avoid an unnecessary read from the Provider.
public static CalculateFormsAuthTicketHash ( System.Web.Security.FormsAuthenticationTicket formsAuthenticationTicket ) : string
formsAuthenticationTicket System.Web.Security.FormsAuthenticationTicket the formsAuthenticationTicket to /// compute the hash of
리턴 string

ClearAuthCookie() 공개 정적인 메소드

Sends a blank and expired FormsAuthentication cookie to the client response. This effectively removes the FormsAuthentication cookie and revokes the FormsAuthenticationTicket. It also removes the cookie from the current Request object, preventing subsequent code from being able to access it during the execution of the current request. And just for good measure, it also replaces any existing principal in the current request pipeline with an anonymous one.
public static ClearAuthCookie ( ) : void
리턴 void

CreateFormsAuthTicket() 공개 정적인 메소드

Creates a FormsAuthenticationTicket for storage on the client. The UserData field contains the server key, which can be used by the server-side Provider to retrieve validation data and additional details about the ticket (e.g. IP address)
public static CreateFormsAuthTicket ( string username, string cookiePath, string serverKey, System.DateTime validFromDate, System.DateTime validUntilDate, bool persistent ) : System.Web.Security.FormsAuthenticationTicket
username string User associated with the ticket
cookiePath string Relative path on server in which cookie is valid
serverKey string Provider key
validFromDate System.DateTime Ticket valid from date
validUntilDate System.DateTime Ticket valid to date
persistent bool Ticket can persist across browser sessions
리턴 System.Web.Security.FormsAuthenticationTicket

GetAuthCookie() 공개 정적인 메소드

Creates an HttpCookie containing an encrypted FormsAuthenticationTicket. The ticket must contain an hash and key into the Provider.
public static GetAuthCookie ( System.Web.Security.FormsAuthenticationTicket ticket ) : System.Web.HttpCookie
ticket System.Web.Security.FormsAuthenticationTicket The FormsAuthenticationTicket to encode
리턴 System.Web.HttpCookie

Initialize() 공개 정적인 메소드

Initializes configuration-related properties and validates configuration.
public static Initialize ( ) : void
리턴 void

SetAuthCookie() 공개 정적인 메소드

Encrypts a FormsAuthenticationTicket in an HttpCookie (using GetAuthCookie) and includes it in the current Request's Cookies collection and/or the Response's outbound Cookies collection.
public static SetAuthCookie ( System.Web.Security.FormsAuthenticationTicket clientTicket, bool overwriteRequestCookie, bool writeResponseCookie ) : void
clientTicket System.Web.Security.FormsAuthenticationTicket The FormsAuthenticationTicket to encode
overwriteRequestCookie bool Whether or not to replace the cookie in /// the current Request's Cookies collection. This will trick later executing /// code on the current HTTP request into processing the updated cookie
writeResponseCookie bool Whether or not to write the cookie to the /// browser via the Response's Cookies collection.
리턴 void

ValidateFormsAuthTicketHash() 공개 정적인 메소드

Calculates the hash of the formsAuthenticationTicket and compares it to the expected hash
public static ValidateFormsAuthTicketHash ( System.Web.Security.FormsAuthenticationTicket formsAuthenticationTicket, string expectedHash ) : bool
formsAuthenticationTicket System.Web.Security.FormsAuthenticationTicket The formsAuthenticationTicket to hash
expectedHash string The expected hash value
리턴 bool

프로퍼티 상세

GuidStringLength 공개적으로 정적으로 프로퍼티

The expected string length of a GUID
public static int GuidStringLength
리턴 int

HashAlgorithmByteLength 공개적으로 정적으로 프로퍼티

The expected number of bytes of a hash
public static int HashAlgorithmByteLength
리턴 int

HashAlgorithmStringLength 공개적으로 정적으로 프로퍼티

The expected string length of a hash
public static int HashAlgorithmStringLength
리턴 int