Reputation: 2396
Looking at the following example https://github.com/spring-cloud-samples/sso, the URL to the authorization/authentication server is predefined in application.yml.
The question is, if I have the config server and eureka in my architecture, can the SSO service discover the authserver through Eureka as opposed to having it predefined in the configuration file?
I tried changing the config file by using the service name instead of localhost:8080. It didn't work.
oauth2:
client:
tokenUri: http://authserver/uaa/oauth/token
authorizationUri: http://authserver/uaa/oauth/authorize
clientId: acme
clientSecret: acmesecret
resource:
jwt:
keyUri: http://authserver/uaa/oauth/token_key
id: openid
serviceId: ${PREFIX:}resource
Along the same thinking process, instead of providing keyUri to JWT, can I populate the public key directly through the configuration server? WHat would be the syntax?
Edit: After some more tests, it appears that tokenUri and authorizationUri are very well discoverable. I can use the service name instead of localhost:8080. The only question now is what to do with keyUri.
Upvotes: 2
Views: 2549
Reputation: 2396
Problem solved. As per the edit above, the tokenUri and the authorizationUri are discoverable. Instead of using keyUri, I use keyValue. This way, the SSO server does not need to connect to the Oauth server to fecth the key. I then populate the keyValue using the configuration server in the way any other value would be populated. This renders my authorization server completely discoverable.
Upvotes: 4