mitao
2025-05-20 179c4d64313c9b7572778da4aaaf6c6584fe457d
springcloud_k8s_panzhihuazhihuishequ/service_equipment/src/main/java/com/panzhihua/service_equipment/resolvers/AuthorizationInterceptor.java
@@ -45,16 +45,17 @@
        Object bean = handlerMethod.getBean();
        String token;
        //从header中得到token
        String header = request.getHeader(Constant.AUTHORIZATION);
        String header = request.getHeader(Constant.UNION_AUTHORIZATION);
        request.getHeader(Constant.AUTHORIZATION);
        if (header != null) {
            String[] tokens = request.getHeader(Constant.AUTHORIZATION).split(" ");
            String[] tokens = request.getHeader(Constant.UNION_AUTHORIZATION).split(" ");
            if (tokens.length >= 2) {
                token = request.getHeader(Constant.AUTHORIZATION).split(" ")[1];
                token = request.getHeader(Constant.UNION_AUTHORIZATION).split(" ")[1];
            } else {
                token = request.getHeader(Constant.AUTHORIZATION);
                token = request.getHeader(Constant.UNION_AUTHORIZATION);
            }
        } else {
            token = request.getHeader(Constant.AUTHORIZATION);
            token = request.getHeader(Constant.UNION_AUTHORIZATION);
        }
        if (manager.checkToken(token)) {
            //如果token验证成功,权限检查通过,将token对应的用户id存在request中,便于之后注入