distinction-dev / lambda-authorizer-utils

Collection of utilities and helper functions to make working with Lambda Authorizers easy
https://distinction-dev.github.io/lambda-authorizer-utils
MIT License
2 stars 1 forks source link

Add a static constructor to instantiate Auth Response from string #4

Closed KillDozerX2 closed 1 year ago

KillDozerX2 commented 1 year ago

Feature Request

Describe the solution you'd like We should be able to use the parse function and use the methodArn to instantiate an object instead of parsing methodArn first.

For example, currently I have to do this:-

        const arnParts = AuthorizerResponse.parseApiGatewayArn(event.methodArn)
        const response = new AuthorizerResponse(
          'apigateway.amazonaws.com',
          arnParts.region,
          arnParts.awsAccountId,
          arnParts.apiId,
          arnParts.stage
        )

And I would like to have a single function to create from methodArn like so

        const response = AuthorizerResponse.fromMethodArn('apigateway.amazonaws.com', event.methodArn)
KillDozerX2 commented 1 year ago

@jappurohit041 this might prove to be even more useful for you.

KillDozerX2 commented 1 year ago

Solved by #6