public class SAuthc1RequestAuthenticator extends Object implements RequestAuthenticator
| Modifier and Type | Field and Description |
|---|---|
static String |
ALGORITHM |
static String |
AUTHENTICATION_SCHEME |
static String |
AUTHORIZATION_HEADER |
static String |
DATE_FORMAT |
static String |
DEFAULT_ENCODING |
static String |
HOST_HEADER |
static String |
ID_TERMINATOR |
static String |
SAUTHC1_ID |
static String |
SAUTHC1_SIGNATURE |
static String |
SAUTHC1_SIGNED_HEADERS |
static String |
STORMAPTH_DATE_HEADER |
static String |
TIME_ZONE |
static String |
TIMESTAMP_FORMAT |
| Constructor and Description |
|---|
SAuthc1RequestAuthenticator() |
| Modifier and Type | Method and Description |
|---|---|
void |
authenticate(Request request,
ApiKey apiKey)
Implementations of this operation will prepare the authentication information as expected by the Stormpath API server.
|
void |
authenticate(Request request,
ApiKey apiKey,
Date date,
String nonce) |
protected String |
canonicalizeQueryString(Request request) |
protected String |
getRequestPayload(Request request) |
protected String |
getRequestPayloadWithoutQueryParams(Request request) |
protected byte[] |
hash(String text)
Hashes the string contents (assumed to be UTF-8) using the SHA-256
algorithm.
|
protected byte[] |
sign(byte[] data,
byte[] key,
MacAlgorithm algorithm) |
protected byte[] |
sign(String stringData,
byte[] key,
MacAlgorithm algorithm) |
static String |
toHex(byte[] data)
Converts byte data to a Hex-encoded string.
|
static byte[] |
toUtf8Bytes(String s) |
public static final String DEFAULT_ENCODING
public static final String HOST_HEADER
public static final String AUTHORIZATION_HEADER
public static final String STORMAPTH_DATE_HEADER
public static final String ID_TERMINATOR
public static final String ALGORITHM
public static final String AUTHENTICATION_SCHEME
public static final String SAUTHC1_ID
public static final String SAUTHC1_SIGNED_HEADERS
public static final String SAUTHC1_SIGNATURE
public static final String DATE_FORMAT
public static final String TIMESTAMP_FORMAT
public static final String TIME_ZONE
public void authenticate(Request request, ApiKey apiKey) throws RequestAuthenticationException
RequestAuthenticatorauthenticate in interface RequestAuthenticatorrequest - the request that will be sent to Stormpath API server, it shall be modified by the implementating classes
in order to insert here the authentication informationapiKey - provides the authentication data that will be used to create the proper authentication information for
the specific scheme the implementation defines.RequestAuthenticationException - when the authentication request cannot be createdpublic static byte[] toUtf8Bytes(String s)
public static String toHex(byte[] data)
data - data to hex encode.protected byte[] hash(String text) throws RequestAuthenticationException
text - The string to hash.RequestAuthenticationException - If the hash cannot be computed.protected byte[] sign(String stringData, byte[] key, MacAlgorithm algorithm) throws RequestAuthenticationException
RequestAuthenticationExceptionprotected byte[] sign(byte[] data,
byte[] key,
MacAlgorithm algorithm)
throws RequestAuthenticationException
RequestAuthenticationExceptionprotected String getRequestPayloadWithoutQueryParams(Request request)
Copyright © 2012–2014. All rights reserved.