Mojo-JWT
view release on metacpan or search on metacpan
return value is ignored, changes should be made to the instances
attributes directly. Since the "algorithm" has already been parsed, it
is available via the instance attribute as well.
encode
my $token = $jwt->encode;
Encode the data expressed in the instance attributes: "algorithm",
"claims", "expires", "not_before". Note that if the timing attributes
are given, they override existing keys in the "claims". Calling encode
immediately clears the "token" and upon completion sets it to the
result as well as returning it.
Note also that due to Perl's hash randomization, repeated encoding is
not guaranteed to result in the same encoded string. However any
encoded string will survive an encode/decode roundtrip.
header
my $header = $jwt->header;
Returns a hash reference representing the JWT header, constructed from
instance attributes (see "algorithm").
now
my $time = $jwt->now;
Returns the current time, currently implemented as the core time
function.
sign_hmac
my $signature = $jwt->sign_hmac($size, $payload);
Returns the HMAC SHA signature for the given size and payload. The
"secret" attribute is used as the symmetric key. The result is not yet
base64 encoded. This method is provided mostly for the purposes of
subclassing.
sign_rsa
my $signature = $jwt->sign_rsa($size, $payload);
Returns the RSA signature for the given size and payload. The "secret"
attribute is used as the private key. The result is not yet base64
encoded. This method is provided mostly for the purposes of
subclassing.
token
The most recently encoded or decoded token. Note that any attribute
modifications are not taken into account until "encode" is called
again.
verify_rsa
my $bool = $jwt->verify_rsa($size, $payload, $signature);
Returns true if the given RSA size algorithm validates the given
payload and signature. The "public" attribute is used as the public
key. This method is provided mostly for the purposes of subclassing.
SEE ALSO
Acme::JWT
JSON::WebToken
http://jwt.io/
SOURCE REPOSITORY
http://github.com/jberger/Mojo-JWT
AUTHOR
Joel Berger, <joel.a.berger@gmail.com>
CONTRIBUTORS
Christopher Raa (mishanti1)
Cameron Daniel (ccakes)
COPYRIGHT AND LICENSE
Copyright (C) 2015 by "AUTHOR" and "CONTRIBTORS".
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
( run in 2.296 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )