org.glassfish.jersey.oauth1.signature
Class HmaSha1Method

java.lang.Object
  extended by org.glassfish.jersey.oauth1.signature.HmaSha1Method
All Implemented Interfaces:
OAuth1SignatureMethod

public final class HmaSha1Method
extends Object
implements OAuth1SignatureMethod

An OAuth signature method that implements HMAC-SHA1.

Author:
Hubert A. Le Van Gong , Paul C. Bryan

Field Summary
static String NAME
           
 
Constructor Summary
HmaSha1Method()
           
 
Method Summary
 String name()
          Returns the name of this signature method, as negotiated through the OAuth protocol.
 String sign(String baseString, OAuth1Secrets secrets)
          Generates the HMAC-SHA1 signature of OAuth request elements.
 boolean verify(String elements, OAuth1Secrets secrets, String signature)
          Verifies the HMAC-SHA1 signature of OAuth request elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
See Also:
Constant Field Values
Constructor Detail

HmaSha1Method

public HmaSha1Method()
Method Detail

name

public String name()
Description copied from interface: OAuth1SignatureMethod
Returns the name of this signature method, as negotiated through the OAuth protocol.

Specified by:
name in interface OAuth1SignatureMethod
Returns:
Signature method name.

sign

public String sign(String baseString,
                   OAuth1Secrets secrets)
Generates the HMAC-SHA1 signature of OAuth request elements.

Specified by:
sign in interface OAuth1SignatureMethod
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(String elements,
                      OAuth1Secrets secrets,
                      String signature)
Verifies the HMAC-SHA1 signature of OAuth request elements.

Specified by:
verify in interface OAuth1SignatureMethod
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.


Copyright © 2007-2014, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.