public final class ChangeSessionIdAuthenticationStrategy
extends java.lang.ObjectHttpServletRequest.changeSessionId() を使用して、セッション固定攻撃から保護します。これがデフォルトの実装です。| 修飾子と型 | クラスと説明 |
|---|---|
protected static class | org.springframework.security.web.authentication.session.AbstractSessionFixationProtectionStrategy.NullEventPublisher |
| 修飾子と型 | フィールドと説明 |
|---|---|
protected org.apache.commons.logging.Log | logger |
| コンストラクターと説明 |
|---|
ChangeSessionIdAuthenticationStrategy() |
| 修飾子と型 | メソッドと説明 |
|---|---|
void | onAuthentication(Authentication authentication, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) ユーザーが新しく認証されたときに呼び出されます。 |
protected void | onSessionChange(java.lang.String originalSessionId, javax.servlet.http.HttpSession newSession, Authentication auth) セッションが変更され、古い属性が新しいセッションに移行されたときに呼び出されます。 |
void | setAlwaysCreateSession(boolean alwaysCreateSession) |
void | setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)SessionFixationProtectionEvent の送信に使用する ApplicationEventPublisher を設定します。 |
public void onAuthentication(Authentication authentication, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
セッションがすでに存在し、クライアントからのセッション ID と一致する場合、新しいセッションが作成され、セッション属性がそこにコピーされます(migrateSessionAttributes が設定されている場合)。クライアントのリクエストされたセッション ID が無効な場合、現在のセッションと一致しない場合はセッション ID を変更する必要がないため、何も実行されません。
セッションがない場合、alwaysCreateSession プロパティが設定されていない限り、アクションは実行されません。その場合、セッションが存在しない場合はセッションが作成されます。
SessionAuthenticationStrategy 内の onAuthentication protected void onSessionChange(java.lang.String originalSessionId,
javax.servlet.http.HttpSession newSession,
Authentication auth) このメソッドのデフォルト実装は、セッション ID が変更されたことをアプリケーションに通知するために SessionFixationProtectionEvent を公開します。このメソッドをオーバーライドしても、これらのイベントを公開したい場合は、オーバーライドメソッド内で super.onSessionChange() を呼び出す必要があります。
originalSessionId - 元のセッション識別子 newSession - 新しく作成されたセッション auth - 新しく認証されたプリンシパルのトークン public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
SessionFixationProtectionEvent の送信に使用する ApplicationEventPublisher を設定します。デフォルトでは、SessionFixationProtectionEvent は送信されません。org.springframework.context.ApplicationEventPublisherAware 内の setApplicationEventPublisher applicationEventPublisher - ApplicationEventPublishernull にはできません。public void setAlwaysCreateSession(boolean alwaysCreateSession)