Authen::NZRealMe::TokenGenerator - generate SAML ID strings
This class is responsible for generating random ID tokens such as:
e5111f121b7b5f8533d18d98e1ec8ade294c62cc3
Although the methods are described below, the preferred way to use this class is via the ServiceProvider:
$sp->generate_saml_id( args );
Any arguments provided will be ignored if strong_token is used (see below) or will be passed to weak_token for the fallback implementation.
strong_token
weak_token
Constructor. Should not be called directly. Instead, call:
Authen::NZRealMe->token_generator();
Generates and returns a hex-encoded random token (guaranteed to start with a letter) using strong_token if possible and weak_token otherwise.
On systems where the device /dev/urandom is available, it will be used. This method will read 20 bytes from the random device and return a hex-encoded representation of those bytes.
Otherwise, returns undef.
Will be called if strong_token is not able to find a strong source of random data. As this method uses Perl's built-in rand function, which is not a cryptographically strong source of randomness, its use should be avoided.
rand
If your platform does not provide /dev/urandom, you are advised to use the Authen::NZRealMe->register_class method to provide an alternative implementation for 'token_generator'.
Authen::NZRealMe->register_class
'token_generator'
See Authen::NZRealMe for documentation index.
Copyright (c) 2014-2022 Enrolment Services, New Zealand Electoral Commission
Written by Grant McLean <grant@catalyst.net.nz>
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Authen::NZRealMe, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Authen::NZRealMe
CPAN shell
perl -MCPAN -e shell install Authen::NZRealMe
For more information on module installation, please visit the detailed CPAN module installation guide.