org.springframework.security.oauth.common.signature
Class PlainTextSignatureMethod

java.lang.Object
  extended by org.springframework.security.oauth.common.signature.PlainTextSignatureMethod
All Implemented Interfaces:
OAuthSignatureMethod

public class PlainTextSignatureMethod
extends Object
implements OAuthSignatureMethod

Plain text signature method.

Author:
Ryan Heaton

Field Summary
static String SIGNATURE_NAME
          The name of this plain text signature method ("PLAINTEXT").
 
Constructor Summary
PlainTextSignatureMethod(String secret)
          Construct a plain text signature method with the given plain-text secret.
PlainTextSignatureMethod(String secret, org.springframework.security.authentication.encoding.PasswordEncoder encoder, Object salt)
          Construct a plain text signature method with the given plain-text secret.
 
Method Summary
 String getName()
          The name of this plain text signature method ("PLAINTEXT").
 String getSecret()
          The secret.
 String sign(String signatureBaseString)
          The signature is the same as the secret.
 void verify(String signatureBaseString, String signature)
          Validates that the signature is the same as the secret.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIGNATURE_NAME

public static final String SIGNATURE_NAME
The name of this plain text signature method ("PLAINTEXT").

See Also:
Constant Field Values
Constructor Detail

PlainTextSignatureMethod

public PlainTextSignatureMethod(String secret)
Construct a plain text signature method with the given plain-text secret.

Parameters:
secret - The secret.

PlainTextSignatureMethod

public PlainTextSignatureMethod(String secret,
                                org.springframework.security.authentication.encoding.PasswordEncoder encoder,
                                Object salt)
Construct a plain text signature method with the given plain-text secret.

Parameters:
secret - The secret.
encoder - The password encoder, or null if none is to be used.
salt - The salt for the secret, if any.
Method Detail

getName

public String getName()
The name of this plain text signature method ("PLAINTEXT").

Specified by:
getName in interface OAuthSignatureMethod
Returns:
The name of this plain text signature method.

sign

public String sign(String signatureBaseString)
The signature is the same as the secret.

Specified by:
sign in interface OAuthSignatureMethod
Parameters:
signatureBaseString - The signature base string (unimportant, ignored).
Returns:
The secret.

verify

public void verify(String signatureBaseString,
                   String signature)
            throws InvalidSignatureException
Validates that the signature is the same as the secret.

Specified by:
verify in interface OAuthSignatureMethod
Parameters:
signatureBaseString - The signature base string (unimportant, ignored).
signature - The signature.
Throws:
InvalidSignatureException - If the signature is not the same as the secret.

getSecret

public String getSecret()
The secret.

Returns:
The secret.


Copyright © 2012. All Rights Reserved.