다음을 통해 공유


SessionAuthenticationModule.OnAuthenticateRequest(Object, EventArgs) 메서드

정의

ASP.NET 파이프라인에서 이벤트를 처리합니다 AuthenticateRequest .

protected:
 virtual void OnAuthenticateRequest(System::Object ^ sender, EventArgs ^ eventArgs);
protected virtual void OnAuthenticateRequest(object sender, EventArgs eventArgs);
abstract member OnAuthenticateRequest : obj * EventArgs -> unit
override this.OnAuthenticateRequest : obj * EventArgs -> unit
Protected Overridable Sub OnAuthenticateRequest (sender As Object, eventArgs As EventArgs)

매개 변수

sender
Object

이벤트의 원본입니다. 개체가 HttpApplication 됩니다.

eventArgs
EventArgs

이벤트의 데이터입니다.

예외

구성된 유효한 세션 토큰 처리기가 없습니다. (속성에 구성된 항목이 SecurityTokenHandlers 없습니다SessionSecurityTokenHandler.)

설명

이 메서드는 다음을 수행합니다.

  1. 세션 쿠키가 TryReadSessionTokenFromCookie 있는 경우 메서드를 SessionSecurityToken 호출하여 세션 쿠키에서 읽습니다.

  2. 세션 보안 토큰을 읽을 수 없는 경우(세션이 설정되지 않았기 때문일 가능성이 높음) 반환합니다.

  3. OnSessionSecurityTokenReceived 이벤트를 발생 하려면 메서드를 호출 합니다SessionSecurityTokenReceived. 이렇게 하면 쿠키에서 읽은 토큰이 수정되거나 요청이 취소될 수 있습니다. 처리기는 속성을 설정 SessionSecurityTokenReceivedEventArgs.ReissueCookie 하여 토큰을 다시 실행하도록 지정할 수도 있습니다.

  4. 토큰을 다시 실행하려면 캐시에서 토큰을 제거하고 메서드를 OnSessionSecurityTokenCreated 호출하여 이벤트를 발생 SessionSecurityTokenCreated 합니다. 이렇게 하면 토큰을 다시 수정할 수 있는 기회가 제공됩니다. 이벤트 처리기에서 속성을 설정하여 재발행 동작을 SessionSecurityTokenCreatedEventArgs.WriteSessionCookie 수정할 수도 있습니다.

  5. AuthenticateSessionSecurityToken 사용자를 인증하는 메서드를 호출합니다. 성공하면 들어오는 토큰의 속성에 포함된 SessionSecurityToken.ClaimsPrincipal 보안 주체로 속성을 설정하는 Thread.CurrentPrincipal 효과가 있습니다.

  6. 세션이 만료된 경우 메서드를 SignOut 호출합니다.

메서드는 OnAuthenticateRequest 메서드의 이벤트에 InitializeModule 대한 HttpApplication.AuthenticateRequest 처리기에 추가됩니다.

적용 대상