Unit test for samlBuildAuthnResponse
This commit is contained in:
parent
6f4ae3552c
commit
dfcb11f203
|
@ -11,7 +11,7 @@ BEGIN {
|
||||||
require 't/saml-lib.pm';
|
require 't/saml-lib.pm';
|
||||||
}
|
}
|
||||||
|
|
||||||
my $maintests = 25;
|
my $maintests = 27;
|
||||||
my $debug = 'error';
|
my $debug = 'error';
|
||||||
my ( $issuer, $sp, $res );
|
my ( $issuer, $sp, $res );
|
||||||
|
|
||||||
|
@ -144,6 +144,13 @@ SKIP: {
|
||||||
expectAutoPost( $res, 'auth.sp.com', '/saml/proxySingleSignOnPost',
|
expectAutoPost( $res, 'auth.sp.com', '/saml/proxySingleSignOnPost',
|
||||||
'SAMLResponse' );
|
'SAMLResponse' );
|
||||||
|
|
||||||
|
my $resp = expectSamlResponse($s);
|
||||||
|
like(
|
||||||
|
$resp,
|
||||||
|
qr/AuthnInstant="2000-01-01T00:00:01Z"/,
|
||||||
|
"Found AuthnInstant modified by hook"
|
||||||
|
);
|
||||||
|
|
||||||
$pdata_hash = expectPdata($res);
|
$pdata_hash = expectPdata($res);
|
||||||
is( $pdata_hash->{gotRequestHookCalled},
|
is( $pdata_hash->{gotRequestHookCalled},
|
||||||
1, 'samlGotRequestHookCalled called' );
|
1, 'samlGotRequestHookCalled called' );
|
||||||
|
|
|
@ -7,8 +7,17 @@ use constant hook => {
|
||||||
samlGotAuthnRequest => 'gotRequest',
|
samlGotAuthnRequest => 'gotRequest',
|
||||||
samlGenerateAuthnRequest => 'genRequest',
|
samlGenerateAuthnRequest => 'genRequest',
|
||||||
samlGotAuthnResponse => 'gotResponse',
|
samlGotAuthnResponse => 'gotResponse',
|
||||||
|
samlBuildAuthnResponse => 'genResponse',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sub genResponse {
|
||||||
|
my ( $self, $req, $login ) = @_;
|
||||||
|
use Test::More;
|
||||||
|
$login->response->Assertion->AuthnStatement->AuthnInstant(
|
||||||
|
"2000-01-01T00:00:01Z");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
sub gotRequest {
|
sub gotRequest {
|
||||||
my ( $self, $req, $login ) = @_;
|
my ( $self, $req, $login ) = @_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue