我想使用 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”方法后,无论我是否具有该角色,“Support”注释都会被忽略。
我做错了什么?感谢所有建议!