Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Transform cloudformation in http api authorizers #10

Open
Ankcorn opened this issue Aug 26, 2020 · 1 comment
Open

Enhancement: Transform cloudformation in http api authorizers #10

Ankcorn opened this issue Aug 26, 2020 · 1 comment

Comments

@Ankcorn
Copy link

Ankcorn commented Aug 26, 2020

Transforming any cloud formation referenced in the custom authorizers section would help with building ephemeral authenticated API's. I think if this plugin looped through the authorizers array the same way it did the functions it could support this.

httpApi:
    payload: "2.0"
    authorizers:
      Authorizer:
        identitySource: $request.header.Authorization
        issuerUrl: !GetAtt UserPool.ProviderURL
        audience: !Ref UserPoolClient

I'm working on an over-engineered boilerplate and am trying to get everything working both locally and in the cloud

https://github.com/Ankcorn/serverless-fullstack-example-app

run npm i && serverless deploy --stage local && npm start

The jwt is from the wrong issuer when requests go react app -> serverless offline backend because the issuer is

{
   authorizerName: 'Authorizer',
   name: 'Authorizer',
   identitySource: '$request.header.Authorization',
   issuerUrl: { 'Fn::GetAtt': [ 'UserPool', 'ProviderURL' ] },
   audience: { Ref: 'UserPoolClient' }
}
@Ankcorn
Copy link
Author

Ankcorn commented Aug 26, 2020

I have made a start on this.

I see the current GetAtt support is limited so I am planning to add support to generate providerURLs.

I modified the function signature of parseEnvs to this so I can assign the authorizer URLs back to the right place

const parseEnvs = ({ envs = {}, fn, authorizer })

if you can think of a nicer way shout! 🐱

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant