@@ -44,6 +44,10 @@ test_xml_attribute_ok(
4444test_xml_attribute_ok($xp ,
4545 ' /samlp:AuthnRequest/samlp:NameIDPolicy/@AllowCreate' , ' 1' );
4646
47+ test_xml_attribute_exists($xp , ' /samlp:AuthnRequest/@ForceAuthn' , 0);
48+
49+ test_xml_attribute_exists($xp , ' /samlp:AuthnRequest/@IsPassive' , 0);
50+
4751my $signer = Net::SAML2::XML::Sig-> new({
4852 key => ' t/sign-nopw-cert.pem' ,
4953 cert => ' t/sign-nopw-cert.pem' ,
@@ -56,4 +60,91 @@ ok($signed);
5660
5761my $verify = $signer -> verify($signed );
5862ok($verify );
63+
64+ $ar = Net::SAML2::Protocol::AuthnRequest-> new(
65+ issuer => ' http://some/sp' ,
66+ destination => ' http://some/idp' ,
67+ nameid_format => ' urn:oasis:names:tc:SAML:2.0:nameid-format:persistent' ,
68+ nameid_allow_create => 1,
69+ force_authn => ' 1' ,
70+ is_passive => ' 1'
71+
72+ );
73+
74+ isa_ok($ar , " Net::SAML2::Protocol::AuthnRequest" );
75+
76+ $xml = $ar -> as_xml;
77+
78+ $xp = get_xpath(
79+ $xml ,
80+ samlp => ' urn:oasis:names:tc:SAML:2.0:protocol' ,
81+ saml => ' urn:oasis:names:tc:SAML:2.0:assertion' ,
82+ );
83+
84+ test_xml_attribute_exists($xp , ' /samlp:AuthnRequest/@ForceAuthn' , 1);
85+ test_xml_attribute_ok($xp , ' /samlp:AuthnRequest/@ForceAuthn' , ' true' );
86+
87+ test_xml_attribute_exists($xp , ' /samlp:AuthnRequest/@IsPassive' , 1);
88+ test_xml_attribute_ok($xp , ' /samlp:AuthnRequest/@IsPassive' , ' true' );
89+
90+ $ar = Net::SAML2::Protocol::AuthnRequest-> new(
91+ issuer => ' http://some/sp' ,
92+ destination => ' http://some/idp' ,
93+ nameid_format => ' urn:oasis:names:tc:SAML:2.0:nameid-format:persistent' ,
94+ nameid_allow_create => 1,
95+ force_authn => ' 0' ,
96+ is_passive => ' 0'
97+
98+ );
99+
100+ isa_ok($ar , " Net::SAML2::Protocol::AuthnRequest" );
101+
102+ $xml = $ar -> as_xml;
103+
104+ $xp = get_xpath(
105+ $xml ,
106+ samlp => ' urn:oasis:names:tc:SAML:2.0:protocol' ,
107+ saml => ' urn:oasis:names:tc:SAML:2.0:assertion' ,
108+ );
109+
110+ test_xml_attribute_exists($xp , ' /samlp:AuthnRequest/@ForceAuthn' , 1);
111+ test_xml_attribute_ok($xp , ' /samlp:AuthnRequest/@ForceAuthn' , ' false' );
112+
113+ test_xml_attribute_exists($xp , ' /samlp:AuthnRequest/@IsPassive' , 1);
114+ test_xml_attribute_ok($xp , ' /samlp:AuthnRequest/@IsPassive' , ' false' );
115+
116+ my $sp = net_saml2_sp(
117+ authnreq_signed => 0,
118+ want_assertions_signed => 0,
119+ slo_url_post => ' /sls-post-response' ,
120+ slo_url_soap => ' /slo-soap' ,
121+ );
122+
123+ my %params = (
124+ force_authn => 1,
125+ is_passive => 0,
126+ );
127+
128+ my $req = $sp -> authn_request(
129+ $sp -> id,
130+ ' ' ,
131+ %params ,
132+ );
133+
134+ $xml = $req -> as_xml;
135+
136+ $xp = get_xpath(
137+ $xml ,
138+ samlp => ' urn:oasis:names:tc:SAML:2.0:protocol' ,
139+ saml => ' urn:oasis:names:tc:SAML:2.0:assertion' ,
140+ );
141+
142+ test_xml_attribute_exists($xp , ' /samlp:AuthnRequest/@ForceAuthn' , 1);
143+ test_xml_attribute_ok($xp , ' /samlp:AuthnRequest/@ForceAuthn' , ' true' );
144+
145+ test_xml_attribute_exists($xp , ' /samlp:AuthnRequest/@IsPassive' , 1);
146+ test_xml_attribute_ok($xp , ' /samlp:AuthnRequest/@IsPassive' , ' false' );
147+
148+ $xml = $ar -> as_xml;
149+
59150done_testing;
0 commit comments