@Override
protected void configure() {
bindInterceptor(Matchers.any(), new AbstractMatcher<Method>() {
@Override
public boolean matches(Method method) {
return getAuthAnnotations(method.getAnnotations()).isPresent();
}
}, new MethodInterceptor() {
@Override
public Object invoke(MethodInvocation ctx) throws Throwable {
Optional<Auth> methodAnnotation = getAuthAnnotations(ctx.getMethod().getAnnotations());
boolean allowAnon = methodAnnotation.map(Auth::pass).orElse(true);
if (!allowAnon) {
throw new Exception("Access denied");
}
return ctx.proceed();
}
});
}
AuthorizedGuiceModule.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:qbit-extensions
作者:
评论列表
文章目录