Scroll to navigation

OAuth::Lite2::Signer(3pm) User Contributed Perl Documentation OAuth::Lite2::Signer(3pm)

NAME

OAuth::Lite2::Signer - OAuth 2.0 signature (DEPRECATED)

SYNOPSIS

    my $signed_params = OAuth::Lite2::Signer->sign(
        secret    => q{my_token_secret},
        algorithm => q{hmac-sha256},
        method    => q{GET},
        url       => q{http://example.org/protected/resource},
    );

DESCRIPTION

DEPRECATED. This is for old version of OAuth 2.0 draft specification.

This is for client to generate signed request, or for server to verify received request.

METHODS

sign( %params )

Returns the hash reference that includes parameters for OAuth 2.0 signed request.

    my $signed_params = OAuth::Lite2::Signer->sign(
        secret    => q{my_token_secret},
        algorithm => q{hmac-sha256},
        method    => q{GET},
        url       => q{http://example.org/protected/resource},
    );
Access token secret.
The algorithm what you make signature with.
HTTP method of the request.
URL of the request.
Optional. If you omit this, nonce string is automatically generate random string.
Optional. If you omit this, current timestamp is set.

normalize_string( %params )

Returns normalized string according to the specification.

host part of the url.
If you omit this, 80 is set by default.
Random string.
unix timestamp.
name of hmac hash algorithm.
HTTP method of the request.
URL of the request.

verify( %params )

Verify a signed request.

    unless ( OAuth::Lite2::Signer->verify( %params ) ) {
        $app->error("Invalid request");
    }
'signature' parameter of the received request.
The access token secret.
'algorithm' parameter of the received request.
HTTP method of the received request.
URL of the received request.
'nonce' parameter of the received request.
'timestamp' parameter of the received request.

AUTHOR

Lyo Kato, <lyo.kato@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Lyo Kato

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

2023-07-01 perl v5.36.0