当前位置: 首页>>代码示例>>PHP>>正文


PHP HTTP::addURLParameters方法代码示例

本文整理汇总了PHP中SimpleSAML\Utils\HTTP::addURLParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::addURLParameters方法的具体用法?PHP HTTP::addURLParameters怎么用?PHP HTTP::addURLParameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleSAML\Utils\HTTP的用法示例。


在下文中一共展示了HTTP::addURLParameters方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authorize

 /**
  * Attach the data to the token, and establish the Callback URL and verifier
  * @param $requestTokenKey RequestToken that was authorized
  * @param $data Data that is authorized and to be attached to the requestToken
  * @return array(string:url, string:verifier) ; empty verifier for 1.0-response
  */
 public function authorize($requestTokenKey, $data)
 {
     $url = null;
     $verifier = '';
     $version = $this->defaultversion;
     // See whether to remember values from the original requestToken request:
     $request_attributes = $this->store->get('requesttorequest', $requestTokenKey, '');
     // must be there ..
     if ($request_attributes['value']) {
         // establish version to work with
         $v = $request_attributes['value']['version'];
         if ($v) {
             $version = $v;
         }
         // establish callback to use
         if ($request_attributes['value']['callback']) {
             $url = $request_attributes['value']['callback'];
         }
     }
     // Is there a callback registered? This is leading, even over a supplied oauth_callback-parameter
     $oConsumer = $this->lookup_consumer($request_attributes['value']['consumerKey']);
     if ($oConsumer && $oConsumer->callback_url) {
         $url = $oConsumer->callback_url;
     }
     $verifier = SimpleSAML\Utils\Random::generateID();
     $url = \SimpleSAML\Utils\HTTP::addURLParameters($url, array("oauth_verifier" => $verifier));
     $this->store->set('authorized', $requestTokenKey, $verifier, $data, $this->config->getValue('requestTokenDuration', 60 * 30));
     return array($url, $verifier);
 }
开发者ID:SysBind,项目名称:simplesamlphp,代码行数:35,代码来源:OAuthStore.php

示例2: testAddURLParameters

 /**
  * Test SimpleSAML\Utils\HTTP::addURLParameters().
  */
 public function testAddURLParameters()
 {
     $url = 'http://example.com/';
     $params = array('foo' => 'bar', 'bar' => 'foo');
     $this->assertEquals($url . '?foo=bar&bar=foo', HTTP::addURLParameters($url, $params));
     $url = 'http://example.com/?';
     $params = array('foo' => 'bar', 'bar' => 'foo');
     $this->assertEquals($url . 'foo=bar&bar=foo', HTTP::addURLParameters($url, $params));
     $url = 'http://example.com/?foo=bar';
     $params = array('bar' => 'foo');
     $this->assertEquals($url . '&bar=foo', HTTP::addURLParameters($url, $params));
 }
开发者ID:simplesamlphp,项目名称:simplesamlphp,代码行数:15,代码来源:HTTPTest.php

示例3: simplesamlphp_get_languagebar

/**
 * Gets the language navigation bar.
 *
 * @param SimpleSAML_XHTML_Template $view The view object,
 * @param array $post The _POST array.
 *
 * @return string Resulting html markup.
 */
function simplesamlphp_get_languagebar(SimpleSAML_XHTML_Template $view, $params = array())
{
    if (!empty($params['post'])) {
        return '';
    }
    if (isset($view->data['hideLanguageBar']) && $view->data['hideLanguageBar'] === TRUE) {
        return '';
    }
    $languages = simplesamlphp_get_languages();
    $result = '<ul class="dropdown-menu">';
    $template = '<li><a href="!href">!name</a></li>';
    foreach ($languages as $lang => $name) {
        $href = \SimpleSAML\Utils\HTTP::addURLParameters(\SimpleSAML\Utils\HTTP::getSelfURL(), array($params['languageParameterName'] => $lang));
        $result .= strtr($template, array('!href' => $href, '!name' => $name));
    }
    return $result . '</ul>';
}
开发者ID:corycollier,项目名称:simplesamlphp-module-themes,代码行数:25,代码来源:functions.php

