@@ -285,7 +285,7 @@ my $sp_pub = $t->read_file('sp.example.com.crt');
285
285
my $js_filename = ' saml_sp.js' ;
286
286
$t -> write_file($js_filename , read_file(" ../$js_filename " ));
287
287
288
- $t -> try_run(' no njs available' )-> plan(132 );
288
+ $t -> try_run(' no njs available' )-> plan(134 );
289
289
290
290
my $api_version = (sort { $a <=> $b } @{ api() })[-1];
291
291
my $kv = " /api/$api_version /http/keyvals" ;
@@ -393,7 +393,7 @@ like($r, qr{302.*http://sp.example.com:8080/foo\?a=b}s,
393
393
like(get(" $kv /saml_response_id" ), qr / "_nginx_[^"]+":\s *"1"/ ,
394
394
' kv response id' );
395
395
like(get(" $kv /saml_name_id" ), qr / user1/ , ' kv response name id' );
396
- like(get(" $kv /saml_name_id_format" ), qr /unspecified / ,
396
+ like(get(" $kv /saml_name_id_format" ), qr /emailAddress / ,
397
397
' kv response name id format' );
398
398
like(get(" $kv /saml_session_index" ), qr / _nginx_sessionindex_/ ,
399
399
' kv response session index' );
@@ -654,6 +654,8 @@ is($r->{Destination}, $cfg->{saml_idp_slo_url},
654
654
is($r -> {Issuer }, $cfg -> {saml_sp_entity_id }, ' sp logout request issuer' );
655
655
is($r -> {isSigned }, 0, ' sp logout request unsigned' );
656
656
is($r -> {NameID }, ' user1' , ' sp logout request nameid' );
657
+ is($r -> {NameIDFormat }, ' urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress' ,
658
+ ' sp logout request nameid format' );
657
659
like(get(" $kv /saml_request_id" ), qr / "$r ->{ID}":"1"/ ,
658
660
' sp logout request id redeemed' );
659
661
@@ -764,6 +766,12 @@ $r = parse_response(modify_saml_obj($xml_obj, '//saml:NameID', 'text', 'foo',
764
766
is($r -> {StatusCode }, ' urn:oasis:names:tc:SAML:2.0:status:Requester' ,
765
767
' idp logout request wrong nameid' );
766
768
769
+ $r = parse_response(modify_saml_obj($xml_obj , ' //saml:NameID' ,
770
+ ' Format' , ' urn:oasis:names:tc:SAML:2.0:nameid-format:transient' ,
771
+ auth_token => $auth_token ));
772
+ is($r -> {StatusCode }, ' urn:oasis:names:tc:SAML:2.0:status:Requester' ,
773
+ ' idp logout request wrong nameid format' );
774
+
767
775
# Logout Response
768
776
769
777
($r , undef ) = init_slo($cfg , relay_state => ' /foo?a=b' );
@@ -960,6 +968,11 @@ sub extract_saml_attributes {
960
968
$result -> {isSigned } = 0;
961
969
}
962
970
971
+ my ($name_id_node ) = $xpc -> findnodes(' //saml:NameID' );
972
+ if ($name_id_node ) {
973
+ $result -> {NameIDFormat } = $name_id_node -> getAttribute(' Format' );
974
+ }
975
+
963
976
my ($name_id_policy_node ) = $xpc -> findnodes(' //samlp:NameIDPolicy' );
964
977
if ($name_id_policy_node ) {
965
978
$result -> {NameIDPolicyFormat } =
@@ -1563,7 +1576,7 @@ END_XML
1563
1576
$signature
1564
1577
<saml:Subject>
1565
1578
<saml:NameID SPNameQualifier=""
1566
- Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified "
1579
+ Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress "
1567
1580
>user1</saml:NameID>
1568
1581
<saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
1569
1582
<saml:SubjectConfirmationData NotOnOrAfter=""
0 commit comments