Commit d86ee7d 1 parent f43b388 commit d86ee7d Copy full SHA for d86ee7d
File tree 3 files changed +60
-2
lines changed
3 files changed +60
-2
lines changed Original file line number Diff line number Diff line change @@ -143,8 +143,8 @@ class OneLogin_Saml2_Auth
143
143
/**
144
144
* Initializes the SP SAML instance.
145
145
*
146
- * @param array|object|null $oldSettings Setting data (You can provide a OneLogin_Saml_Settings, the settings object of the Saml folder implementation)
147
- * @param bool $spValidationOnly if you only as an SP , you should set it to false if not you should set it to true
146
+ * @param array|object|null $oldSettings Setting data (You can provide a OneLogin_Saml_Settings, the settings object of the Saml folder implementation)
147
+ * @param bool $spValidationOnly If true, The library will only validate the SAML SP settings
148
148
*
149
149
* @throws OneLogin_Saml2_Error
150
150
*/
Original file line number Diff line number Diff line change @@ -39,6 +39,35 @@ public function testGetSettings()
39
39
$ this ->assertEquals ($ authSettings , $ settings );
40
40
}
41
41
42
+ /**
43
+ * Tests the use of the spValidationOnly at OneLogin_Saml2_Auth
44
+ *
45
+ * @covers OneLogin_Saml2_Auth
46
+ */
47
+ public function testSpValidateOnly ()
48
+ {
49
+ $ settingsDir = TEST_ROOT .'/settings/ ' ;
50
+ include $ settingsDir .'settings2.php ' ;
51
+ unset($ settingsInfo ['idp ' ]);
52
+
53
+ $ auth = new OneLogin_Saml2_Auth ($ settingsInfo , true );
54
+ $ this ->assertEmpty ($ auth ->getErrors ());
55
+
56
+ try {
57
+ $ auth2 = new OneLogin_Saml2_Auth ($ settingsInfo , false );
58
+ $ this ->fail ('Error was not raised ' );
59
+ } catch (OneLogin_Saml2_Error $ e ) {
60
+ $ this ->assertContains ('idp_not_found ' , $ e ->getMessage ());
61
+ }
62
+
63
+ try {
64
+ $ auth3 = new OneLogin_Saml2_Auth ($ settingsInfo );
65
+ $ this ->fail ('Error was not raised ' );
66
+ } catch (OneLogin_Saml2_Error $ e ) {
67
+ $ this ->assertContains ('idp_not_found ' , $ e ->getMessage ());
68
+ }
69
+ }
70
+
42
71
/**
43
72
* Tests the getLastRequestID method of the OneLogin_Saml2_Auth class
44
73
*
Original file line number Diff line number Diff line change @@ -74,6 +74,35 @@ public function testLoadSettingsFromFile()
74
74
$ this ->assertEmpty ($ settings ->getErrors ());
75
75
}
76
76
77
+ /**
78
+ * Tests the use of the spValidationOnly at OneLogin_Saml2_Settings
79
+ *
80
+ * @covers OneLogin_Saml2_Settings
81
+ */
82
+ public function testSpValidateOnly ()
83
+ {
84
+ $ settingsDir = TEST_ROOT .'/settings/ ' ;
85
+ include $ settingsDir .'settings2.php ' ;
86
+ unset($ settingsInfo ['idp ' ]);
87
+
88
+ $ settings = new OneLogin_Saml2_Settings ($ settingsInfo , true );
89
+ $ this ->assertEmpty ($ settings ->getErrors ());
90
+
91
+ try {
92
+ $ settings2 = new OneLogin_Saml2_Settings ($ settingsInfo , false );
93
+ $ this ->fail ('Error was not raised ' );
94
+ } catch (OneLogin_Saml2_Error $ e ) {
95
+ $ this ->assertContains ('idp_not_found ' , $ e ->getMessage ());
96
+ }
97
+
98
+ try {
99
+ $ settings3 = new OneLogin_Saml2_Settings ($ settingsInfo );
100
+ $ this ->fail ('Error was not raised ' );
101
+ } catch (OneLogin_Saml2_Error $ e ) {
102
+ $ this ->assertContains ('idp_not_found ' , $ e ->getMessage ());
103
+ }
104
+ }
105
+
77
106
/**
78
107
* Tests getCertPath method of the OneLogin_Saml2_Settings
79
108
*
You can’t perform that action at this time.
0 commit comments