示例4: authenticate

 /**
  * Log-in using Twitter platform
  *
  * @param array &$state  Information about the current authentication.
  */
 public function authenticate(&$state)
 {
     assert('is_array($state)');
     /* We are going to need the authId in order to retrieve this authentication source later. */
     $state[self::AUTHID] = $this->authId;
     $stateID = SimpleSAML_Auth_State::saveState($state, self::STAGE_INIT);
     $consumer = new sspmod_oauth_Consumer($this->key, $this->secret);
     // Get the request token
     $linkback = SimpleSAML_Module::getModuleURL('authtwitter/linkback.php', array('AuthState' => $stateID));
     $requestToken = $consumer->getRequestToken('https://api.twitter.com/oauth/request_token', array('oauth_callback' => $linkback));
     SimpleSAML_Logger::debug("Got a request token from the OAuth service provider [" . $requestToken->key . "] with the secret [" . $requestToken->secret . "]");
     $state['authtwitter:authdata:requestToken'] = $requestToken;
     SimpleSAML_Auth_State::saveState($state, self::STAGE_INIT);
     // Authorize the request token
     $url = 'https://api.twitter.com/oauth/authenticate';
     if ($this->force_login) {
         $url = \SimpleSAML\Utils\HTTP::addURLParameters($url, array('force_login' => 'true'));
     }
     $consumer->getAuthorizeRequest($url, $requestToken);
 }
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:25,代码来源:Twitter.php

示例5: getModuleURL

 /**
  * Get absolute URL to a specified module resource.
  *
  * This function creates an absolute URL to a resource stored under ".../modules/<module>/www/".
  *
  * @param string $resource Resource path, on the form "<module name>/<resource>"
  * @param array  $parameters Extra parameters which should be added to the URL. Optional.
  *
  * @return string The absolute URL to the given resource.
  */
 public static function getModuleURL($resource, array $parameters = array())
 {
     assert('is_string($resource)');
     assert('$resource[0] !== "/"');
     $url = \SimpleSAML\Utils\HTTP::getBaseURL() . 'module.php/' . $resource;
     if (!empty($parameters)) {
         $url = \SimpleSAML\Utils\HTTP::addURLParameters($url, $parameters);
     }
     return $url;
 }
开发者ID:palantirnet,项目名称:simplesamlphp,代码行数:20,代码来源:Module.php

示例6: getAuthorizeRequest

 public function getAuthorizeRequest($url, $requestToken, $redirect = TRUE, $callback = NULL)
 {
     $params = array('oauth_token' => $requestToken->key);
     if ($callback) {
         $params['oauth_callback'] = $callback;
     }
     $authorizeURL = \SimpleSAML\Utils\HTTP::addURLParameters($url, $params);
     if ($redirect) {
         \SimpleSAML\Utils\HTTP::redirectTrustedURL($authorizeURL);
         exit;
     }
     return $authorizeURL;
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:13,代码来源:Consumer.php

示例7: send

 /**
  * Helper function for sending CDC messages.
  *
  * @param string $to  The URL the message should be delivered to.
  * @param string $parameter  The query parameter the message should be sent in.
  * @param array $message  The CDC message.
  */
 private function send($to, $parameter, array $message)
 {
     assert('is_string($to)');
     assert('is_string($parameter)');
     $message['timestamp'] = time();
     $message = json_encode($message);
     $message = base64_encode($message);
     $signature = $this->calcSignature($message);
     $params = array($parameter => $message, 'Signature' => $signature);
     $url = \SimpleSAML\Utils\HTTP::addURLParameters($to, $params);
     if (strlen($url) < 2048) {
         \SimpleSAML\Utils\HTTP::redirectTrustedURL($url);
     } else {
         \SimpleSAML\Utils\HTTP::submitPOSTData($to, $params);
     }
 }
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:23,代码来源:Server.php

示例8: addURLparameter

 /**
  * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\HTTP::addURLParameters() instead.
  */
 public static function addURLparameter($url, $parameters)
 {
     return \SimpleSAML\Utils\HTTP::addURLParameters($url, $parameters);
 }
开发者ID:jstormes,项目名称:simplesamlphp,代码行数:7,代码来源:Utilities.php

示例9: array

}
if (isset($this->data['hideLanguageBar']) && $this->data['hideLanguageBar'] === TRUE) {
    $includeLanguageBar = FALSE;
}
if ($includeLanguageBar) {
    $languages = $this->getLanguageList();
    if (count($languages) > 1) {
        echo '<div id="languagebar">';
        $langnames = array('no' => 'Bokmål', 'nn' => 'Nynorsk', 'se' => 'Sámegiella', 'sam' => 'Åarjelh-saemien giele', 'da' => 'Dansk', 'en' => 'English', 'de' => 'Deutsch', 'sv' => 'Svenska', 'fi' => 'Suomeksi', 'es' => 'Español', 'fr' => 'Français', 'it' => 'Italiano', 'nl' => 'Nederlands', 'lb' => 'Lëtzebuergesch', 'cs' => 'Čeština', 'sl' => 'Slovenščina', 'lt' => 'Lietuvių kalba', 'hr' => 'Hrvatski', 'hu' => 'Magyar', 'pl' => 'Język polski', 'pt' => 'Português', 'pt-br' => 'Português brasileiro', 'ru' => 'русский язык', 'et' => 'eesti keel', 'tr' => 'Türkçe', 'el' => 'ελληνικά', 'ja' => '日本語', 'zh' => '简体中文', 'zh-tw' => '繁體中文', 'ar' => 'العربية', 'fa' => 'پارسی', 'ur' => 'اردو', 'he' => 'עִבְרִית', 'id' => 'Bahasa Indonesia', 'sr' => 'Srpski', 'lv' => 'Latviešu', 'ro' => 'Românește', 'eu' => 'Euskara');
        $textarray = array();
        foreach ($languages as $lang => $current) {
            $lang = strtolower($lang);
            if ($current) {
                $textarray[] = $langnames[$lang];
            } else {
                $textarray[] = '<a href="' . htmlspecialchars(\SimpleSAML\Utils\HTTP::addURLParameters(\SimpleSAML\Utils\HTTP::getSelfURL(), array($this->languageParameterName => $lang))) . '">' . $langnames[$lang] . '</a>';
            }
        }
        echo join(' | ', $textarray);
        echo '</div>';
    }
}
?>
	<div id="content">



