-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cognito with both username and email
- Loading branch information
Showing
26 changed files
with
1,087 additions
and
217 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2023 Matus Faro | ||
* Copyright 2024 Matus Faro | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -78,8 +78,8 @@ protected <T> AwsResponse<T> request(Class<T> bodyClazz, Given given) { | |
request.getRequestContext().setResourcePath(given.getPath()); | ||
request.getRequestContext().setHttpMethod(given.getMethod()); | ||
request.getRequestContext().setAuthorizer(new ApiGatewayAuthorizerContext()); | ||
request.getRequestContext().getAuthorizer().setPrincipalId(given.getUserEmail()); | ||
request.getRequestContext().getAuthorizer().setContextValue(AuthorizerConstants.CONTEXT_KEY_USER_EMAIL, String.join(",", given.getUserEmail())); | ||
request.getRequestContext().getAuthorizer().setPrincipalId(given.getUsername()); | ||
request.getRequestContext().getAuthorizer().setContextValue(AuthorizerConstants.CONTEXT_KEY_USERNAME, String.join(",", given.getUsername())); | ||
request.getRequestContext().getAuthorizer().setContextValue(AuthorizerConstants.CONTEXT_KEY_ORGANIZATION_NAMES, String.join(",", getOrganizationName())); | ||
Response response = RestAssured.given() | ||
.contentType("application/json") | ||
|
@@ -116,7 +116,7 @@ protected static class Given { | |
MediaType contentType; | ||
Object body; | ||
@Builder.Default | ||
String userEmail = "[email protected]"; | ||
String username = "username"; | ||
} | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2023 Matus Faro | ||
* Copyright 2024 Matus Faro | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
|
@@ -44,11 +44,11 @@ public enum TestType { | |
.path("/api/ping") | ||
.build(), | ||
"OK"), | ||
USER_EMAIL(Given.builder() | ||
.path("/api/user-email") | ||
.userEmail("expected.[email protected]") | ||
USERNAME(Given.builder() | ||
.path("/api/username") | ||
.username("expected.username") | ||
.build(), | ||
"expected.[email protected]"); | ||
"expected.username"); | ||
|
||
private final Given given; | ||
private final String expectedBody; | ||
|
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
Oops, something went wrong.