Search in sources :

Example 1 with Role

use of io.leopard.security.admin.annotion.Role in project leopard by tanhaichao.

the class RoleInterceptor method preHandle.

@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    // logger.info("preHandle uri:" + request.getRequestURI() + " handler:" + handler.getClass());
    if (!(handler instanceof HandlerMethod)) {
        return true;
    }
    // TODO ahai 这里要加上缓存?
    HandlerMethod method = (HandlerMethod) handler;
    Role role = method.getMethodAnnotation(Role.class);
    if (role == null) {
        return true;
    }
    this.check(role, request);
    return true;
}
Also used : Role(io.leopard.security.admin.annotion.Role) HandlerMethod(org.springframework.web.method.HandlerMethod)

Aggregations

Role (io.leopard.security.admin.annotion.Role)1 HandlerMethod (org.springframework.web.method.HandlerMethod)1