Skip to content

Commit

Permalink
Set true as the default value for strict setting
Browse files Browse the repository at this point in the history
  • Loading branch information
pitbulk committed Sep 10, 2019
1 parent 91c2308 commit 7a6f4ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/Saml2/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class OneLogin_Saml2_Settings
*
* @var bool
*/
private $_strict = false;
private $_strict = true;

/**
* Activate debug mode
Expand Down
26 changes: 13 additions & 13 deletions tests/src/OneLogin/Saml2/SettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function testNonArrayCompressionSettingsCauseSyntaxError($invalidValue)
return;
}

$this->fail("An OneLogin_Saml2_error should have been caught.");
$this->fail("An OneLogin_Saml2_Error should have been caught.");
}

/**
Expand Down Expand Up @@ -233,7 +233,7 @@ public function testThatOnlyBooleansCanBeUsedForCompressionSettings($invalidValu
$settingsInfo['compress']['responses'] = $invalidValue;
$settings = new OneLogin_Saml2_Settings($settingsInfo);
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$expectedMessage = "Invalid array settings: 'compress'=>'responses' values must be true or false.";
$this->assertEquals($expectedMessage, $e->getMessage());
$responsesIsInvalid = true;
Expand Down Expand Up @@ -301,15 +301,15 @@ public function testCheckSettings()
try {
$settings = new OneLogin_Saml2_Settings($settingsInfo);
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$this->assertContains('Invalid array settings: invalid_syntax', $e->getMessage());
}

$settingsInfo['strict'] = true;
try {
$settings = new OneLogin_Saml2_Settings($settingsInfo);
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$this->assertContains('idp_not_found', $e->getMessage());
$this->assertContains('sp_not_found', $e->getMessage());
}
Expand All @@ -323,7 +323,7 @@ public function testCheckSettings()
try {
$settings = new OneLogin_Saml2_Settings($settingsInfo);
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$this->assertContains('idp_entityId_not_found', $e->getMessage());
$this->assertContains('idp_sso_not_found', $e->getMessage());
$this->assertContains('sp_entityId_not_found', $e->getMessage());
Expand All @@ -339,7 +339,7 @@ public function testCheckSettings()
try {
$settings = new OneLogin_Saml2_Settings($settingsInfo);
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$this->assertContains('idp_sso_url_invalid', $e->getMessage());
$this->assertContains('idp_slo_url_invalid', $e->getMessage());
$this->assertContains('idp_slo_response_url_invalid', $e->getMessage());
Expand All @@ -351,15 +351,15 @@ public function testCheckSettings()
try {
$settings = new OneLogin_Saml2_Settings($settingsInfo);
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$this->assertContains('idp_cert_or_fingerprint_not_found_and_required', $e->getMessage());
}

$settingsInfo['security']['nameIdEncrypted'] = true;
try {
$settings = new OneLogin_Saml2_Settings($settingsInfo);
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$this->assertContains('idp_cert_not_found_and_required', $e->getMessage());
}

Expand All @@ -386,7 +386,7 @@ public function testCheckSettings()
try {
$settings = new OneLogin_Saml2_Settings($settingsInfo);
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$this->assertContains('sp_signMetadata_invalid', $e->getMessage());
$this->assertContains('organization_not_enought_data', $e->getMessage());
$this->assertContains('contact_type_invalid', $e->getMessage());
Expand Down Expand Up @@ -610,7 +610,7 @@ public function testGetSPMetadataSignedNoMetadataCert()
$settings = new OneLogin_Saml2_Settings($settingsInfo);
$metadata = $settings->getSPMetadata();
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$this->assertContains('sp_signMetadata_invalid', $e->getMessage());
}

Expand All @@ -624,7 +624,7 @@ public function testGetSPMetadataSignedNoMetadataCert()
try {
$metadata = $settings->getSPMetadata();
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$this->assertContains('Private key file not found', $e->getMessage());
}

Expand All @@ -637,7 +637,7 @@ public function testGetSPMetadataSignedNoMetadataCert()
try {
$metadata = $settings->getSPMetadata();
$this->fail('OneLogin_Saml2_Error was not raised');
} catch (OneLogin_Saml2_error $e) {
} catch (OneLogin_Saml2_Error $e) {
$this->assertContains('Public cert file not found', $e->getMessage());
}
}
Expand Down Expand Up @@ -1023,7 +1023,7 @@ public function testIsStrict()
unset($settingsInfo['strict']);

$settings = new OneLogin_Saml2_Settings($settingsInfo);
$this->assertFalse($settings->isStrict());
$this->assertTrue($settings->isStrict());

$settingsInfo['strict'] = false;
$settings2 = new OneLogin_Saml2_Settings($settingsInfo);
Expand Down

0 comments on commit 7a6f4ba

Please sign in to comment.