@@ -55,6 +55,30 @@ def initialize; end
55
55
assert_equal "F1:3C:6B:80:90:5A:03:0E:6C:91:3E:5D:15:FA:DD:B0:16:45:48:72" , settings . idp_cert_fingerprint
56
56
end
57
57
58
+ it "extract SSO endpoint with no specific binding, it takes the first" do
59
+ idp_metadata_parser = OneLogin ::RubySaml ::IdpMetadataParser . new
60
+ idp_metadata = idp_metadata_descriptor3
61
+ settings = idp_metadata_parser . parse ( idp_metadata )
62
+ assert_equal "https://idp.example.com/idp/profile/Shibboleth/SSO" , settings . idp_sso_target_url
63
+ end
64
+
65
+ it "extract SSO endpoint with specific binding" do
66
+ idp_metadata_parser = OneLogin ::RubySaml ::IdpMetadataParser . new
67
+ idp_metadata = idp_metadata_descriptor3
68
+ options = { }
69
+ options [ :sso_binding ] = [ 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' ]
70
+ settings = idp_metadata_parser . parse ( idp_metadata , options )
71
+ assert_equal "https://idp.example.com/idp/profile/SAML2/POST/SSO" , settings . idp_sso_target_url
72
+
73
+ options [ :sso_binding ] = [ 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' ]
74
+ settings = idp_metadata_parser . parse ( idp_metadata , options )
75
+ assert_equal "https://idp.example.com/idp/profile/SAML2/Redirect/SSO" , settings . idp_sso_target_url
76
+
77
+ options [ :sso_binding ] = [ 'invalid_binding' , 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' ]
78
+ settings = idp_metadata_parser . parse ( idp_metadata , options )
79
+ assert_equal "https://idp.example.com/idp/profile/SAML2/Redirect/SSO" , settings . idp_sso_target_url
80
+ end
81
+
58
82
it "uses settings options as hash for overrides" do
59
83
idp_metadata_parser = OneLogin ::RubySaml ::IdpMetadataParser . new
60
84
idp_metadata = idp_metadata_descriptor
0 commit comments