-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44907 from mcruzdev/config-mapping-lambda
Convert Lambda REST and HTTP to @ConfigMapping
- Loading branch information
Showing
18 changed files
with
44 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
...ent/src/main/java/io/quarkus/amazon/lambda/http/deployment/LambdaHttpBuildTimeConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
package io.quarkus.amazon.lambda.http.deployment; | ||
|
||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithDefault; | ||
|
||
@ConfigRoot | ||
public class LambdaHttpBuildTimeConfig { | ||
@ConfigMapping(prefix = "quarkus.lambda-http") | ||
public interface LambdaHttpBuildTimeConfig { | ||
/** | ||
* Enable security mechanisms to process lambda and AWS based security (i.e. Cognito, IAM) from | ||
* the http event sent from API Gateway | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
public boolean enableSecurity; | ||
@WithDefault("false") | ||
boolean enableSecurity(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 12 additions & 10 deletions
22
...zon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,36 @@ | ||
package io.quarkus.amazon.lambda.http; | ||
|
||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithDefault; | ||
|
||
@ConfigRoot(phase = ConfigPhase.RUN_TIME) | ||
public class LambdaHttpConfig { | ||
@ConfigMapping(prefix = "quarkus.lambda-http") | ||
public interface LambdaHttpConfig { | ||
|
||
/** | ||
* If true, Quarkus will map claims from Cognito to Quarkus security roles. | ||
* The "cognito:groups" claim will be used by default. Change cognitoRoleClaim | ||
* config value to change the claim source. | ||
* | ||
* <p> | ||
* True by default | ||
*/ | ||
@ConfigItem(defaultValue = "true") | ||
public boolean mapCognitoToRoles; | ||
@WithDefault("true") | ||
boolean mapCognitoToRoles(); | ||
|
||
/** | ||
* Cognito claim that contains roles you want to map. Defaults to "cognito:groups" | ||
*/ | ||
@ConfigItem(defaultValue = "cognito:groups") | ||
public String cognitoRoleClaim; | ||
@WithDefault("cognito:groups") | ||
String cognitoRoleClaim(); | ||
|
||
/** | ||
* Regular expression to locate role values within a Cognito claim string. | ||
* By default it looks for space delimited strings enclosed in brackets | ||
* By default, it looks for space delimited strings enclosed in brackets | ||
* "[^\[\] \t]+" | ||
*/ | ||
@ConfigItem(defaultValue = "[^\\[\\] \\t]+") | ||
public String cognitoClaimMatcher; | ||
@WithDefault(value = "[^\\[\\] \\t]+") | ||
String cognitoClaimMatcher(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
...ent/src/main/java/io/quarkus/amazon/lambda/http/deployment/LambdaHttpBuildTimeConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
package io.quarkus.amazon.lambda.http.deployment; | ||
|
||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithDefault; | ||
|
||
@ConfigRoot | ||
public class LambdaHttpBuildTimeConfig { | ||
@ConfigMapping(prefix = "quarkus.lambda-http") | ||
public interface LambdaHttpBuildTimeConfig { | ||
/** | ||
* Enable security mechanisms to process lambda and AWS based security (i.e. Cognito, IAM) from | ||
* the http event sent from API Gateway | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
public boolean enableSecurity; | ||
@WithDefault("false") | ||
boolean enableSecurity(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 11 additions & 9 deletions
20
...zon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
package io.quarkus.amazon.lambda.http; | ||
|
||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithDefault; | ||
|
||
@ConfigRoot(phase = ConfigPhase.RUN_TIME) | ||
public class LambdaHttpConfig { | ||
@ConfigMapping(prefix = "quarkus.lambda-http") | ||
public interface LambdaHttpConfig { | ||
|
||
/** | ||
* If true, runtime will search Cognito JWT claims for "cognito:groups" | ||
* and add them as Quarkus security roles. | ||
* | ||
* True by default | ||
*/ | ||
@ConfigItem(defaultValue = "true") | ||
public boolean mapCognitoToRoles; | ||
@WithDefault("true") | ||
boolean mapCognitoToRoles(); | ||
|
||
/** | ||
* Cognito claim that contains roles you want to map. Defaults to "cognito:groups" | ||
*/ | ||
@ConfigItem(defaultValue = "cognito:groups") | ||
public String cognitoRoleClaim; | ||
@WithDefault("cognito:groups") | ||
String cognitoRoleClaim(); | ||
|
||
/** | ||
* Regular expression to locate role values within a Cognito claim string. | ||
* By default it looks for space delimited strings enclosed in brackets | ||
* By default, it looks for space delimited strings enclosed in brackets | ||
* "[^\[\] \t]+" | ||
*/ | ||
@ConfigItem(defaultValue = "[^\\[\\] \\t]+") | ||
public String cognitoClaimMatcher; | ||
@WithDefault("[^\\[\\] \\t]+") | ||
String cognitoClaimMatcher(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters