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

自己有了域名 怎么做网站温州seo结算

自己有了域名 怎么做网站,温州seo结算,5118网站的功能,怎么搞wordpressMy Retro应用安全架构设计 My Retro应用采用Reactive技术栈构建,通过与Spring Security和Spring Boot的深度集成,实现了基于WebFlux的安全自动配置机制。该安全架构的核心设计理念是将用户认证与授权功能解耦:用户应用(User App)负责用户信息存储与查询,而My Retro应用则基…

My Retro应用安全架构设计

My Retro应用采用Reactive技术栈构建,通过与Spring Security和Spring Boot的深度集成,实现了基于WebFlux的安全自动配置机制。该安全架构的核心设计理念是将用户认证与授权功能解耦:用户应用(User App)负责用户信息存储与查询,而My Retro应用则基于安全配置规则对用户信息实施保护。

Reactive安全集成原理

在build.gradle配置中,关键安全依赖包括:

implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive'

WebFlux安全架构通过SecurityWebFilterChain接口实现,这是Reactive环境下SecurityFilterChain的对应实现,专门处理Mono和Flux类型的数据流。与Servlet架构不同,Reactive安全配置需要特别处理以下核心组件:

  • ServerHttpSecurity:配置请求级安全规则
  • ReactiveAuthenticationManager:实现响应式认证逻辑
  • CorsConfigurationSource:管理跨域请求策略

认证授权分离架构

用户认证通过UserClient类实现与用户应用的交互,该类使用WebClient进行响应式HTTP调用:

@Component
public class UserClient {private final WebClient webClient;public UserClient(WebClient.Builder builder, MyRetroProperties props) {this.webClient = builder.baseUrl(props.getUsers().getServer()).defaultHeaders(headers -> headers.setBasicAuth(props.getUsers().getUsername(),props.getUsers().getPassword())).build();}public Mono getUserInfo(String email) {return webClient.get().uri("/users/{email}", email).retrieve().bodyToMono(User.class);}
}

授权配置在RetroBoardSecurityConfig类中实现,通过路径匹配规则定义访问控制:

@Bean
SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {http.csrf().disable().authorizeExchange().pathMatchers(HttpMethod.POST,"/retros/**").hasRole("ADMIN").pathMatchers(HttpMethod.DELETE,"/retros/**").hasRole("ADMIN").pathMatchers("/retros/**").hasAnyRole("USER","ADMIN").pathMatchers("/","/webjars/**").permitAll().and().formLogin().httpBasic();return http.build();
}

安全数据流设计

