SessionAuthenticationModule.SessionSecurityTokenCreated 이벤트

정의

세션 보안 토큰이 발생합니다.

public:
 event EventHandler<System::IdentityModel::Services::SessionSecurityTokenCreatedEventArgs ^> ^ SessionSecurityTokenCreated;
public event EventHandler<System.IdentityModel.Services.SessionSecurityTokenCreatedEventArgs> SessionSecurityTokenCreated;
member this.SessionSecurityTokenCreated : EventHandler<System.IdentityModel.Services.SessionSecurityTokenCreatedEventArgs> 
Public Custom Event SessionSecurityTokenCreated As EventHandler(Of SessionSecurityTokenCreatedEventArgs) 
Public Event SessionSecurityTokenCreated As EventHandler(Of SessionSecurityTokenCreatedEventArgs) 

이벤트 유형

예제

다음 코드에 대 한 처리기를 보여 줍니다.는 SessionSecurityTokenCreated ASP.NET 웹 애플리케이션의 global.asax.cs 파일에서 구현 하는 이벤트입니다. 또한 이벤트 처리기를 추가 해야 합니다. 보다 완전 한 예제에 표시 됩니다는 SessionAuthenticationModule 개요 항목입니다.

void SessionAuthenticationModule_SessionSecurityTokenCreated(object sender, SessionSecurityTokenCreatedEventArgs e)
{
    System.Diagnostics.Trace.WriteLine("Handling SessionSecurityTokenCreated event");
    //Store session on the server-side token cache instead writing the whole token to the cookie.
    //It may improve throughput but introduces server affinity that may affect scalability
    FederatedAuthentication.SessionAuthenticationModule.IsReferenceMode = true;
}

설명

쿠키에 기록 되기 전에 세션 보안 토큰을 수정 하려면이 이벤트를 사용할 수 있습니다.

SessionSecurityTokenCreated 내에서 이벤트가 발생 합니다 OnAuthenticateRequest 세션 토큰 메서드 (SessionSecurityToken) 만들었습니다. 이 경우, 예를 들어,에 대 한 이벤트 처리기는 SessionSecurityTokenReceived 이벤트 토큰을 수정 합니다.

추가 파이프라인을 통해 전달 되 고 엔터티 (사용자) 요청을 인증에 사용 되는 세션 토큰의 속성을 수정 하려면이 이벤트를 사용할 수 있습니다.

이벤트 처리기를 통해 토큰 액세스할 수 있습니다는 SessionSecurityTokenCreatedEventArgs.SessionToken 속성입니다. 토큰을 수정한 후 확실히를 쓸 때 다시 쿠키를 설정 하 여 합니다 SessionSecurityTokenCreatedEventArgs.WriteSessionCookie 속성을 true입니다. 와 달리, 합니다 SessionSecurityTokenCreated 이벤트를 SessionSecurityTokenCreated 은 취소할 수 있는 이벤트가 아닙니다.

적용 대상