Should SAML responses be compressed?
public shouldCompressResponses ( ) : boolean | ||
리턴 | boolean | Yes/No as True/False |
/** * Returns a Logout Response object. * * @param bool|null $deflate Whether or not we should 'gzdeflate' the response body before we return it. * * @return string Logout Response deflated and base64 encoded */ public function getResponse($deflate = null) { $subject = $this->_logoutResponse; if (is_null($deflate)) { $deflate = $this->_settings->shouldCompressResponses(); } if ($deflate) { $subject = gzdeflate($this->_logoutResponse); } return base64_encode($subject); }
/** * Tests shouldCompressResponses method of OneLogin_Saml2_Settings. * * @covers OneLogin_Saml2_settings::shouldCompressResponses */ public function testShouldCompressResponses() { //The default value should be true. $settings = new OneLogin_Saml2_Settings(); $this->assertTrue($settings->shouldCompressResponses()); $settingsDir = TEST_ROOT . '/settings/'; include $settingsDir . 'settings1.php'; //settings1.php contains a true value for compress => responses. $settings = new OneLogin_Saml2_Settings($settingsInfo); $this->assertTrue($settings->shouldCompressResponses()); $settingsDir = TEST_ROOT . '/settings/'; include $settingsDir . 'settings2.php'; //settings2 contains a false value for compress => responses. $settings = new OneLogin_Saml2_Settings($settingsInfo); $this->assertFalse($settings->shouldCompressResponses()); }