S2AnA
いつのまにやら CVS にコミットされてます. (^^;
ちょっとだけ気になったところ.>id:t-wada さん
AbstractAuthorizationInterceptor#invoke(MethodInvocation)
なんですが...
public Object invoke(MethodInvocation invocation) throws Throwable { S2Container container = SingletonS2ContainerFactory.getContainer(); AuthenticationContext ac = (AuthenticationContext) container.getComponent(AuthenticationContext.class); for (int i = 0; i < this.roleNames_.length; i++) { String roleName = this.roleNames_[i]; if(ac.isUserInRole(roleName)) { return ifInRole(invocation, ac, roleName); } } return ifNotInRole(invocation, ac); }
これだとシングルトンのコンテナしか使えないのと,AuthenticationContext
を複数定義することも出来なくなってしまうので,使用する AuthenticationContext
をプロパティで持つようにした方がよいのでは?
private AuthenticationContext authenticationContext; public void setAuthenticationContext(AuthenticationContext authenticationContext) { this.authenticationContext = authenticationContext; } public Object invoke(MethodInvocation invocation) throws Throwable { for (int i = 0; i < this.roleNames_.length; i++) { String roleName = this.roleNames_[i]; if(ac.isUserInRole(roleName)) { return ifInRole(invocation, authenticationContext, roleName); } } return ifNotInRole(invocation, authenticationContext); }
この方がテストもしやすいと思います.
それにしても貧血の人が多いですね... みんな気をつけてねぇ〜.