我正在尝试将我的Spring Cloud Zuul服务器迁移到Spring Cloud Gateway。我使用spring security oidc connect进行身份验证。如何使用ServerHttpSecurity配置authorizationEndpoint uri?
我找到了此链接https://github.com/spring-projects/spring-security/issues/5598
但是,我不清楚如何定义具有反应性Spring安全性的授权和重定向端点。任何帮助表示赞赏。
我的HttpSecurity代码(在zuul中)
antMatchers("/edge/login/oauth2/**","/prom/metrics").permitAll()
.anyRequest().authenticated()
.and()
.oauth2Login()
.loginPage("/edge/login/oauth2").permitAll()
.authorizationEndpoint().baseUri("/edge/login/oauth2/authorization").and()
.redirectionEndpoint().baseUri("/edge/login/oauth2/code/*").and()
.userInfoEndpoint().oidcUserService(userService).and().failureUrl("/error")
.defaultSuccessUrl("/home",false).and().logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"));
我的带有响应式ServerHttpSecurity的代码(在网关中)
return http.authorizeExchange()
.pathMatchers("/edge/login/oauth2/**","/gateway/jwk").permitAll()
.anyExchange().authenticated()
.and().oauth2Login()
.and()
.csrf().disable()
.build();