Sathish
Sathish

Reputation: 245

spring oauth2 resourceserver jwt.jwk-set-uri from eureka server

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?

Upvotes: 1

Views: 1176

Answers (1)

Sathish
Sathish

Reputation: 245

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

Upvotes: 1

Related Questions