URLベース認可機能
properties:
authenticationManager=AuthenticationManager-obj
accessDecisionManager=AccessDecisionManager-obj
when add the def to FilterChainProxy,
it HOVE TO BE DEFED AT THE END.
認証されていないユーザを認証するfilter
properties:
userAttribute={user name},{role1},{role2},...
ex.
<'property name="userattribute vakuee="anonymous,ROLE_ANONYMOUS"/>
key=AuthenticationProvider-class
when add the def to FilterChainProxy,
it HOVE TO BE DEFED AFTER LOGIN & LOGOFF-FILTER.
ログイン機能=Authentication-objの設定
ログオフ機能=Authentication-objの初期化
SecurityContext-objはThreadLocalに紐づけられるobj
=1つのthread内で保持される
HttpSessionContextIntegrationFilter
=ThreadLocal内のSecurityContext-objをhttpSessionに設定する。
or make a new Security-Context-obj, and set it to threadLocal and httpSession.
□AuthenticatedVoter:
most strict checking
↑
IS_AUTHENTICATED_FULLY
IS_AUTHENTICATED_REMEMBERED
IS_AUTHENTICATED_ANONYMOUSLY
↓
least strict checking
provides usual login-function.
paramters:
・authenticationManager="AuthenticationManager"
・filterProcessesUrl=ログイン処理を実施するURL
eg. "/process-login"
・defaultTargetUrl=the URL redirected to after login-ope if user simple come from login-page. if it were other page, filter will redirect to the originaly page.・authenticationFailureUrl=the URL redirected to when fail to login.
・"j_username", "j_password"=to ask acegi to do login-ope, must be this param-name. if have to change it, extend the AuthenticationProcessFilter and override the obatain-methods.
also works as a di container.
□FilterToBeanProxy
when its enough to use just one filter
parameters:
・[targetBean](init-param)=Filter-instanceの名前を指定
□FilterChainProxy
when need to use several filters
parameters:
・CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON=reqされたURLを小文字に変換して評価するdef
・PATTERN_TYPE_APACHE_ANT=URL指定をApache Antのパス指定形式で指定
・URLpatternと実行するfilter-instanceのdef={URLpatter}={filter-instance name},{filter-instance name},...
URLpatternと一致した時に、filterが[[指定された順]]に実行される。
一致しなかった場合、次の行へ移る。
□classes which impl [[AccesssDecisionManager]]
AffirmativeBased
認可不可のAccessDecisionVoter-obj1つで認可不可
Authentication-objがmethod内で指定された[[role1つ]]保持AccessDecisionVoter-objは認可可能
□UnanimousBased
認可不可のAccessDecisionVoter-obj1つで認可不可
Authentication-objがmethod内で指定された[[全role]]保持AccessDecisionVoter-objは認可可能
□ConsensusBased
認可可能なAccessDecisionVoter-obj数の[[多数決で認可判定]]
Authentication-objがmethod内で指定された[[role1つ]]保持AccessDecisionVoter-objは認可可能
□認証フロー
1
認証・認可クライアントは、認証に要る情報をAuthenticationManager#authenticateに渡して呼び出す。
2
AuthenticationManagerは、受け取った情報を元に認証処理。
正しければ、その情報を元にAuthentication objectを作成し、返す。
問題があれば、throw a AuthenticationException.
□認可フロー
1
認証・認可クライアントは、Authentication objectとConfigAttributeDefinition objectを、AccessDesisionManager#decideに渡して呼び出す。
2
AccessDecisionManager-objは、受け取ったAuthentication-objからGrantedAuthority-objを取得。
取得したGrantedAuthority-objとConfigAttributeDefinition-objの情報を元に認可。
if there're any err, throw a AccessDeniedException.
3
認証・認可クライアントは、AccessDecisionManager-objのdecideが正常終了した場合に、要求された処理を実行。
if err at decide(), 要求された処理を拒否し、throw a exception.
□認証フロー
1
認証・認可クライアントは、認証に要る情報をAuthenticationManager#authenticateに渡して呼び出す。
2
AuthenticationManagerは、受け取った情報を元に認証処理。
正しければ、その情報を元にAuthentication objectを作成し、返す。
問題があれば、throw a AuthenticationException.
□認可フロー
1
認証・認可クライアントは、Authentication objectとConfigAttributeDefinition objectを、AccessDesisionManager#decideに渡して呼び出す。
2
AccessDecisionManager-objは、受け取ったAuthentication-objからGrantedAuthority-objを取得。
取得したGrantedAuthority-objとConfigAttributeDefinition-objの情報を元に認可。
if there're any err, throw a AccessDeniedException.
3
認証・認可クライアントは、AccessDecisionManager-objのdecideが正常終了した場合に、要求された処理を実行。
if err at decide(), 要求された処理を拒否し、throw a exception.
□AuthenticationManager
認証処理を実施するクラスのIF
□AccessDecisionManager
認可処理を実施するクラスのIF
□Authentication
認証情報を保持するクラスのIF
□GrantedAuthority
認可情報を保持するクラスのIF
one grantedAuthority-object for only one role.
□ConfigAttributeDefinition
認可可能なroleを定義するクラス