クラス LoginUrlAuthenticationEntryPoint
- java.lang.Object
-
- org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint
- 実装されたすべてのインターフェース:
org.springframework.beans.factory.InitializingBean
,AuthenticationEntryPoint
public class LoginUrlAuthenticationEntryPoint extends java.lang.Object implements AuthenticationEntryPoint, org.springframework.beans.factory.InitializingBean
ExceptionTranslationFilter
がUsernamePasswordAuthenticationFilter
を介してフォームログイン認証を開始するために使用します。ログインフォームの場所を
loginFormUrl
プロパティに保持し、それを使用してログインページへのリダイレクト URL を作成します。または、このプロパティに絶対 URL を設定し、それを排他的に使用することもできます。相対 URL を使用する場合、
forceHttps
プロパティを true に設定して、リソースに対する元のインターセプトリクエストがHTTP
プロトコルを使用した場合でも、ログインフォームに使用されるプロトコルをHTTPS
に強制できます。これが発生した場合、(HTTPS を介して)ログインに成功した後でも、元のリクエスト URL を介して元のリソースに HTTP としてアクセスされます。強制 HTTPS 機能を機能させるために、PortMapper
を調べて HTTP:HTTPS ペアを決定します。絶対 URL が使用されている場合、forceHttps
の値は効果がありません。- 導入:
- 3.0
コンストラクターのサマリー
コンストラクター コンストラクター 説明 LoginUrlAuthenticationEntryPoint(java.lang.String loginFormUrl)
メソッドのサマリー
すべてのメソッド インスタンスメソッド 具象メソッド 修飾子と型 メソッド 説明 void
afterPropertiesSet()
protected java.lang.String
buildHttpsRedirectUrlForRequest(javax.servlet.http.HttpServletRequest request)
指定されたリクエストを HTTPS にリダイレクトする URL を作成します。protected java.lang.String
buildRedirectUrlToLoginPage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AuthenticationException authException)
void
commence(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AuthenticationException authException)
ログインフォーム URL へのリダイレクト(または転送)を実行します。protected java.lang.String
determineUrlToUseForThisRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AuthenticationException exception)
サブクラスが、特定のリクエストに適用できるログインフォーム URL を変更できるようにします。java.lang.String
getLoginFormUrl()
protected PortMapper
getPortMapper()
protected PortResolver
getPortResolver()
protected boolean
isForceHttps()
protected boolean
isUseForward()
void
setForceHttps(boolean forceHttps)
true に設定すると、ログインフォームへのアクセスが https 経由になります。void
setPortMapper(PortMapper portMapper)
void
setPortResolver(PortResolver portResolver)
void
setUseForward(boolean useForward)
302 リダイレクトの代わりにRequestDispatcher
を使用してloginFormUrl
に転送するかどうかを指示します。
メソッドの詳細
afterPropertiesSet
public void afterPropertiesSet()
- 次で指定:
- インターフェース
org.springframework.beans.factory.InitializingBean
のafterPropertiesSet
determineUrlToUseForThisRequest
protected java.lang.String determineUrlToUseForThisRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AuthenticationException exception)
サブクラスが、特定のリクエストに適用できるログインフォーム URL を変更できるようにします。- パラメーター:
request
- リクエストresponse
- レスポンスexception
- 例外- 戻り値:
- URL (null または空にすることはできません。デフォルトは
getLoginFormUrl()
)
commence
public void commence(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AuthenticationException authException) throws java.io.IOException, javax.servlet.ServletException
ログインフォーム URL へのリダイレクト(または転送)を実行します。- 次で指定:
- インターフェース
AuthenticationEntryPoint
のcommence
- パラメーター:
request
-AuthenticationException
が発生したリクエストresponse
- ユーザーエージェントが認証を開始できるようにするauthException
- 呼び出しの原因となった例外- 例外:
java.io.IOException
javax.servlet.ServletException
buildRedirectUrlToLoginPage
protected java.lang.String buildRedirectUrlToLoginPage(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AuthenticationException authException)
buildHttpsRedirectUrlForRequest
protected java.lang.String buildHttpsRedirectUrlForRequest(javax.servlet.http.HttpServletRequest request) throws java.io.IOException, javax.servlet.ServletException
指定されたリクエストを HTTPS にリダイレクトする URL を作成します。ログインページに転送する前に、現在のリクエストを HTTPS にリダイレクトするために使用されます。- 例外:
java.io.IOException
javax.servlet.ServletException
setForceHttps
public void setForceHttps(boolean forceHttps)
ログインフォームへのアクセスを https 経由で強制するには、true に設定します。この値が true (デフォルトは false) で、インターセプターをトリガーした保護されたリソースに対する受信リクエストがまだhttps
でない場合、serverSideRedirect が true に設定されている場合でも、クライアントは最初に https URL にリダイレクトされます。
isForceHttps
protected boolean isForceHttps()
getLoginFormUrl
public java.lang.String getLoginFormUrl()
setPortMapper
public void setPortMapper(PortMapper portMapper)
getPortMapper
protected PortMapper getPortMapper()
setPortResolver
public void setPortResolver(PortResolver portResolver)
getPortResolver
protected PortResolver getPortResolver()
setUseForward
public void setUseForward(boolean useForward)
302 リダイレクトの代わりにRequestDispatcher
を使用してloginFormUrl
に転送するかどうかを指示します。- パラメーター:
useForward
- ログインページへの転送を使用する必要がある場合は true。loginFormUrl
が絶対値に設定されている場合、false(デフォルト)でなければなりません。
isUseForward
protected boolean isUseForward()