The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

OIDC::Lite::Model::IDToken - model class that represents ID token

ACCESSORS

JWT Header

payload

JWT Payload

key

Key for JWT Signature

METHODS

new( \%header, \%payload, $key )

Constructor

my $id_token = OIDC::Lite::Model::IDToken->new();
...
my $id_token = OIDC::Lite::Model::IDToken->new(
    header  => \%header,
    payload => \%payload,
    key     => $key,
);

get_token_string()

generate signarure and return ID Token string.

my $id_token_string = $id_token->get_token_string();

access_token_hash()

generate signarure and return ID Token string.

$id_token->code_hash($access_token);

code_hash()

Set Authorization Code Hash to ID Token.

$id_token->code_hash($authorization_code);

load($token_string)

load ID Token object from token string

my $token_string = 'eyJhbGciOiJub25lIiwidHlwIjoiSldTIn0.eyJmb28iOiJiYXIifQ.';
my $id_token = OIDC::Lite::Model::IDToken->load($token_string);

verify()

verify token signature.

my $token_string = '...';
my $id_token = OIDC::Lite::Model::IDToken->load($token_string);

my $key = 'shared_secret_key';
$id_token->key($key);
unless($id_token->verify()){
    # validation failed
}

AUTHOR

Ryo Ito, <ritou.06@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2012 by Ryo Ito

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.