Experian-IDAuth

 view release on metacpan or  search on metacpan

lib/Experian/IDAuth.pm  view on Meta::CPAN

    my $obj = bless {}, $class;
    $obj->set($obj->defaults, %args);
    return $obj;
}

sub defaults {
    my $self = shift;
    return (
        username      => 'experian_user',
        password      => '?',
        private_key   => 'private_key',
        public_key    => 'public_key',
        members_url   => 'https://proveid.experian.com',
        api_uri       => 'http://corpwsdl.oneninetwo',
        api_proxy     => 'https://xml.proveid.experian.com/IDSearch.cfc',
        header_ns_url => 'http://xml.proveid.experian.com/xsd/Headers',
        folder        => '/tmp/proveid',

        # if you're using a logger,
        #logger     => Log::Log4per::get_logger,
    );

lib/Experian/IDAuth.pm  view on Meta::CPAN


    return 1;
}

# This is built based Section 3b on the Experian User Guide
sub _2fa_header {
    my $self = shift;

    my $loginid     = $self->{username};
    my $password    = $self->{password};
    my $private_key = $self->{private_key};
    my $public_key  = $self->{public_key};

    my $timestamp = time();

    my $hash = hmac_sha256_base64($loginid, $password, $timestamp, $private_key);

    # Digest::SHA doesn't pad it's outputs so we have to do it manually.
    while (length($hash) % 4) {
        $hash .= '=';
    }

    my $hmac_sig = $hash . '_' . $timestamp . '_' . $public_key;

    return SOAP::Header->name('head:Signature')->value($hmac_sig);
}



( run in 0.238 second using v1.01-cache-2.11-cpan-4d50c553e7e )