SessionAuthenticationModule.SessionSecurityTokenCreated 이벤트
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
세션 보안 토큰을 만들 때 발생합니다.
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)
이벤트 유형
예제
다음 코드는 ASP.NET 웹 애플리케이션의 SessionSecurityTokenCreated 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 토큰(SessionSecurityToken)을 OnAuthenticateRequest 만든 후 메서드 내에서 이벤트가 발생합니다. 예를 들어 이벤트에 대한 이벤트 처리기가 토큰을 SessionSecurityTokenReceived 수정하는 경우 이 오류가 발생합니다.
이 이벤트를 사용하여 파이프라인을 따라 추가로 전달되고 요청(사용자)을 만드는 엔터티를 인증하는 데 사용되기 전에 세션 토큰의 속성을 수정할 수 있습니다.
이벤트 처리기에서 속성을 통해 SessionSecurityTokenCreatedEventArgs.SessionToken 토큰에 액세스할 수 있습니다. 토큰을 수정한 후에는 속성을 .로 설정 SessionSecurityTokenCreatedEventArgs.WriteSessionCookie 하여 토큰이 쿠키에 다시 기록되도록 할 true수 있습니다. 이벤트와 SessionSecurityTokenCreated 달리 취소 SessionSecurityTokenCreated 할 수 있는 이벤트는 아닙니다.