<?php 
if (!empty($this->data['htmlinject']['htmlContentPre'])) {
    foreach ($this->data['htmlinject']['htmlContentPre'] as $c) {
        echo $c;
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:31,代码来源:header.php

示例10: pack

            $site = $op[1];
            $site = pack("H*", $site);
            $server->removeTrustRoot($identity, $site);
        }
    }
    \SimpleSAML\Utils\HTTP::redirectTrustedURL($identity);
}
if ($ownPage) {
    $trustedSites = $server->getTrustRoots($identity);
} else {
    $trustedSites = array();
}
$userBase = SimpleSAML\Module::getModuleURL('openidProvider/user.php');
$xrds = SimpleSAML\Module::getModuleURL('openidProvider/xrds.php');
if ($userId !== FALSE) {
    $xrds = \SimpleSAML\Utils\HTTP::addURLParameters($xrds, array('user' => $userId));
}
$as = $server->getAuthSource();
$t = new SimpleSAML_XHTML_Template($globalConfig, 'openidProvider:user.tpl.php');
$t->data['identity'] = $identity;
$t->data['loggedInAs'] = $server->getUserId();
$t->data['loginURL'] = $as->getLoginURL($userBase);
$t->data['logoutURL'] = $as->getLogoutURL();
$t->data['ownPage'] = $ownPage;
$t->data['serverURL'] = $server->getServerURL();
$t->data['trustedSites'] = $trustedSites;
$t->data['userId'] = $userId;
$t->data['userIdURL'] = $userBase . '/' . $userId;
$t->data['xrdsURL'] = $xrds;
$t->show();
exit(0);
开发者ID:simplesamlphp,项目名称:simplesamlphp-module-openidprovider,代码行数:31,代码来源:user.php

