Skip to content

Commit 9e27814

Browse files
avanathanbmoffatt
authored andcommitted
Adding authorizer field to collect context properties from authorizer (aws#77)
* Adding authorizer field to collect context properites from authorizer * Updating toString() method * Adding authorizer to equals() & hashCode() * Moving authorizer under ProxyRequestContext * Switching to Map<String, Object> for authorizer
1 parent dff7334 commit 9e27814

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

aws-lambda-java-events/src/main/java/com/amazonaws/services/lambda/runtime/events/APIGatewayProxyRequestEvent.java

+19-2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public static class ProxyRequestContext implements Serializable, Cloneable {
6060

6161
private String path;
6262

63+
private Map<String, Object> authorizer;
64+
6365
/**
6466
* default constructor
6567
*/
@@ -88,6 +90,14 @@ public ProxyRequestContext withAccountId(String accountId) {
8890
return this;
8991
}
9092

93+
public Map<String, Object> getAuthorizer() {
94+
return authorizer;
95+
}
96+
97+
public void setAuthorizer(final Map<String, Object> authorizer) {
98+
this.authorizer = authorizer;
99+
}
100+
91101
/**
92102
* @return API Gateway stage name
93103
*/
@@ -300,7 +310,9 @@ public String toString() {
300310
if (getApiId() != null)
301311
sb.append("apiId: ").append(getApiId()).append(",");
302312
if (getPath() != null)
303-
sb.append("path: ").append(getPath());
313+
sb.append("path: ").append(getPath()).append(",");
314+
if (getAuthorizer() != null)
315+
sb.append("authorizer: ").append(getAuthorizer().toString());
304316
sb.append("}");
305317
return sb.toString();
306318
}
@@ -351,6 +363,10 @@ public boolean equals(Object obj) {
351363
return false;
352364
if (other.getPath() != null && other.getPath().equals(this.getPath()) == false)
353365
return false;
366+
if (other.getAuthorizer() == null ^ this.getAuthorizer() == null)
367+
return false;
368+
if (other.getAuthorizer() != null && !other.getAuthorizer().equals(this.getAuthorizer()))
369+
return false;
354370
return true;
355371
}
356372

@@ -368,6 +384,7 @@ public int hashCode() {
368384
hashCode = prime * hashCode + ((getHttpMethod() == null) ? 0 : getHttpMethod().hashCode());
369385
hashCode = prime * hashCode + ((getApiId() == null) ? 0 : getApiId().hashCode());
370386
hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode());
387+
hashCode = prime * hashCode + ((getAuthorizer() == null) ? 0 : getAuthorizer().hashCode());
371388
return hashCode;
372389
}
373390

@@ -941,7 +958,7 @@ public APIGatewayProxyRequestEvent withMultiValueHeaders(Map<String, List<String
941958
this.setMultiValueHeaders(multiValueHeaders);
942959
return this;
943960
}
944-
961+
945962
/**
946963
* @return The query string parameters that were part of the request
947964
*/

0 commit comments

Comments
 (0)