Example usage for com.amazonaws SignableRequest getResourcePath

List of usage examples for com.amazonaws SignableRequest getResourcePath

Introduction

In this page you can find the example usage for com.amazonaws SignableRequest getResourcePath.

Prototype

String getResourcePath();

Source Link

Document

Returns the path to the resource being requested.

Usage

From source file:com.ibm.og.s3.v2.AWSV2Auth.java

License:Open Source License

@Override
public AuthenticatedRequest authenticate(final Request request) {
    checkNotNull(request);/*from   ww  w . j  a  va  2 s  . c  o m*/
    final String accessKeyId = checkNotNull(request.getContext().get(Context.X_OG_USERNAME));
    final String secretAccessKey = checkNotNull(request.getContext().get(Context.X_OG_PASSWORD));
    final AWSCredentials credentials = new BasicAWSCredentials(accessKeyId, secretAccessKey);

    final AuthenticatedHttpRequest authenticatedRequest = new AuthenticatedHttpRequest(request);
    final SignableRequest<Request> signableRequest = new SignableRequestAdapter(authenticatedRequest);

    final S3Signer signer = new S3Signer(signableRequest.getHttpMethod().toString(),
            signableRequest.getResourcePath());

    signer.sign(signableRequest, credentials);

    return authenticatedRequest;
}