I am in the process of spinning up a microservices
system with a central Authorization Server
that grants tokens
with different scopes for accessing individual micro-service.
Here is the picture explaining the various service calls. The numbers marked are requests made in the chronological order.
1) In a nut-shell, I want the auth Server to return access-token
with a User identifer (id) and scope when controller makes a login call. just like the following example taken from spring tutorial (but this is missing id). how can I have the id retured with the token returned?. I prefer not to make another REST call as proposed in the tutorial.
$ curl acme:acmesecret@localhost:9999/uaa/oauth/token \
-d grant_type=authorization_code -d client_id=acme \
-d redirect_uri=http://example.com -d code=jYWioI
{"access_token":"2219199c-966e-4466-8b7e-12bb9038c9bb","token_type":"bearer","refresh_token":"d193caf4-5643-4988-9a4a-1c03c9d657aa","expires_in":43199,"scope":"openid"}
2) How does the photo Service which receives the access token in the "Authorization bearer" header checks with Auth Server to see the token is valid and it has the scope required to access the photo. (for example, if Auth Server responds back with list of scopes this token is eligible for, Post service can check among the list of scopes, if it can provide access).
3) on a side note, I see the -d code=jYWioI
is passed in above the request, but not sure why it is passed and whats the purpose of it?