Skip to content

add authorizer context to APIGatewayProxyRequestEvent #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public static class ProxyRequestContext implements Serializable, Cloneable {

private String path;

private Map<String, String> authorizer;

/**
* default constructor
*/
Expand Down Expand Up @@ -267,6 +269,19 @@ public ProxyRequestContext withPath(String path) {
return this;
}

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

public void setAuthorizer(Map<String, String> authorizer) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From aws/aws-lambda-dotnet#98, "authorizer" may contain more than just strings. To be truly generic, it might be that a APIGatewayAuthorizedProxyEvent<T> needs to be added.

this.authorizer = authorizer;
}

public ProxyRequestContext withAuthorizer(Map<String, String> authorizer) {
this.authorizer = authorizer;
return this;
}

/**
* Returns a string representation of this object; useful for testing and debugging.
*
Expand Down Expand Up @@ -296,6 +311,8 @@ public String toString() {
sb.append("apiId: ").append(getApiId()).append(",");
if (getPath() != null)
sb.append("path: ").append(getPath());
if (getAuthorizer() != null)
sb.append("authorizer: ").append(getAuthorizer().toString()).append(",");
sb.append("}");
return sb.toString();
}
Expand Down Expand Up @@ -346,6 +363,8 @@ public boolean equals(Object obj) {
return false;
if (other.getPath() != null && other.getPath().equals(this.getPath()) == false)
return false;
if (other.getAuthorizer() != null && other.getAuthorizer().equals(this.getAuthorizer()) == false)
return false;
return true;
}

Expand All @@ -363,6 +382,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