我正在进行一个POC,以将Okta SSO与Spring MVC集成,并使用自定义登录和索引jsp页面。我已经配置了Okta帐户,并配置了登录重定向URI和注销重定向URI
我指的是:https://github.com/okta/samples-java-spring/tree/master/custom-login
登录重定向URI:http://localhost:8080/authorization-code/callback.下面是我的应用程序yaml文件内容
port: 8080
spring:
security:
oauth2:
client:
provider:
okta:
authorization-uri: http://localhost:8080/custom-login
user-name-attribute: email
okta:
oauth2:
redirect-uri: https://dev-14057786.okta.com/oauth2/default
client-id: <client ID>
client-secret: <client-secret>
issuer: https://dev-14057786.okta.com/oauth2/default
scopes:
- openid
- email
- profile
我可以得到Okta登录页面,一旦我点击登录,我得到以下错误:
java.lang.IllegalStateException: The port must be an integer: 8080https:
at org.springframework.web.util.HierarchicalUriComponents.getPort(HierarchicalUriComponents.java:200) ~[spring-web-5.3.22.jar:5.3.22]
at org.springframework.security.oauth2.client.web.OAuth2AuthorizationCodeGrantFilter.matchesAuthorizationResponse(OAuth2AuthorizationCodeGrantFilter.java:196) ~[spring-security-oauth2-client-5.7.3.jar:5.7.3]
at org.springframework.security.oauth2.client.web.OAuth2AuthorizationCodeGrantFilter.doFilterInternal(OAuth2AuthorizationCodeGrantFilter.java:164) ~[spring-security-oauth2-client-5.7.3.jar:5.7.3]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.22.jar:5.3.22]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346) ~[spring-security-web-5.7.3.jar:5.7.3]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:109) ~[spring-security-web-5.7.3.jar:5.7.3]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346) ~[spring-security-web-5.7.3.jar:5.7.3]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) ~[spring-security-web-5.7.3.jar:5.7.3]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346) ~[spring-security-web-5.7.3.jar:5.7.3]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.7.3.jar:5.7.3]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:346) ~[spring-security-web-5.7.3.jar:5.7.3]
at org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter.doFilterInternal(DefaultLogoutPageGeneratingFilter.java:58) ~[spring-security-web-5.7.3.jar:5.7.3]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.22.jar:5.3.22]
谢谢你的帮助。
1条答案
按热度按时间hkmswyz61#
您需要更正
application.yml
文件中的redirect-uri
。您提到的颁发者端点(即验证服务器)不正确。它需要是客户端应用程序端点。对于此特定应用程序,您只需按以下方式设置
redirect-uri