OAuth::Lite::SignatureMethod - signature method base class


OAuth-Lite documentation  | view source Contained in the OAuth-Lite distribution.

Index


NAME

Top

OAuth::Lite::SignatureMethod - signature method base class

SYNOPSIS

Top

    say $signature_method_class->method_name;

    my $method = $signature_method_class->new(
        consumer_secret => $consumer_secret,
        token_secret    => $token_secret,
    );

    my $signature = $method->sign($text);

    if ($method->verify($text, $signature)) {
        say "valid signature";
    }




DESCRIPTION

Top

SignatureMethod base class. Create subclasses for arbitrary signature method inheriting this class.

METHODS

Top

build_body_hash($content)

Build body hash according to the spec http://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/drafts/4/spec.html

    my $hash = $method_class->build_body_hash($content);
    say $hash;

method_name($method_name)

Set signature method name. Use this in subclass.

    $method_class->method_name('HMAC-SHA1');
    say $method_class->method_name;

new(%params)

    my $method = $signature_method_class->new(
        consumer_secret => $consumer_secret,
        token_secret    => $token_secret,
    );

secrets_as_key

Returns consumer_secret and token_secret as encoded key format.

    my $key = $method->secrets_as_key;

sign($base_text)

Create signature from passed base text

This is an abstract method. Define this in subclass.

    my $signature = $method->sign($base_text);

verify($base_text, $signature)

Check if signature is valid with base text

    my $signature_is_valid = $method->verify($base_text, $signature);
    if ($signature_is_valid) {
        ...
    }

SEE ALSO

Top

OAuth::Lite::SignatureMethod::HMAC_SHA1 OAuth::Lite::SignatureMethod::PLAINTEXT OAuth::Lite::SignatureMethod::RSA_SHA1

AUTHOR

Top

Lyo Kato, lyo.kato _at_ gmail.com

COPYRIGHT AND LICENSE

Top


OAuth-Lite documentation  | view source Contained in the OAuth-Lite distribution.