Unable to invoke lambda when "Authorization scopes" added to JWT Authorizer

Offen
#408 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
38/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
aws, java, spring-boot

Rechercherichtung

Beginne damit, die Spring Boot 2 AWS Lambda hinter einem HTTP API JWT authorizer mit über SAM konfigurierten Scopes zu reproduzieren. Lies die in der Exception genannten Positionen von AwsProxyRequest, AwsProxyRequestContext und ApiGatewayAuthorizerContext und überprüfe anschließend, dass die Invocation sowohl erfolgreich ist, wenn der Wert von Scopes ein Array ist, als auch, wenn er null ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

need feedback

Serverless Java Container version: eg. 1.5.2

Implementations: Spring Boot 2

Framework version: eg SpringBoot 2.4.1

Frontend service: HTTP API

Deployment method: SAM

Scenario

Describe what you are trying to accomplish
I am trying to call invoke lambda via HTTP api with JWT authorizer. call to lambda are failing when i add "Authorization scopes" in the JWT authorizer(on HTTP api)

Expected behavior

I would expect lambda should be able to be invoke with or without Authorization scopes in JWT authorizer

Actual behavior

I am trying to call invoke lambda via HTTP api with JWT authorizer. call to lambda are failing when i add "Authorization scopes" in the JWT authorizer(on HTTP api) with error message

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token at [Source: (ByteArrayInputStream); line: 1, column: 3530] (through reference chain: com.amazonaws.serverless.proxy.model.AwsProxyRequest["requestContext"]->com.amazonaws.serverless.proxy.model.AwsProxyRequestContext["authorizer"]->com.amazonaws.serverless.proxy.model.ApiGatewayAuthorizerContext["scopes"])

but without "Authorization scopes" in the JWT authorizer(on HTTP api) calls were going fine as long JWT is valid

Steps to reproduce

Create a springboot 2 based AWS lambda with HTTP api and Authorization scope with scopes specified in it.

InputStream of call when Authorization scope is added contains a section with Scopes array but same is null when Authorization scope is not defined in JWT Authorizer in HTTP API

        "scopes": [
            "b",
            "a",
            "z",
            "y",
            "x"
        ]

InputStream of call when Authorization scope is not added

"scopes": null

Full log output

Paste the full log output from the Lambda function's CloudWatch logs

logs
Vorherrschende Sprache
Java
Sterne
1.6k
Forks
575
Ø Merge
1 T. 15 Std.
Gemergte PRs (30 T.)
12

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus aws/serverless-java-container

Alle Issues in aws/serverless-java-container

Ähnliche Issues

Weitere Issues zu Java

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.