1

Currently i have configured set-uri like below in resource server & spring cloud gateway,

spring.security.oauth2.resourceserver.jwt.jwk-set-uri: http://dev.auth.server:9999/.well-known/jwks.json

However to achieve high availability, I would like to resolve this end point from eureka server, I have successfully registered my auth server in eureka but below configuration fails,

spring.security.oauth2.resourceserver.jwt.jwk-set-uri: **lb://auth-server**/.well-known/jwks.json

could anyone please suggest?

Sathish
  • 245
  • 1
  • 3
  • 16

1 Answers1

1

currently there no way to achieve high availability by directly setting auth-server in jwt.jwk-set-uri instead you can achieve this by routing through spring cloud gateway

spring.security.oauth2.resourceserver.jwt.jwk-set-uri: GATEWAY_SERVER_URL/.well-known/jwks.json

in gateway config, you would have a config like this, which will load balance for you automatically.

- id: oauth-server
  uri: lb://auth-server
  predicates:
  - Path=/.well-known/jwks.json
Sathish
  • 245
  • 1
  • 3
  • 16