spring-cloud-gateway-demo icon indicating copy to clipboard operation
spring-cloud-gateway-demo copied to clipboard

spring security oauth2 jwt + spring cloud gateway

Open xuzhi7162 opened this issue 6 years ago • 4 comments

Now, I want to replace UAA with spring security oauth2. But I have encountered some problems. I separately verified that oauth2 has the correct return format.But using the network management jump access will have the following error [invalid_id_token] Missing (required) ID Token in Token Response for Client Registration: gateway org.springframework.security.oauth2.core.OAuth2AuthenticationException: [invalid_id_token] Missing (required) ID Token in Token Response for Client Registration: gateway at org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizationCodeReactiveAuthenticationManager.authenticationResult(OidcAuthorizationCodeReactiveAuthenticationManager.java:165) ~[spring-security-oauth2-client-5.1.6.RELEASE.jar:5.1.6.RELEASE] at org.springframework.security.oauth2.client.oidc.authentication.OidcAuthorizationCodeReactiveAuthenticationManager.lambda$null$1(OidcAuthorizationCodeReactiveAuthenticationManager.java:140) ~[spring-security-oauth2-client-5.1.6.RELEASE.jar:5.1.6.RELEASE]

xuzhi7162 avatar Sep 16 '19 07:09 xuzhi7162

Thank you!

xuzhi7162 avatar Sep 16 '19 07:09 xuzhi7162

yeah, i have the save question

cryice avatar Nov 04 '19 15:11 cryice

I'd recommend using the UAA or some similar product as your security implementation.

benwilcock avatar Mar 18 '20 11:03 benwilcock

Your client must have scope openid and JWT token must contain id_token field (https://openid.net/specs/openid-connect-core-1_0.html#IDToken).

You can refer two sources:

  1. https://github.com/making/oauth2-sso-demo
  2. https://github.com/spring-projects-experimental/spring-authorization-server/tree/main/samples/boot/oauth2-integration

yuen26 avatar May 16 '21 03:05 yuen26