I trying to implement authN/authZ for my application using Spring Security 5.2.2 and OAuth2/openid connect protocols. I use AWS Cognito as an identity provider and I'm trying to implement role-based authorization for my application. I've created user groups in the AWS Cognito user pool. In the resource server, when I convert access token, I use this groups ("cognito:groups" claim in the access token) to build granted authorities for spring security. And I manage access in my application based on this groups.
Is this the correct use of AWS Cognito user groups?