public final class Signer
extends com.amazonaws.auth.AWS4Signer
AWS4Signer implementing the AWS Signature Version 4 algorithm.
Also contains a method for signature validation. The signatures that this class produces are
compatible with the original AWS SDK implementation.| Constructor and Description |
|---|
Signer()
No-args constructor.
|
| Modifier and Type | Method and Description |
|---|---|
javax.ws.rs.core.Response |
invokeSignedRequest(javax.ws.rs.client.Client apiClient,
String accessKey,
String secretKey,
String httpMethod,
String endpointURL,
String reqPath,
Map<String,String> headers,
javax.ws.rs.core.MultivaluedMap<String,String> params,
byte[] jsonEntity)
Builds, signs and executes a request to an API endpoint using the provided credentials.
|
javax.ws.rs.core.Response |
invokeSignedRequest(javax.ws.rs.client.Client apiClient,
String accessKey,
String secretKey,
String httpMethod,
String endpointURL,
String reqPath,
Map<String,String> headers,
javax.ws.rs.core.MultivaluedMap<String,String> params,
javax.ws.rs.client.Entity<?> entity)
Builds, signs and executes a request to an API endpoint using the provided credentials.
|
static Date |
parseAWSDate(String date)
Returns a parsed Date.
|
void |
sign(com.amazonaws.Request<?> request,
String accessKey,
String secretKey)
Signs a request using AWS signature V4.
|
Map<String,String> |
sign(String httpeMethod,
String endpoint,
String resourcePath,
Map<String,String> headers,
Map<String,String> params,
InputStream entity,
String accessKey,
String secretKey)
Signs a request using AWS signature V4.
|
Map<String,String> |
signRequest(String accessKey,
String secretKey,
String httpMethod,
String endpointURL,
String reqPath,
Map<String,String> headers,
javax.ws.rs.core.MultivaluedMap<String,String> params,
byte[] jsonEntity)
Builds and signs a request to an API endpoint using the provided credentials.
|
public Map<String,String> sign(String httpeMethod, String endpoint, String resourcePath, Map<String,String> headers, Map<String,String> params, InputStream entity, String accessKey, String secretKey)
httpeMethod - GET/POST/PUT... etc.endpoint - the hostname of the API serverresourcePath - the path of the resource (starting from root e.g. "/path/to/res")headers - the headers mapparams - the params mapentity - the entity object or nullaccessKey - the app's access keysecretKey - the app's secret keyAuthorization header.public void sign(com.amazonaws.Request<?> request,
String accessKey,
String secretKey)
request - the request instanceaccessKey - the app's access keysecretKey - the app's secret keypublic static Date parseAWSDate(String date)
date - a date in the AWS format yyyyMMdd'T'HHmmss'Z'public javax.ws.rs.core.Response invokeSignedRequest(javax.ws.rs.client.Client apiClient,
String accessKey,
String secretKey,
String httpMethod,
String endpointURL,
String reqPath,
Map<String,String> headers,
javax.ws.rs.core.MultivaluedMap<String,String> params,
javax.ws.rs.client.Entity<?> entity)
apiClient - Jersey Client objectaccessKey - access keysecretKey - secret keyhttpMethod - the method (GET, POST...)endpointURL - protocol://host:portreqPath - the API resource path relative to the endpointURLheaders - headers mapparams - parameters mapentity - an entity containing any Java object (payload), could be nullpublic javax.ws.rs.core.Response invokeSignedRequest(javax.ws.rs.client.Client apiClient,
String accessKey,
String secretKey,
String httpMethod,
String endpointURL,
String reqPath,
Map<String,String> headers,
javax.ws.rs.core.MultivaluedMap<String,String> params,
byte[] jsonEntity)
apiClient - Jersey Client objectaccessKey - access keysecretKey - secret keyhttpMethod - the method (GET, POST...)endpointURL - protocol://host:portreqPath - the API resource path relative to the endpointURLheaders - headers mapparams - parameters mapjsonEntity - an object serialized to JSON byte array (payload), could be nullpublic Map<String,String> signRequest(String accessKey, String secretKey, String httpMethod, String endpointURL, String reqPath, Map<String,String> headers, javax.ws.rs.core.MultivaluedMap<String,String> params, byte[] jsonEntity)
accessKey - access keysecretKey - secret keyhttpMethod - the method (GET, POST...)endpointURL - protocol://host:portreqPath - the API resource path relative to the endpointURLheaders - headers mapparams - parameters mapjsonEntity - an object serialized to JSON byte array (payload), could be nullCopyright © 2018 Erudika. All rights reserved.