Is it possible to use sequence: Cognito Authorizer and Lambda Athorizer?

0

I have a NET 6 Web REST API service deployed as Lambda and works with RDS PostgreSQL database.

What do you think about my idea? It is:

  1. Create User pool
  2. Declare Cognito Authorizer in AWS Gateway ("allow" or "deny")
  3. If its response is "Allow" then use my Lambda Custom authorizer: email+password stored in my database, return a role: User, Power User, Admin, Superadmin.
2개 답변
1

Hi Oleg :)

I think this answer outlines well the options for role based authorizations: https://repost.aws/questions/QUpYtLZR5wQVqOSWI4BcblQQ/rbac-for-api-gateway-endpoints-using-cognito-user-groups.

Hope it helps

profile picture
전문가
답변함 일 년 전
0

Hi, @Oleg.

I understand that "AWS Gateway" is "API Gateway".

You cannot set multiple authorizers in combination in API Gateway.
So you have to implement your custom logic in the Lambda authorizer.

Validate Cognito's JWT in Lambda and check for the target user pool. Then perform custom processing.
The following documents may be helpful.

https://github.com/aws-samples/amazon-cognito-api-gateway

profile picture
전문가
iwasa
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