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

杭州服务器租用网站seo专员招聘

杭州服务器租用,网站seo专员招聘,视频拍摄及制作培训,晋州 网站建设 网络推广前提:先保证Gateway网关项目 和 Nacos注册中心 等可以正常访问和调用,搭建方法可查看博文SpringCloud Gateway网关 项目创建 及 整合Nacos开发_spring gateway如何设置工程名称-CSDN博客 类似的全局鉴权方案,参考如下: SpringClo…
前提:先保证Gateway网关项目 和 Nacos注册中心 等可以正常访问和调用,搭建方法可查看博文
SpringCloud Gateway网关 项目创建 及 整合Nacos开发_spring gateway如何设置工程名称-CSDN博客


类似的全局鉴权方案,参考如下: 
SpringCloud Gateway网关 全局过滤器[header token] 实现用户鉴权_gateway添加鉴权过滤器-CSDN博客

核心代码如下: 

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.util.AntPathMatcher;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;import java.nio.charset.StandardCharsets;@Component
public class GlobalAuthFilter implements GlobalFilter, Ordered {private AntPathMatcher antPathMatcher = new AntPathMatcher();@Overridepublic Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {ServerHttpRequest serverHttpRequest = exchange.getRequest();String path = serverHttpRequest.getURI().getPath();// 判断路径中是否包含 system,如果包含system,则不允许访问if (antPathMatcher.match("/**/system/**", path)) {ServerHttpResponse response = exchange.getResponse();response.getHeaders().add("Content-Type", "application/json;charset=UTF-8");response.setStatusCode(HttpStatus.FORBIDDEN);DataBufferFactory dataBufferFactory = response.bufferFactory();DataBuffer dataBuffer = dataBufferFactory.wrap("无权限".getBytes(StandardCharsets.UTF_8));return response.writeWith(Mono.just(dataBuffer));//设置状态码 未授权401//exchange.getResponse().setStatusCode(HttpStatus.UNAUTHORIZED);//个人理解,终止输出访问//return exchange.getResponse().setComplete();}return chain.filter(exchange);}/*** 优先级提到最高** @return*/@Overridepublic int getOrder() {return 0;}
}

http://www.yayakq.cn/news/152076/

相关文章:

  • 夏天做啥网站能致富手机免费个人网站建站
  • 梅州市网站建设如何制作图片配文字
  • 衡水做网站服务商上海seo网络推广公司
  • 上海网站建设集中为加强政协网站建设
  • 查找企业信息的网站wordpress下一页插件
  • 镇江建站做企业网站一般用什么服务器
  • 网站后台图片调换位置建立网站请示
  • 谷歌seo网站推广怎么做wordpress调用支付宝
  • 深圳企业网站制作哪家好wordpress 药品食品
  • 国内免费自建网站淘宝客的网站是自己做的吗
  • 知名网站建设策划网站已备案 还不能访问
  • 网站设计的企业做一个小程序收费价目表
  • 如何做自己公司的网站线上购物网站建设的可行性
  • 优秀个人网站设计模板微商网站怎么做
  • 做娱乐网站被坑郴州网站制作公司
  • 重庆网站页设计制作南京做网站建设有哪些内容
  • 行业网站需要如何做手机网站模板cms
  • 橙色系网站wordpress整站无法打开
  • scratch网站开发wordpress登录密码忘了怎么办
  • 滁州市网站建设科技公司专门做二维码的网站
  • 免费的行情网站app软件推荐揭阳seo网站管理
  • 权威的扬中网站建设急切网头像在线制作图片
  • 静态网站的短处软件项目管理包括哪些内容
  • 网站建设建设公司是干嘛的可以做物理题的网站
  • 软件网站开发公司网站建设开发简介
  • 刘娇娇做网站骗钱的东阿网站建设价格
  • 电子购物网站建设做网站主题
  • 网站开发基本步骤编辑网站用什么软件
  • 南昌城乡住房建设厅网站html学校网站模板
  • 网站开发流程注意事项wordpress实现动态功能