当前位置: 首页 > news >正文

吴江住房和城乡建设局官方网站有没有个人做的网站赚流量费

吴江住房和城乡建设局官方网站,有没有个人做的网站赚流量费,一个域名可以绑定两个网站吗,app开发制作定制外包26过滤器模式#xff08;Filter Pattern#xff09;或标准模式#xff08;Criteria Pattern#xff09;是一种设计模式#xff0c;这种模式允许开发人员使用不同的标准来过滤一组对象#xff0c;通过逻辑运算以解耦的方式把它们连接起来。这种类型的设计模式属于结构型模式…        过滤器模式Filter Pattern或标准模式Criteria Pattern是一种设计模式这种模式允许开发人员使用不同的标准来过滤一组对象通过逻辑运算以解耦的方式把它们连接起来。这种类型的设计模式属于结构型模式它结合多个标准来获得单一标准。 业务场景每次请求通过网关需要验证请求头是否携带 tokensign签名等 类图 AuthService所有滤器类都必须实现的接口 AuthTokenServiceImplToken验证过滤器 AuthSignServiceImpl签名验证过滤器 AuthFactory过滤器工厂利用SpringBoot功能特性实现自动获取过滤器 AuthDTO过滤器所需要的参数 AuthGatewayFilterFactory权限校验过滤器gateway AuthService /*** Author: wmh* Description: 权限校验过滤器* Date: 2023/8/3 18:19* Version: 1.0*/ public interface AuthService {/*** Description: 过滤方法* Param authDTO: 网关上下文* return: String* Author: wmh* Date: 2023/8/3 18:12*/String apply(AuthDTO authDTO);}返回值可以定义为统一返回值R等为了演示方便就返回字符串了 AuthTokenServiceImpl import cn.hutool.core.util.StrUtil; import cn.hutool.jwt.JWT; import cn.hutool.jwt.JWTUtil; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Service;/*** Author: wmh* Description: token校验* Date: 2023/8/3 18:21* Version: 1.0*/ Slf4j Order(0) Service public class AuthTokenServiceImpl implements AuthService {/*** Description: 验证token* Param authDTO: 网关上下文* return: com.norinaviation.atm.common.base.data.R* Author: wmh* Date: 2023/8/3 19:31*/OverrideSneakyThrowspublic String apply(AuthDTO authDTO) {String tokenHeader authDTO.getHeaders().getFirst(CommonConstant.X_TOKEN);if (StrUtil.isBlank(appId)) {return appId不能为空;}if (StrUtil.isBlank(tokenHeader)) {return TOKEN不能为空;}JWT jwt JWTUtil.parseToken(tokenHeader);boolean verifyKey jwt.setKey(CommonConstant.JWT_TOKEN.getBytes()).verify();// 验证token是否正确if (!verifyKey) {log.info(appId:{}, TOKEN auth fail, TOKEN:{}, appId, tokenHeader);return TOKEN认证失败;}boolean verifyTime jwt.validate(0);// 验证token是否过期if (!verifyTime) {log.info(appId:{}, TOKEN expired, TOKEN:{}, appId, tokenHeader);return TOKEN已过期;}return success;}} AuthSignServiceImpl import cn.hutool.core.util.StrUtil; import lombok.AllArgsConstructor; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Service; /*** Author: wmh* Description: 验签校验* Date: 2023/8/3 18:24* Version: 1.0*/ Slf4j Order(1) Service public class AuthSignServiceImpl implements AuthService {/*** Description: 验证签名* Param authDTO: 网关上下文* return: Stirng* Author: wmh* Date: 2023/8/3 19:30*/OverrideSneakyThrowspublic Stirng apply(AuthDTO authDTO) {// 签名逻辑业务代码就不公开了return success;}}AuthFactory import cn.hutool.core.util.ObjectUtil; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component;import java.util.*;/*** Author: wmh* Description: 权限工厂* Date: 2023/8/7 15:54* Version: 1.0*/ Component public class AuthFactory implements ApplicationContextAware {/*** 过滤方式*/private ListAuthService authFilters new ArrayList();/*** 获取应用上下文并获取相应的接口实现类* param applicationContext* throws BeansException*/Overridepublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException {// 获取实现类MapInteger, AuthService authServiceMap new HashMap();applicationContext.getBeansOfType(AuthService.class).values().stream().forEach(authService - {if (ObjectUtil.isNull(authService.getClass().getAnnotation(Order.class))) {authServiceMap.put(CommonConstant.DEFAULT_ORDER, authService);}else {authServiceMap.put(authService.getClass().getAnnotation(Order.class).value(), authService);}});// 根据order排序authServiceMap.entrySet().stream().sorted(Comparator.comparing(e - e.getKey())).forEach(map - {authFilters.add(map.getValue());});}/*** Description: 是否全部符合过滤条件* Param authDTO: 网关上下文* return: String* Author: wmh* Date: 2023/8/3 19:27*/public String apply(AuthDTO authDTO) {for (AuthService filter : authFilters) {String str filter.apply(authDTO);if (!StrUtil.equals(str, success)) {return str;}}return success;}}AuthDTO import lombok.Data; import org.springframework.http.HttpHeaders; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap;/*** Author: wmh* Description: 网关上下文* Date: 2023/8/3 19:09* Version: 1.0*/ Data public class AuthDTO {/*** cache headers*/private HttpHeaders headers;/*** cache json body*/private String cacheBody;/*** cache formdata*/private MultiValueMapString, String formData new LinkedMultiValueMap();}此类为gateway网关需要只展示使用过滤链的代码块 AuthGatewayFilterFactory /*** Author: wmh* Description: 权限校验过滤器* Date: 2023/8/3 19:15* Version: 1.0*/ Slf4j Component public class AuthGatewayFilterFactory extends AbstractGatewayFilterFactory {Autowiredprivate AuthFactory authFactory;Overridepublic GatewayFilter apply(Config config) {return (exchange, chain) - {ServerHttpRequest serverHttpRequest exchange.getRequest();...// 获取request bodyGatewayContext gatewayContext exchange.getAttribute(GatewayContext.CACHE_GATEWAY_CONTEXT);AuthDTO authDTO new AuthDTO();authDTO.setHeaders(gatewayContext.getHeaders());authDTO.setCacheBody(gatewayContext.getCacheBody());authDTO.setFormData(gatewayContext.getFormData());// 验证String strr authFactory.apply(authDTO);...return chain.filter(exchange);};}} Gateway相关SpringCloud-Gateway实现网关_springcloud配置网关_W_Meng_H的博客-CSDN博客网关作为流量的入口常用的功能包括路由转发、权限校验、限流等Spring Cloud 是Spring官方推出的第二代网关框架由WebFluxNettyReactor实现的响应式的API网关它不能在传统的servlet容器工作也不能构建war包。基于Filter的方式提供网关的基本功能例如说安全认证、监控、限流等。_springcloud配置网关https://blog.csdn.net/W_Meng_H/article/details/129775851 CommonConstant常量类 /*** Author: wmh* Description: 常用变量* Date: 2023/3/30 10:29* Version: 1.0*/ Component public class CommonConstant {// JWT密钥public static String JWT_TOKEN;// 请求头中的tokenpublic static final String X_TOKEN X-TOKEN;// 请求头中的签名public static final String X_SIGN X-SIGN;// 请求头中的appIdpublic static final String X_APPID X-APPID;// 请求头中的时间戳public static final String X_TIMESTAMP X-TIMESTAMP;}
http://www.tj-hxxt.cn/news/137687.html

