com.amazonaws.SignableRequest Java Examples

The following examples show how to use com.amazonaws.SignableRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KinesisVideoAWS4Signer.java    From amazon-kinesis-video-streams-producer-sdk-java with Apache License 2.0 5 votes vote down vote up
@Override
protected String calculateContentHash(final SignableRequest<?> request) {
    if (shouldAddContentUnsignedPayloadInHeader(request.getHttpMethod().name())) {
        return CONTENT_UNSIGNED_PAYLOAD;
    }
    return  super.calculateContentHash(request);
}
 
Example #2
Source File: KinesisVideoAWS4Signer.java    From amazon-kinesis-video-streams-producer-sdk-java with Apache License 2.0 5 votes vote down vote up
@Override
public void sign(final HttpClient httpClient) {
    setServiceName(mConfiguration.getServiceName());
    setRegionName(mConfiguration.getRegion());

    final SignableRequest signableRequest = toSignableRequest(httpClient);
    final AWSCredentials credentials = mAWSCredentialsProvider.getCredentials();

    sign(signableRequest, credentials);
    // TODO: Implement logging
    httpClient.getHeaders().put(AUTH_HEADER, (String) signableRequest.getHeaders().get(AUTH_HEADER));
    httpClient.getHeaders().put(DATE_HEADER, (String) signableRequest.getHeaders().get(DATE_HEADER));
    addSecurityToken(httpClient, signableRequest);
    addContentHeader(httpClient);

}
 
Example #3
Source File: CognitoAuthorizer.java    From realworld-serverless-application with Apache License 2.0 4 votes vote down vote up
/**
 * @see RequestSigner#sign(SignableRequest)
 */
@Override
default void sign(SignableRequest<?> request) {
    request.addHeader("Authorization", generateToken(request));
}
 
Example #4
Source File: CognitoAuthorizer.java    From realworld-serverless-application with Apache License 2.0 4 votes vote down vote up
/**
 * @see RequestSigner#sign(SignableRequest)
 */
@Override
default void sign(SignableRequest<?> request) {
  request.addHeader("Authorization", generateToken(request));
}
 
Example #5
Source File: AWSRequestSigningApacheInterceptorTest.java    From aws-request-signing-apache-interceptor with Apache License 2.0 4 votes vote down vote up
@Override
public void sign(SignableRequest<?> request, AWSCredentials credentials) {
    request.addHeader(name, value);
    request.addHeader("resourcePath", request.getResourcePath());
}
 
Example #6
Source File: KinesisVideoAWS4Signer.java    From amazon-kinesis-video-streams-producer-sdk-java with Apache License 2.0 4 votes vote down vote up
public SignableRequest<?> toSignableRequest(final HttpClient httpClient) {
    return new SimpleSignableRequest(httpClient);
}
 
Example #7
Source File: KinesisVideoAWS4Signer.java    From amazon-kinesis-video-streams-producer-sdk-java with Apache License 2.0 4 votes vote down vote up
private void addSecurityToken(final HttpClient httpClient, final SignableRequest signableRequest) {
    final Object securityToken = signableRequest.getHeaders().get(SECURITY_TOKEN_HEADER);
    if (securityToken != null) {
        httpClient.getHeaders().put(SECURITY_TOKEN_HEADER, (String) securityToken);
    }
}