我想用 DeltaSpike-API 保护我的“无状态”EJb。
@Stateless
@Remote(UserServiceRemote.class)
public class UserService implements UserServiceRemote
在方法级别,我有一个自定义注释“支持”
@Support
public void doSomething() {}
因此我写了一个自定义注释“@Support”:
@Retention(value = RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD })
@Documented
@SecurityBindingType
public @interface Support {
我的自定义授权人看起来像:
@Secures
@Support
public boolean doAdminCheck(Identity identity, IdentityManager identityManager, RelationshipManager relationshipManager)
throws Exception {
return hasRole(relationshipManager, identity.getAccount(), getRole(identityManager, "Support"));
}
在我的“beans.xml”文件中,我包括:
<interceptors>
<class>org.apache.deltaspike.security.impl.extension.SecurityInterceptor</class>
</interceptors>
但是在我登录我的应用程序并在每次远程调用时调用“doSomething”方法后,“支持”注释将被忽略,无论我是否有这个角色。
我做错了什么?谢谢大家的建议!!!