public class AwsVerifier extends SecretVerifier
Per the Amazon S3 specification the Date
header is required. If the
Date
header is missing or the request is older than the allowed time
limit, specified by the maxRequestAge
property, the request fails
verification.
RESULT_INVALID, RESULT_MISSING, RESULT_STALE, RESULT_UNKNOWN, RESULT_UNSUPPORTED, RESULT_VALID
Constructor and Description |
---|
AwsVerifier(LocalVerifier wrappedVerifier)
Creates a new HttpAwsS3Verifier instance.
|
AwsVerifier(LocalVerifier wrappedVerifier,
long maxRequestAge)
Creates a new HttpAwsS3Verifier instance.
|
Modifier and Type | Method and Description |
---|---|
protected String |
getIdentifier(Request request,
Response response)
Returns the user identifier portion of an Amazon S3 compatible
Authorization header. |
char[] |
getLocalSecret(String identifier)
Returns the local secret associated to a given identifier.
|
long |
getMaxRequestAge()
Returns the maximum age of a request, in milliseconds, before it is
considered stale.
|
protected char[] |
getSecret(Request request,
Response response)
Returns the signature portion of an Amazon S3 compatible
Authorization header. |
LocalVerifier |
getWrappedVerifier()
Returns the wrapped local secret verifier.
|
void |
setMaxRequestAge(long value)
Sets the maximum age of a request, in milliseconds, before it is
considered stale.
|
void |
setWrappedVerifier(LocalVerifier wrappedVerifier)
Sets the wrapped local secret verifier.
|
int |
verify(Request request,
Response response)
Verifies that the proposed secret is correct for the specified request.
|
int |
verify(String identifier,
char[] secret)
This function is not implemented because the authorization scheme
requires direct access to the request.
|
compare, createUser
public AwsVerifier(LocalVerifier wrappedVerifier)
wrappedVerifier
- The wrapped verifier containing local identifier/secret
couplespublic AwsVerifier(LocalVerifier wrappedVerifier, long maxRequestAge)
wrappedVerifier
- The wrapped verifier containing local identifier/secret
couplesmaxRequestAge
- The maximum age of a request, in milliseconds, before it is
considered staleprotected String getIdentifier(Request request, Response response)
Authorization
header.
An Amazon S3 compatible Authorization
header has the following
pattern.
Authorization: AWS id:signature
getIdentifier
in class SecretVerifier
request
- The request to inspect.response
- The response to inspect.public char[] getLocalSecret(String identifier)
identifier
- The identifier to lookup.public long getMaxRequestAge()
A negative or zero value indicates no age restriction. The default value is 15 minutes.
protected char[] getSecret(Request request, Response response)
Authorization
header.
An Amazon S3 compatible Authorization
header has the following
pattern.
Authorization: AWS id:signature
getSecret
in class SecretVerifier
request
- The request to inspect.response
- The response to inspect.public LocalVerifier getWrappedVerifier()
public void setMaxRequestAge(long value)
A negative or zero value indicates no age restriction. The default value is 15 minutes.
public void setWrappedVerifier(LocalVerifier wrappedVerifier)
wrappedVerifier
- The local secret verifier.public int verify(Request request, Response response)
SecretVerifier
ChallengeResponse.getSecret()
method and sets the User
instance of the
request's ClientInfo
if successful.verify
in interface Verifier
verify
in class SecretVerifier
request
- The request to inspect.response
- The response to inspect.public int verify(String identifier, char[] secret) throws IllegalArgumentException
verify(Request, Response)
.verify
in class SecretVerifier
identifier
- The user identifier to match.secret
- The provided secret to verify.IllegalArgumentException
Copyright © 2005–2019. All rights reserved.