Spring SecurityのBaic Authentication
Spring SecurityがBaic Authenticationを実現します.
Securityファイルの設定
ここでは簡単にするために、Baic Authenticationに専念し、ここで使用するユーザはファイル構成の方式によって、ユーザは最終的にメモリに配置される.
ここでは特に注意が必要です.Baic Authenticationを通じてログインする方法で、ユーザーが退出したいなら、ブラウザを閉じるか、退出する時にクライアントにHttpServletResonse.SC_を送信する必要があります.UNAUTHORIZED 401エラーでユーザーの脱退機能が実現できます.これはBaicAuthentication EntryPointのソースコメントで見られます.原文は以下の通りです.
Baic Authenticationと主に関連する2つのクラスは、Baic Authentication FilterとBaicAuthentication Entication Point、Baic Authentication Entication Entication Pointが、ユーザが許可を必要とするリンクにアクセスするとき、現在ログインしていない場合、BaicAuthentication Form認証フォームをユーザに表示し、Baication Filter認証を要求するユーザの処理を担当する.
ユーザー登録が成功したら、任意のリンクアドレスにアクセスすると、要求ヘッダにAuthoriationという属性が含まれています.暗号化された文字列はユーザ名です.暗号化された文字列はBase 64です.
Securityファイルの設定
ここでは簡単にするために、Baic Authenticationに専念し、ここで使用するユーザはファイル構成の方式によって、ユーザは最終的にメモリに配置される.
ここでは特に注意が必要です.Baic Authenticationを通じてログインする方法で、ユーザーが退出したいなら、ブラウザを閉じるか、退出する時にクライアントにHttpServletResonse.SC_を送信する必要があります.UNAUTHORIZED 401エラーでユーザーの脱退機能が実現できます.これはBaicAuthentication EntryPointのソースコメントで見られます.原文は以下の通りです.
/**
* Used by the ExceptionTraslationFilter
to commence authentication via the {@link BasicAuthenticationFilter}.
*
* Once a user agent is authenticated using BASIC authentication, logout requires that
* the browser be closed or an unauthorized (401) header be sent. The simplest way of achieving the latter is to call
* the {@link #commence(HttpServletRequest, HttpServletResponse, AuthenticationException)} method below. This will indicate to
* the browser its credentials are no longer authorized, causing it to prompt the user to login again.
*
* @author Ben Alex
*/
Baic Authenticationと主に関連する2つのクラスは、Baic Authentication FilterとBaicAuthentication Entication Point、Baic Authentication Entication Entication Pointが、ユーザが許可を必要とするリンクにアクセスするとき、現在ログインしていない場合、BaicAuthentication Form認証フォームをユーザに表示し、Baication Filter認証を要求するユーザの処理を担当する.
ユーザー登録が成功したら、任意のリンクアドレスにアクセスすると、要求ヘッダにAuthoriationという属性が含まれています.暗号化された文字列はユーザ名です.暗号化された文字列はBase 64です.