示例11: receiveAuthnRequest

 /**
  * Receive an authentication request.
  *
  * @param SimpleSAML_IdP $idp  The IdP we are receiving it for.
  */
 public static function receiveAuthnRequest(SimpleSAML_IdP $idp)
 {
     if (isset($_REQUEST['cookieTime'])) {
         $cookieTime = (int) $_REQUEST['cookieTime'];
         if ($cookieTime + 5 > time()) {
             /*
              * Less than five seconds has passed since we were
              * here the last time. Cookies are probably disabled.
              */
             \SimpleSAML\Utils\HTTP::checkSessionCookie(\SimpleSAML\Utils\HTTP::getSelfURL());
         }
     }
     if (!isset($_REQUEST['providerId'])) {
         throw new SimpleSAML_Error_BadRequest('Missing providerId parameter.');
     }
     $spEntityId = (string) $_REQUEST['providerId'];
     if (!isset($_REQUEST['shire'])) {
         throw new SimpleSAML_Error_BadRequest('Missing shire parameter.');
     }
     $shire = (string) $_REQUEST['shire'];
     if (isset($_REQUEST['target'])) {
         $target = $_REQUEST['target'];
     } else {
         $target = NULL;
     }
     SimpleSAML\Logger::info('Shib1.3 - IdP.SSOService: Got incoming Shib authnRequest from ' . var_export($spEntityId, TRUE) . '.');
     $metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
     $spMetadata = $metadata->getMetaDataConfig($spEntityId, 'shib13-sp-remote');
     $found = FALSE;
     foreach ($spMetadata->getEndpoints('AssertionConsumerService') as $ep) {
         if ($ep['Binding'] !== 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post') {
             continue;
         }
         if ($ep['Location'] !== $shire) {
             continue;
         }
         $found = TRUE;
         break;
     }
     if (!$found) {
         throw new Exception('Invalid AssertionConsumerService for SP ' . var_export($spEntityId, TRUE) . ': ' . var_export($shire, TRUE));
     }
     SimpleSAML_Stats::log('saml:idp:AuthnRequest', array('spEntityID' => $spEntityId, 'protocol' => 'saml1'));
     $sessionLostURL = \SimpleSAML\Utils\HTTP::addURLParameters(\SimpleSAML\Utils\HTTP::getSelfURL(), array('cookieTime' => time()));
     $state = array('Responder' => array('sspmod_saml_IdP_SAML1', 'sendResponse'), 'SPMetadata' => $spMetadata->toArray(), SimpleSAML_Auth_State::RESTART => $sessionLostURL, 'saml:shire' => $shire, 'saml:target' => $target, 'saml:AuthnRequestReceivedAt' => microtime(TRUE));
     $idp->handleAuthenticationRequest($state);
 }
开发者ID:SysBind,项目名称:simplesamlphp,代码行数:52,代码来源:SAML1.php

示例12: Exception

<?php

if (empty($_REQUEST['entityID'])) {
    throw new Exception('Missing parameter [entityID]');
}
if (empty($_REQUEST['return'])) {
    throw new Exception('Missing parameter [return]');
}
$djconfig = SimpleSAML_Configuration::getOptionalConfig('discojuice.php');
$config = SimpleSAML_Configuration::getInstance();
// EntityID
$entityid = $_REQUEST['entityID'];
// Return to...
$returnidparam = !empty($_REQUEST['returnIDParam']) ? $_REQUEST['returnIDParam'] : 'entityID';
$href = \SimpleSAML\Utils\HTTP::addURLParameters($_REQUEST['return'], array($returnidparam => ''));
$hostedConfig = array($djconfig->getString('name', 'Service'), $entityid, SimpleSAML\Module::getModuleURL('discojuice/response.html'), $djconfig->getArray('feeds', array('edugain')), $href);
/*
	"a.signin", "Teest Demooo",
    "https://example.org/saml2/entityid",
    "' . SimpleSAML\Module::getModuleURL('discojuice/discojuice/discojuiceDiscoveryResponse.html') . '", ["kalmar"], "http://example.org/login?idp="
*/
$t = new SimpleSAML_XHTML_Template($config, 'discojuice:central.tpl.php');
$t->data['hostedConfig'] = $hostedConfig;
$t->data['enableCentralStorage'] = $djconfig->getBoolean('enableCentralStorage', true);
$t->data['additionalFeeds'] = $djconfig->getArray('additionalFeeds', null);
$t->show();
开发者ID:simplesamlphp,项目名称:simplesamlphp-module-discojuice,代码行数:26,代码来源:central.php

示例13: Exception

 *  renew
 *  gateway
 *  
 */
