Skip to content

Commit

Permalink
Adding authorizer field to collect context properties from authorizer (
Browse files Browse the repository at this point in the history
…#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
  • Loading branch information
avanathan authored and bmoffatt committed Feb 21, 2019
1 parent dff7334 commit 9e27814
Showing 1 changed file with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public static class ProxyRequestContext implements Serializable, Cloneable {

private String path;

private Map<String, Object> authorizer;

/**
* default constructor
*/
Expand Down Expand Up @@ -88,6 +90,14 @@ public ProxyRequestContext withAccountId(String accountId) {
return this;
}

public Map<String, Object> getAuthorizer() {
return authorizer;
}

public void setAuthorizer(final Map<String, Object> authorizer) {
this.authorizer = authorizer;
}

/**
* @return API Gateway stage name
*/
Expand Down Expand Up @@ -300,7 +310,9 @@ public String toString() {
if (getApiId() != null)
sb.append("apiId: ").append(getApiId()).append(",");
if (getPath() != null)
sb.append("path: ").append(getPath());
sb.append("path: ").append(getPath()).append(",");
if (getAuthorizer() != null)
sb.append("authorizer: ").append(getAuthorizer().toString());
sb.append("}");
return sb.toString();
}
Expand Down Expand Up @@ -351,6 +363,10 @@ public boolean equals(Object obj) {
return false;
if (other.getPath() != null && other.getPath().equals(this.getPath()) == false)
return false;
if (other.getAuthorizer() == null ^ this.getAuthorizer() == null)
return false;
if (other.getAuthorizer() != null && !other.getAuthorizer().equals(this.getAuthorizer()))
return false;
return true;
}

Expand All @@ -368,6 +384,7 @@ public int hashCode() {
hashCode = prime * hashCode + ((getHttpMethod() == null) ? 0 : getHttpMethod().hashCode());
hashCode = prime * hashCode + ((getApiId() == null) ? 0 : getApiId().hashCode());
hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode());
hashCode = prime * hashCode + ((getAuthorizer() == null) ? 0 : getAuthorizer().hashCode());
return hashCode;
}

Expand Down Expand Up @@ -941,7 +958,7 @@ public APIGatewayProxyRequestEvent withMultiValueHeaders(Map<String, List<String
this.setMultiValueHeaders(multiValueHeaders);
return this;
}

/**
* @return The query string parameters that were part of the request
*/
Expand Down

0 comments on commit 9e27814

Please sign in to comment.