aws / aws/serverless-java-container
Unable to invoke lambda when "Authorization scopes" added to JWT Authorizer
- 主要語言
- Java
- 星號
- 1.6k
- 分支
- 574
- PR 合併指標
- 30 天內沒有已合併 PR
描述
*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
```
貢獻指南
研究方向
先重現透過 SAM 設定 Scopes、位於 HTTP API JWT authorizer 後方的 Spring Boot 2 AWS Lambda。讀取例外中指出的 AwsProxyRequest、AwsProxyRequestContext 和 ApiGatewayAuthorizerContext 位置,然後驗證 Scopes 的值為陣列以及為 null 時 invocation 都能成功。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- aws, java, spring-boot
- 領域
- api, authentication, cloud
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100