Is it a good way to implement custom authorization logic(like an API call to validate header parameters) in Lambda Authorizers?

0

Hi,

I want to add some authorization logic in every API Gateway other than token authentication to secure my APIs. My custom logic includes call an API to validate my header parameters. If the user have that permission it will generate an allow policy. Is it is possible to implement in custom authorizer? Or is there any other methods available to validate my custom header?

Can we throw custom message from Lambda Authorizer based on our requirement?

Thanks

1回答
1

Hi.

You can use the header verification function for simple regular expressions.
If you need custom validation using an external API, I think the Lambda authorizer is a good choice.

What does custom message throw mean? Please tell me the scenario.

profile picture
エキスパート
iwasa
回答済み 2年前
  • Hi,

    Thanks for the answer.

    I want message format like this

     {
        "errorCode": "xyz_12#",
        "errorType": "Constraint error",
        "errorMessage": "Need administrative permisssion to perform this action"
    };
    

    This error message may be dynamic based on the user role.

    Thanks

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