【发布时间】:2022-01-26 01:33:54
【问题描述】:
从 Okta 服务器重定向后,我的 Spring Boot 应用程序给我一个错误 404。 我可以帮忙解决这个问题吗?我的配置如下。
这是我的 Okta 服务器重定向
这是我收到 404 错误的重定向 URI
http://localhost:8082/mms-sso/auth?code=rOh9u2fwBTB7gasIMUgtjIDMs5_Sydqz-0O_jG5Qhj0&state=xVpkZIPGaGqAQCZIMXZgTrbmKmHJbcKbtM95KO9RwVU%3D
下面是截图
[![error-404][1]][1]
spring:
security:
oauth2:
client:
registration:
okta:
client-id: clientId
client-secret: secret
scope: openid, email
authorization-grant-type: authorization_code
redirect-uri: http://localhost:8082/mms-sso/auth
provider:
okta:
issuer-uri: https://dev-40483106.okta.com/oauth2/default
authorization-uri: https://dev-40483106.okta.com/oauth2/default/v1/authorize
resource:
server: http://localhost:8081
server:
port: 8082
servlet:
context-path: /ui-one
安全配置
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/login**", "/auth/**",
"/auth?**").permitAll().anyRequest().authenticated().and()
.oauth2Login();
Okta 配置
登录重定向 URI - http://localhost:8082/mms-sso/auth
注销重定向 URI - http://localhost:8082/mms-sso/、http://localhost:8082/mms-sso/logout
重定向控制器
@GetMapping("/auth")
String home(@AuthenticationPrincipal OidcUser user) {
return "Welcome to MMS SSO";
}
【问题讨论】:
标签: spring-boot oauth-2.0 okta