Reputation: 4692
I know normally Cognito itself is an authorization server actor in Oauth2 flow. But as per my custom requirements I want to use spring authorization server with Cognito, basically:
I saw the JDBC example but can't really get it work with Cognito, any help would be appreciated.
Upvotes: 2
Views: 1744
Reputation: 29273
Thought I'd add some notes here on the OAuth architecture to aim for, and how I think of it, since your question had a couple of points that don't quite seem right. I can't help you on Spring AS specifics though.
ROLES
The client implements a code flow at the AS. The AS runs another code flow to the IDP. Chaining these systems together is very standard and should require only configuration, with zero code changes in the client.
REGISTRATION
TOKENS ISSUED
The client always receives tokens from the AS and not the IDP. The AS issues tokens that protect your business data. It enables you to issue whatever scopes and claims you need to lock down tokens.
UPSTREAM TOKENS
Clients and APIs should not usually need to deal with tokens from the IDP. There is sometimes an exception, eg also use AWS tokens to access the user's AWS resources.
If that is your requirement, aim to use embedded tokens. This means Spring AS issues IDP tokens as custom claims to AS tokens. This enables your APIs to continue to authorize correctly, while also being able to access AWS resources when needed.
Upvotes: 0