系统安全数据流包含以下关键处理环节:

  1. 认证流程

    • 用户提交邮箱/密码凭证
    • ReactiveAuthenticationManager通过UserClient验证凭证
    • 生成包含权限信息的UsernamePasswordAuthenticationToken
  2. 会话管理

    @Bean
    ServerAuthenticationSuccessHandler successHandler() {return (exchange, auth) -> {User user = (User) auth.getDetails();return exchange.getExchange().getSession().flatMap(session -> {// 构建包含用户详情的JSON响应String body = buildUserJson(auth, user);// 设置安全响应头exchange.getExchange().getResponse().getHeaders().add("X-MYRETRO", "SESSION="+session.getId());return response.writeWith(body);});};
    }
    
  3. 跨域安全

    @Bean
    CorsConfigurationSource corsConfig() {CorsConfiguration config = new CorsConfiguration();config.setAllowedMethods(Arrays.asList("GET","POST","PUT","DELETE"));config.setAllowedHeaders(Arrays.asList("Authorization","Content-Type"));config.setAllowedOriginPatterns(Arrays.asList("http://localhost:*"));UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();source.registerCorsConfiguration("/**", config);return source;
    }
    

该架构通过响应式编程模型实现了非阻塞的安全控制流程,同时保持了与Spring Security核心功能的一致性。安全测试可采用@WebFluxTest结合@WithMockUser注解模拟不同权限用户的访问场景。

build.gradle安全依赖配置详解

在My Retro应用中,安全模块的依赖管理通过build.gradle文件实现。关键安全依赖包括:

dependencies {// Reactive安全核心依赖implementation 'org.springframework.boot:spring-boot-starter-webflux'implementation 'org.springframework.boot:spring-boot-starter-security'// 数据层安全支持implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive'// 开发工具链developmentOnly 'org.springframework.boot:spring-boot-docker-compose'implementation 'org.springframework.boot:spring-boot-devtools'// 测试相关依赖testImplementation 'org.springframework.security:spring-security-test'testImplementation 'io.projectreactor:reactor-test'
}

该配置特点:

  1. 使用Spring Boot 3.2.3作为基础框架版本
  2. 集成WebFlux响应式安全starter
  3. 包含MongoDB Reactive驱动支持
  4. 开发阶段启用Docker Compose和DevTools
  5. 测试环境配置了安全测试和Reactor测试支持

UserClient类的Reactive通信实现

UserClient类作为与用户服务通信的核心组件,采用响应式编程模型实现:

@Component
public class UserClient {private final WebClient webClient;public UserClient(WebClient.Builder builder, MyRetroProperties props) {this.webClient = builder.baseUrl(props.getUsers().getServer()).defaultHeaders(headers -> headers.setBasicAuth(props.getUsers().getUsername(),props.getUsers().getPassword()))

文章转载自:

http://avAvKCWF.tsfLw.cn
http://oJq5We8b.tsfLw.cn
http://ZzOXwPHr.tsfLw.cn
http://8KUNBQmn.tsfLw.cn
http://962T4pb5.tsfLw.cn
http://6KMBb6FU.tsfLw.cn
http://8bgpSohk.tsfLw.cn
http://reDSCBQS.tsfLw.cn
http://WTjmYSCr.tsfLw.cn
http://EDBpvwQg.tsfLw.cn
http://dzkTIN4D.tsfLw.cn
http://HZgc6qnH.tsfLw.cn
http://qKYTj6qw.tsfLw.cn
http://akabvZeZ.tsfLw.cn
http://IERWeLjA.tsfLw.cn
http://9XFgHhNO.tsfLw.cn
http://fX0RRe5F.tsfLw.cn
http://K7MCn4J5.tsfLw.cn
http://YFBB1FQN.tsfLw.cn
http://93QaJAyl.tsfLw.cn
http://5mz07IEE.tsfLw.cn
http://1z8xfZRX.tsfLw.cn
http://SziZpxY1.tsfLw.cn
http://Bc4d8j7f.tsfLw.cn
http://FUpwGedE.tsfLw.cn
http://aN4Aka3s.tsfLw.cn
http://jgEdMNcg.tsfLw.cn
http://1KFINmmo.tsfLw.cn
http://kSuJCGNN.tsfLw.cn
http://M1XDvXc7.tsfLw.cn
http://www.dtcms.com/wzjs/685119.html

相关文章:

  • 做网站好一点的软件百度sem
  • 做僾网站wdcp v3搭建WordPress
  • 高端手机网站建设需要多少钱wordpress sql语句
  • 200m的空间可以做大大的网站潍坊视频类网站建设
  • 天津网站备案技术支持 佛山网站建设
  • php电商网站开发的优势江西网站开发企业
  • intitle 无线网站制作免费的招聘平台有哪些
  • WordPress1001无标题深圳seo优化公司排名
  • 威海网站制作怎么样网站首页原型图
  • 南阳定制网站制作价格低用vue做网站
  • 织梦教育培训网站源码网站设计步骤的教学设计
  • 智慧校园信息门户网站建设wordpress排版教程
  • 大学html网站建设作业怎么样做短视频
  • 自己做网站出证书wordpress网址导航
  • 东莞外贸网站设计网站做程序
  • 唐山正规做网站的公司天津市网站制作建设推广公司
  • 做蛋糕需要建议网站不游戏建设网站
  • 百度站长网站验证网站建设销售应答技巧
  • 沈阳做网站哪家好wordpress添加description和keywords方法
  • 酒泉网站建设有限公司短视频入口seo
  • 建筑人才网官网 北京保定seo推广外包
  • 上海网站建设 永灿外贸英语学习网站
  • 电子政务网站建设参考文献删除百度收录的网站
  • 源代码建网站平面设计比较好的网站
  • 网站名注册网站服务器停止响应是什么意思
  • 做网站国内好的服务器做电影网站代理合法么
  • 建立网站的文案怎么写汕头市做网站
  • 杭州手机建设网站北京网站建设 知乎
  • 做一个搜索引擎网站要多少钱企业门户网站方案
  • 广州 350建网站无锡网站排名系统