Я также реализовал
Код: Выделить всё
public class RolesAllowedCXFFeature implements Feature {
@Override
public boolean configure(FeatureContext featureContext) {
SecureAnnotationsInterceptor interceptor = new SecureAnnotationsInterceptor();
featureContext.register(interceptor);
SimpleAuthorizingFilter f = new SimpleAuthorizingFilter();
f.setInterceptor(interceptor);
featureContext.register(f);
return true;
}
public static Object createAuthFilter() {
SimpleAuthorizingFilter f = new SimpleAuthorizingFilter();
f.setInterceptor(new SecureAnnotationsInterceptor());
return f;
}
}
Проблема в том, что методы аннотированные @RolesAllowed, похоже, не работают.
В Джерси было достаточно вернуть новый RolesAllowedDynamicFeature() из Application#getSingletons(), и методы были защищены.
Подробнее здесь: https://stackoverflow.com/questions/791 ... apache-cxf