Пример #1
0
 /**
  * Tests the logout method of the OneLogin_Saml2_Auth class
  * Case Logout signed. A logout Request signed in
  * the assertion is built and redirect executed
  *
  * @covers OneLogin_Saml2_Auth::logout
  * @runInSeparateProcess
  */
 public function testLogoutSigned()
 {
     $settingsDir = TEST_ROOT . '/settings/';
     include $settingsDir . 'settings1.php';
     $settingsInfo['security']['logoutRequestSigned'] = true;
     $auth = new OneLogin_Saml2_Auth($settingsInfo);
     try {
         // The Header of the redirect produces an Exception
         $returnTo = 'http://example.com/returnto';
         $auth->logout($returnTo);
         // Do not ever get here
         $this->assertFalse(true);
     } catch (Exception $e) {
         $this->assertContains('Cannot modify header information', $e->getMessage());
         $trace = $e->getTrace();
         $targetUrl = getUrlFromRedirect($trace);
         $parsedQuery = getParamsFromUrl($targetUrl);
         $sloUrl = $settingsInfo['idp']['singleLogoutService']['url'];
         $this->assertContains($sloUrl, $targetUrl);
         $this->assertArrayHasKey('SAMLRequest', $parsedQuery);
         $this->assertArrayHasKey('RelayState', $parsedQuery);
         $this->assertArrayHasKey('SigAlg', $parsedQuery);
         $this->assertArrayHasKey('Signature', $parsedQuery);
         $this->assertEquals($parsedQuery['RelayState'], $returnTo);
         $this->assertEquals(XMLSecurityKey::RSA_SHA1, $parsedQuery['SigAlg']);
     }
 }
Пример #2
0
function getSource($sourceData, $imageW, $imageH)
{
    if (!empty($sourceData)) {
        $embedCode = '';
        $sourceType = getMediaType(trim($sourceData));
        $mediaParams = getParamsFromUrl(trim($sourceData));
        if (empty($sourceType)) {
            return '';
        }
        if ($sourceType == 'vimeo') {
            $embedCode = '<iframe src="http://player.vimeo.com/video/' . $mediaParams['v'] . '?title=0&amp;byline=0&amp;portrait=0" width="' . $imageW . '" height="' . $imageH . '" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>';
        } elseif ($sourceType == 'youtube') {
            $embedCode = '<iframe width="' . $imageW . '" height="' . $imageH . '" src="http://www.youtube.com/embed/' . $mediaParams['v'] . '?wmode=transparent&rel=0" frameborder="0" allowfullscreen></iframe>';
        } elseif ($sourceType == 'jwplayer') {
            $rand = createRandomKey(5);
            $embedCode = '<div id="jwEP' . $rand . '" style="width:' . $imageW . 'px; height:' . $imageH . 'px;"></div>
							<script>
							jwplayer("jwEP' . $rand . '").setup({
								flashplayer: "' . get_template_directory_uri() . '/jwplayer/player.swf",
								autostart: false,
								skin: "' . get_template_directory_uri() . '/jwplayer/glow/glow.xml",
								file: "' . $mediaParams['vurl'] . '",
								height: ' . $imageH . ',
								width: ' . $imageW . '
								});
							</script>';
        } elseif ($sourceType == 'flash') {
            $rand = createRandomKey(5);
            $embedCode = '<div id="flashContent' . $rand . '">
								<p>You need to <a href="http://www.adobe.com/products/flashplayer/" target="_blank">upgrade your Flash Player</a> to version 10 or newer.</p>  
							</div>
							<script type="text/javascript">  
									var flashvars = {};  
									var attributes = {};  
									attributes.wmode = "transparent";
									attributes.play = "true";
									attributes.menu = "false";
									attributes.scale = "showall";
									attributes.wmode = "transparent";
									attributes.allowfullscreen = "true";
									attributes.allowscriptaccess = "always";
									attributes.allownetworking = "all";					
									swfobject.embedSWF("' . $mediaParams['vurl'] . '", "flashContent' . $rand . '", "' . $imageW . '", "' . $imageH . '", "10", "' . get_template_directory_uri() . '/js/expressInstall.swf", flashvars, attributes);  
							</script>';
        }
        return $embedCode;
    }
}