I am new to learning AWS Lambda, and want to implement Authorizer for API gateway in Java. What is the method header for Request type Authorizers? This is what I have so far:
public class Authorize implements RequestHandler<Object, AuthPolicy> {
public AuthPolicy handleRequest(InputStream inputStream, OutputStream outputStream, Context context) throws IOException {
//Logic for Authorizer
return new AuthPolicy("xxxx", AuthPolicy.PolicyDocument.getAllowAllPolicy(System.getenv("AWS_REGION"), context.getIdentity().getIdentityId(), "GET", "1"));
}
}
I am returning AuthPolicy Object as given in AWS-labs example:
https://github.com/awslabs/aws-apigateway-lambda-authorizer-blueprints/blob/master/blueprints/java/src/example/APIGatewayAuthorizerHandler.java
The above structure is for token type, and I need request type. I am getting this error:
Authorizer result body before parsing
Execution failed due to configuration error: Invalid JSON in response:
Please help.