Class HmaSha1Method
- java.lang.Object
-
- org.glassfish.jersey.oauth1.signature.HmaSha1Method
-
- All Implemented Interfaces:
OAuth1SignatureMethod
public final class HmaSha1Method extends java.lang.Object implements OAuth1SignatureMethod
An OAuth signature method that implements HMAC-SHA1.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NAME
private static java.lang.String
SIGNATURE_ALGORITHM
-
Constructor Summary
Constructors Constructor Description HmaSha1Method()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
name()
Returns the name of this signature method, as negotiated through the OAuth protocol.java.lang.String
sign(java.lang.String baseString, OAuth1Secrets secrets)
Generates the HMAC-SHA1 signature of OAuth request elements.boolean
verify(java.lang.String elements, OAuth1Secrets secrets, java.lang.String signature)
Verifies the HMAC-SHA1 signature of OAuth request elements.
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
SIGNATURE_ALGORITHM
private static final java.lang.String SIGNATURE_ALGORITHM
- See Also:
- Constant Field Values
-
-
Method Detail
-
name
public java.lang.String name()
Description copied from interface:OAuth1SignatureMethod
Returns the name of this signature method, as negotiated through the OAuth protocol.- Specified by:
name
in interfaceOAuth1SignatureMethod
- Returns:
- Signature method name.
-
sign
public java.lang.String sign(java.lang.String baseString, OAuth1Secrets secrets)
Generates the HMAC-SHA1 signature of OAuth request elements.- Specified by:
sign
in interfaceOAuth1SignatureMethod
- Parameters:
baseString
- the combined OAuth elements to sign.secrets
- the shared secrets used to sign the request.- Returns:
- the OAuth signature, in base64-encoded form.
-
verify
public boolean verify(java.lang.String elements, OAuth1Secrets secrets, java.lang.String signature)
Verifies the HMAC-SHA1 signature of OAuth request elements.- Specified by:
verify
in interfaceOAuth1SignatureMethod
- Parameters:
elements
- OAuth elements signature is to be verified against.secrets
- the shared secrets for verifying the signature.signature
- base64-encoded OAuth signature to be verified.- Returns:
- true if the signature matches the secrets and data.
-
-