Skip to content

Commit

Permalink
Removed TODO comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mbfreder committed Jun 12, 2023
1 parent a71db17 commit 8d0882e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public String getAuthenticationScheme() {
if (event.getRequestContext().getAuthorizer() == null) {
return null;
}
if (event.getRequestContext().getAuthorizer().getJwt() != null) { //TODO: Confirm
if (event.getRequestContext().getAuthorizer().getJwt() != null) {
return AUTH_SCHEME_JWT;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public Principal getUserPrincipal() {
if (getAuthenticationScheme().equals(AUTH_SCHEME_CUSTOM) || getAuthenticationScheme().equals(AUTH_SCHEME_AWS_IAM)) {
return () -> {
if (getAuthenticationScheme().equals(AUTH_SCHEME_CUSTOM)) {
return event.getRequestContext().getAuthorizer().get("principalId").toString(); // TODO: Check later
return event.getRequestContext().getAuthorizer().get("principalId").toString();
} else if (getAuthenticationScheme().equals(AUTH_SCHEME_AWS_IAM)) {
// if we received credentials from Cognito Federated Identities then we return the identity id
if (event.getRequestContext().getIdentity().getCognitoIdentityId() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public HttpServletRequest readRequest(ApplicationLoadBalancerRequestEvent reques
}

request.setPath(stripBasePath(request.getPath(), config));
if (request.getMultiValueHeaders() != null && request.getMultiValueHeaders().get(HttpHeaders.CONTENT_TYPE) != null && request.getMultiValueHeaders().get(HttpHeaders.CONTENT_TYPE).get(0) != null) { //TODO: check
if (request.getMultiValueHeaders() != null && request.getMultiValueHeaders().get(HttpHeaders.CONTENT_TYPE) != null && request.getMultiValueHeaders().get(HttpHeaders.CONTENT_TYPE).get(0) != null) {
String contentType = request.getMultiValueHeaders().get(HttpHeaders.CONTENT_TYPE).get(0);
// put single as we always expect to have one and only one content type in a request.
request.getMultiValueHeaders().put(HttpHeaders.CONTENT_TYPE, new ArrayList<>(Arrays.asList(getContentTypeWithCharset(contentType, config))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public String getQueryString() {
return this.generateQueryString(
request.getMultiValueQueryStringParameters(),
// ALB does not automatically decode parameters, so we don't want to re-encode them
true, //request.getRequestSource() != RequestSource.ALB, TODO: check
true,
config.getUriEncoding());
} catch (ServletException e) {
log.error("Could not generate query string", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public HttpServletRequest readRequest(APIGatewayProxyRequestEvent request, Secur
}

request.setPath(stripBasePath(request.getPath(), config));
if (request.getMultiValueHeaders() != null && request.getMultiValueHeaders().get(HttpHeaders.CONTENT_TYPE) != null && request.getMultiValueHeaders().get(HttpHeaders.CONTENT_TYPE).get(0) != null) { //TODO: check
if (request.getMultiValueHeaders() != null && request.getMultiValueHeaders().get(HttpHeaders.CONTENT_TYPE) != null && request.getMultiValueHeaders().get(HttpHeaders.CONTENT_TYPE).get(0) != null) {
String contentType = request.getMultiValueHeaders().get(HttpHeaders.CONTENT_TYPE).get(0);
// put single as we always expect to have one and only one content type in a request.
request.getMultiValueHeaders().put(HttpHeaders.CONTENT_TYPE, new ArrayList<>(Arrays.asList(getContentTypeWithCharset(contentType, config))));
Expand All @@ -62,7 +62,6 @@ public HttpServletRequest readRequest(APIGatewayProxyRequestEvent request, Secur
servletRequest.setAttribute(API_GATEWAY_CONTEXT_PROPERTY, request.getRequestContext());
servletRequest.setAttribute(API_GATEWAY_STAGE_VARS_PROPERTY, request.getStageVariables());
servletRequest.setAttribute(API_GATEWAY_EVENT_PROPERTY, request);
//servletRequest.setAttribute(ALB_CONTEXT_PROPERTY, request.getRequestContext().getElb()); TODO: elb
servletRequest.setAttribute(LAMBDA_CONTEXT_PROPERTY, lambdaContext);
servletRequest.setAttribute(JAX_SECURITY_CONTEXT_PROPERTY, securityContext);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void deserialize_singleValuedHeaders() throws IOException {
ApplicationLoadBalancerRequestEvent req =
new AwsProxyRequestBuilder().fromJsonString(getSingleValueRequestJson()).toAlbRequest();

assertThat(req.getHeaders().get("accept"), is("*")); //TODO: Move this to alb specific test file, if any.
assertThat(req.getHeaders().get("accept"), is("*"));
}

/**
Expand Down

0 comments on commit 8d0882e

Please sign in to comment.