相关文章:

  • 做网站一条龙提供网站建设教学视频
  • 食品行业网站建设如何让搜索引擎不收录网站
  • 领导不愿意做招聘网站怎么办无锡网站维护
  • 注册公司网站模版怎样在安装wordpress
  • 上海市网站开发网站优化外包推荐
  • 重庆建站模板源码建设公司和建筑公司有什么区别
  • 北京住房与城乡建设厅网站首页网站加黑链
  • 电影网站模板html北京 网站建设 招标信息
  • 能搜任何网站的浏览器解除网站被拦截的方法
  • 东莞网站排名情感视频素材网站
  • 苏州公司做变更网站搜索引擎优化的定义
  • 公司网站建设应注意什么200元自助网站建设
  • 做视频网站对服务器要去西安做公司网站
  • 长沙网站制作公司怎么做爱网站最新发布址
  • 中国著名的网站建设公司东营市建设监理协会网站
  • html5自适应网站源码WordPress指定IP访问
  • 网站策划方案1500字wordpress theme framework
  • 大石桥网站漂亮的html静态页面
  • 登封网站关键词优化软件网站建设哪种好
  • 网站推广策划方案大数据做外贸网站挣钱吗
  • 福建省龙岩市建设培训中心网站企业在网站建设上的不足
  • 如何免费建设公司网站企业网站的发展历史
  • 广州17做网站萧山seo
  • 网站怎么做熊掌号wordpress文库
  • 中国建站平台万网建站流程
  • 前端怎么做自己的博客网站工商局注册官网入口
  • 网站之家查询域名新网站如何被快速收录
  • 国外做兼职的网站有哪些做网站竞价没有点击率
  • 中国建设银行中国网站电商类网站开发项目流程
  • 怎么注销自己做的网站做网站素材网