|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.dyuproject.oauth.Signature
public abstract class Signature
Signature - for signing and verification of oauth requests
Nested Class Summary | |
---|---|
static interface |
Signature.Listener
Listens on the encoding of every single oauth and request parameter. |
Field Summary | |
---|---|
static Signature |
HMACSHA1
"HMAC-SHA1" signature. |
static Signature |
PLAINTEXT
"PLAINTEXT" signature. |
static String[] |
REQUIRED_OAUTH_HEADERS_TO_SIGN
The default headers to sign - Constants.OAUTH_CONSUMER_KEY ,
Constants.OAUTH_NONCE , Constants.OAUTH_TIMESTAMP ,
Constants.OAUTH_SIGNATURE_METHOD |
Constructor Summary | |
---|---|
Signature()
|
Method Summary | |
---|---|
static String |
decode(String value)
Decodes the string via the oauth encoding Constants.ENCODING ;
The spec is RFC3986 which is basically a standard for URI encoding. |
static String |
encode(String value)
Encodes the string via the oauth encoding Constants.ENCODING ;
The spec is RFC3986 which is basically a standard for URI encoding. |
abstract void |
generate(UrlEncodedParameterMap params,
String consumerSecret,
Token token,
String httpMethod,
Signature.Listener listener,
StringBuilder oauthBuffer,
StringBuilder requestBuffer)
Generates a signature and puts it on the params based from the given params, consumer secret and token. |
static Signature |
get(String method)
Gets a signature based from the given method name. |
static String |
getBase(UrlEncodedParameterMap params,
String method)
Gets the computed base string to be signed - based from the given params and http method. |
protected String |
getBaseAndPutDefaults(UrlEncodedParameterMap params,
String httpMethod,
Signature.Listener listener,
StringBuilder oauthBuffer,
StringBuilder requestBuffer)
|
static String |
getKey(String consumerSecret,
String secret)
Gets the computed key based from the given secret keys. |
static String |
getMacSignature(String secretKey,
String base,
String algorithm)
Gets the computed mac signature from the given secret key, base string and algorithm. |
abstract String |
getMethod()
Gets the method name of the signature used. |
int |
hashCode()
|
static void |
register(Signature sig)
Registers a custom signature. |
abstract String |
sign(String consumerSecret,
String tokenSecret,
String base)
Returns the signature string based from the given consumer secret, token secret and base string. |
abstract boolean |
verify(String consumerSecret,
String tokenSecret,
String method,
UrlEncodedParameterMap params)
Verifies whether the params and method generates the same exact signature. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String[] REQUIRED_OAUTH_HEADERS_TO_SIGN
Constants.OAUTH_CONSUMER_KEY
,
Constants.OAUTH_NONCE
, Constants.OAUTH_TIMESTAMP
,
Constants.OAUTH_SIGNATURE_METHOD
public static final Signature PLAINTEXT
public static final Signature HMACSHA1
Constructor Detail |
---|
public Signature()
Method Detail |
---|
public static void register(Signature sig)
public static Signature get(String method)
method
name.
public static String encode(String value)
Constants.ENCODING
;
The spec is RFC3986 which is basically a standard for URI encoding.
public static String decode(String value)
Constants.ENCODING
;
The spec is RFC3986 which is basically a standard for URI encoding.
public static String getKey(String consumerSecret, String secret)
public static String getBase(UrlEncodedParameterMap params, String method)
public static String getMacSignature(String secretKey, String base, String algorithm)
public abstract String getMethod()
public int hashCode()
hashCode
in class Object
protected final String getBaseAndPutDefaults(UrlEncodedParameterMap params, String httpMethod, Signature.Listener listener, StringBuilder oauthBuffer, StringBuilder requestBuffer)
public abstract String sign(String consumerSecret, String tokenSecret, String base)
public abstract boolean verify(String consumerSecret, String tokenSecret, String method, UrlEncodedParameterMap params)
public abstract void generate(UrlEncodedParameterMap params, String consumerSecret, Token token, String httpMethod, Signature.Listener listener, StringBuilder oauthBuffer, StringBuilder requestBuffer)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |