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

RequestAuthorizer.IdentitySources not settable in .NET #6538

Closed
monnecc opened this issue Mar 2, 2020 · 2 comments · Fixed by #6649
Closed

RequestAuthorizer.IdentitySources not settable in .NET #6538

monnecc opened this issue Mar 2, 2020 · 2 comments · Fixed by #6649
Assignees
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. language/dotnet Related to .NET bindings p1

Comments

@monnecc
Copy link

monnecc commented Mar 2, 2020

If I try to set the property RequestAuthorizer.IdentitySources in my API Gateway setup, I can't create an instance of type IdentitySource (saying it needs to use the Authorization HTTP header). There is an empty constructor of the IdentitySource class and an IdentitySource.Header method which returns a string, but not an IdentitySource instance.

Reproduction Steps

Authorizer = new RequestAuthorizer(this, "Authorizer", new RequestAuthorizerProps
                    {
                        IdentitySources = new[] {  ??????  }
                    })

Environment

NuGet: Amazon.CDK.AWS.APIGateway 1.26.0


This is 🐛 Bug Report

@monnecc monnecc added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 2, 2020
@SomayaB SomayaB added language/dotnet Related to .NET bindings @aws-cdk/aws-apigateway Related to Amazon API Gateway labels Mar 2, 2020
@monnecc
Copy link
Author

monnecc commented Mar 9, 2020

Is there any news on this issue?

@nija-at nija-at added p1 and removed needs-triage This issue or PR still needs to be triaged. labels Mar 10, 2020
nija-at pushed a commit that referenced this issue Mar 10, 2020
The `identitySources` property in `RequestAuthorizerProps` was
incorrectly set to the type `IdentitySource[]` instead of `string[]`.
This caused a type mismatch in languages with stricter type checks, such
as C#.

fixes #6538
@nija-at
Copy link
Contributor

nija-at commented Mar 10, 2020

Ack.

There's a type issue here. The type for identitySources here should be string[].

I have a fix for this here - #6649

Once this is fixed, your code would look like -

new RequestAuthorizer(this, "myrequestauthorizer", new RequestAuthorizerProps {
    IdentitySources = new string[] {
        IdentitySource.Header("myheader")
    }
});

nija-at pushed a commit that referenced this issue Mar 10, 2020
)

The `identitySources` property in `RequestAuthorizerProps` was
incorrectly set to the type `IdentitySource[]` instead of `string[]`.
This caused a type mismatch in languages with stricter type checks, such
as C#.

Added to `allowed-breaking-changes.txt` since this property would never
have worked in Java and C#, and is [not a breaking change in 
typescript][1].

fixes #6538

[1]: https://github.com/aws/aws-cdk/blob/de1a36bb5d4c78e617f3b78a06b42dfbd45475dc/packages/%40aws-cdk/aws-apigateway/test/authorizers/integ.request-authorizer.ts#L26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-apigateway Related to Amazon API Gateway bug This issue is a bug. language/dotnet Related to .NET bindings p1
Projects
None yet
3 participants