if (!array_key_exists('service', $_GET)) {
    throw new Exception('Required URL query parameter [service] not provided. (CAS Server)');
}
$service = $_GET['service'];
$forceAuthn = isset($_GET['renew']) && $_GET['renew'];
$isPassive = isset($_GET['gateway']) && $_GET['gateway'];
$config = SimpleSAML_Configuration::getInstance();
$casconfig = SimpleSAML_Configuration::getConfig('module_casserver.php');
$legal_service_urls = $casconfig->getValue('legal_service_urls');
if (!checkServiceURL($service, $legal_service_urls)) {
    throw new Exception('Service parameter provided to CAS server is not listed as a legal service: [service] = ' . $service);
}
$auth = $casconfig->getValue('auth', 'saml2');
if (!in_array($auth, array('saml2', 'shib13'))) {
    throw new Exception('CAS Service configured to use [auth] = ' . $auth . ' only [saml2,shib13] is legal.');
}
$as = new SimpleSAML_Auth_Simple($auth);
if (!$as->isAuthenticated()) {
    $params = array('ForceAuthn' => $forceAuthn, 'isPassive' => $isPassive);
    $as->login($params);
}
$attributes = $as->getAttributes();
$path = $casconfig->resolvePath($casconfig->getValue('ticketcache', '/tmp'));
$ticket = str_replace('_', 'ST-', SimpleSAML\Utils\Random::generateID());
storeTicket($ticket, $path, array('service' => $service, 'forceAuthn' => $forceAuthn, 'attributes' => $attributes, 'proxies' => array(), 'validbefore' => time() + 5));
\SimpleSAML\Utils\HTTP::redirectTrustedURL(\SimpleSAML\Utils\HTTP::addURLParameters($service, array('ticket' => $ticket)));
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:30,代码来源:login.php

示例14: getStateURL

 /**
  * Save the state, and return a URL that can contain a reference to the state.
  *
  * @param string $page  The name of the page.
  * @param array $state  The state array.
  * @return string  A URL with the state ID as a parameter.
  */
 private function getStateURL($page, array $state)
 {
     assert('is_string($page)');
     $stateId = SimpleSAML_Auth_State::saveState($state, 'openidProvider:resumeState');
     $stateURL = SimpleSAML\Module::getModuleURL('openidProvider/' . $page);
     $stateURL = \SimpleSAML\Utils\HTTP::addURLParameters($stateURL, array('StateID' => $stateId));
     return $stateURL;
 }
开发者ID:simplesamlphp,项目名称:simplesamlphp-module-openidprovider,代码行数:15,代码来源:Server.php

示例15: SimpleSAML_Error_Exception

        if (!$idpmeta->hasValue('OrganizationURL')) {
            throw new SimpleSAML_Error_Exception('If OrganizationName is set, OrganizationURL must also be set.');
        }
        $metaArray['OrganizationURL'] = $idpmeta->getLocalizedString('OrganizationURL');
    }
    $metaflat = '$metadata[' . var_export($idpentityid, true) . '] = ' . var_export($metaArray, true) . ';';
    $metaBuilder = new SimpleSAML_Metadata_SAMLBuilder($idpentityid);
    $metaBuilder->addMetadataIdP11($metaArray);
    $metaBuilder->addOrganizationInfo($metaArray);
    $metaBuilder->addContact('technical', \SimpleSAML\Utils\Config\Metadata::getContact(array('emailAddress' => $config->getString('technicalcontact_email', null), 'name' => $config->getString('technicalcontact_name', null), 'contactType' => 'technical')));
    $metaxml = $metaBuilder->getEntityDescriptorText();
    // sign the metadata if enabled
    $metaxml = SimpleSAML_Metadata_Signer::sign($metaxml, $idpmeta->toArray(), 'Shib 1.3 IdP');
    if (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') {
        $defaultidp = $config->getString('default-shib13-idp', null);
        $t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin');
        $t->data['clipboard.js'] = true;
        $t->data['header'] = 'shib13-idp';
        $t->data['metaurl'] = \SimpleSAML\Utils\HTTP::addURLParameters(\SimpleSAML\Utils\HTTP::getSelfURLNoQuery(), array('output' => 'xml'));
        $t->data['metadata'] = htmlspecialchars($metaxml);
        $t->data['metadataflat'] = htmlspecialchars($metaflat);
        $t->data['defaultidp'] = $defaultidp;
        $t->show();
    } else {
        header('Content-Type: application/xml');
        echo $metaxml;
        exit(0);
    }
} catch (Exception $exception) {
    throw new SimpleSAML_Error_Error('METADATA', $exception);
}
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:31,代码来源:metadata.php


注:本文中的SimpleSAML\Utils\HTTP::addURLParameters方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。