Authen-NZRealMe

 view release on metacpan or  search on metacpan

lib/Authen/NZRealMe.pm  view on Meta::CPAN



sub _conf_dir {
    my($opt) = @_;

    if($opt->{conf_dir}) {
        $opt->{conf_dir} =~ s{/\z}{};
        return $opt->{conf_dir} if -d $opt->{conf_dir};
        die "Directory does not exist: $opt->{conf_dir}";
    }
    my $cmnd = (caller(1))[3];
    $cmnd =~ s/^.*::_dispatch_//;
    $cmnd =~ s/_/-/g;
    die "$cmnd command needs --conf-dir option\n";
}


sub init_readline {
    require Term::ReadLine;   # Was not needed until now

    my $term = Term::ReadLine->new('nzrealme');

lib/Authen/NZRealMe/Asserts.pm  view on Meta::CPAN


use Exporter qw(import);

our @EXPORT = qw();

our @EXPORT_OK = qw(
    assert_is_base64
);

sub _get_assert_caller {
    my(undef, $filename, $line) = caller(1);
    return "at $filename line $line\n";
}

sub assert_is_base64 {
    my($string, $name) = @_;

    if(my($char) = $string =~ m{([^\s=a-zA-Z0-9+/_-])}) {
        my $caller = _get_assert_caller();
        die "Unexpected character '$char' in $name - expected base64 $caller";
    }
}

1;

__END__

=head1 NAME

lib/Authen/NZRealMe/TokenGenerator.pm  view on Meta::CPAN

        sysread($fh, $bytes, $required - $cur, $cur)
            or die "Error reading from $random_device: $!";
    }
    return ('a'..'f')[rand(6)]  # id string must start with a letter
           . unpack('H*', $bytes);
}


sub weak_token {
    return ('a'..'f')[rand(6)]  # id string must start with a letter
           . md5_hex( join(',', "@_", caller(), time(), rand(), $$) );
}


1;

__END__

=head1 NAME

Authen::NZRealMe::TokenGenerator - generate SAML ID strings



( run in 0.371 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )