• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SimpleSAML_Module类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中SimpleSAML_Module的典型用法代码示例。如果您正苦于以下问题:PHP SimpleSAML_Module类的具体用法?PHP SimpleSAML_Module怎么用?PHP SimpleSAML_Module使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: process

 /**
  * Apply filter to validate attributes.
  *
  * @param array &$request  The current request
  */
 public function process(&$request)
 {
     $authorize = FALSE;
     assert('is_array($request)');
     assert('array_key_exists("Attributes", $request)');
     $attributes =& $request['Attributes'];
     foreach ($this->valid_attribute_values as $name => $patterns) {
         if (array_key_exists($name, $attributes)) {
             foreach ($patterns as $pattern) {
                 $values = $attributes[$name];
                 if (!is_array($values)) {
                     $values = array($values);
                 }
                 foreach ($values as $value) {
                     if (preg_match($pattern, $value)) {
                         $authorize = TRUE;
                         break 3;
                     }
                 }
             }
         }
     }
     if (!$authorize) {
         /* Save state and redirect to 403 page. */
         $id = SimpleSAML_Auth_State::saveState($request, 'authorize:Authorize');
         $url = SimpleSAML_Module::getModuleURL('authorize/authorize_403.php');
         SimpleSAML_Utilities::redirect($url, array('StateId' => $id));
     }
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:34,代码来源:Authorize.php


示例2: getInstance

 /**
  * Retrieve our singleton instance.
  *
  * @return SimpleSAML_Store|false  The data store, or false if it isn't enabled.
  */
 public static function getInstance()
 {
     if (self::$instance !== null) {
         return self::$instance;
     }
     $config = SimpleSAML_Configuration::getInstance();
     $storeType = $config->getString('store.type', null);
     if ($storeType === null) {
         $storeType = $config->getString('session.handler', 'phpsession');
     }
     switch ($storeType) {
         case 'phpsession':
             // we cannot support advanced features with the PHP session store
             self::$instance = false;
             break;
         case 'memcache':
             self::$instance = new SimpleSAML_Store_Memcache();
             break;
         case 'sql':
             self::$instance = new SimpleSAML_Store_SQL();
             break;
         default:
             // datastore from module
             $className = SimpleSAML_Module::resolveClass($storeType, 'Store', 'SimpleSAML_Store');
             self::$instance = new $className();
     }
     return self::$instance;
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:33,代码来源:Store.php


示例3: process

 /**
  * Process an authentication response.
  *
  * This function saves the state, and if necessary redirects the user to the page where the user
  * is informed about the expiry date of his/her certificate.
  *
  * @param array $state  The state of the response.
  */
 public function process(&$state)
 {
     assert('is_array($state)');
     if (isset($state['isPassive']) && $state['isPassive'] === TRUE) {
         /* We have a passive request. Skip the warning. */
         return;
     }
     if (!isset($_SERVER['SSL_CLIENT_CERT']) || $_SERVER['SSL_CLIENT_CERT'] == '') {
         return;
     }
     $client_cert = $_SERVER['SSL_CLIENT_CERT'];
     $client_cert_data = openssl_x509_parse($client_cert);
     if ($client_cert_data == FALSE) {
         SimpleSAML_Logger::error('authX509: invalid cert');
         return;
     }
     $validTo = $client_cert_data['validTo_time_t'];
     $now = time();
     $daysleft = (int) (($validTo - $now) / (24 * 60 * 60));
     if ($daysleft > $this->warndaysbefore) {
         /* We have a certificate that will be valid for some time. Skip the warning. */
         return;
     }
     SimpleSAML_Logger::warning('authX509: user certificate expires in ' . $daysleft . ' days');
     $state['daysleft'] = $daysleft;
     $state['renewurl'] = $this->renewurl;
     /* Save state and redirect. */
     $id = SimpleSAML_Auth_State::saveState($state, 'warning:expire');
     $url = SimpleSAML_Module::getModuleURL('authX509/expirywarning.php');
     \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id));
 }
开发者ID:tractorcow,项目名称:simplesamlphp,代码行数:39,代码来源:ExpiryWarning.php


示例4: getInstance

 public static function getInstance()
 {
     if (self::$instance !== null) {
         return self::$instance;
     }
     $loader = new \Twig_Loader_Filesystem();
     $translator = Translator::getInstance();
     $modules = \SimpleSAML_Module::getModules();
     foreach ($modules as $module) {
         if (\SimpleSAML_Module::isModuleEnabled($module)) {
             $path = \SimpleSAML_Module::getModuleDir($module);
             $templatePath = self::resourceExists('templates', $path);
             if (false !== $templatePath) {
                 $loader->addPath($templatePath, $module);
             }
             $translationPath = self::resourceExists('translations', $path);
             if (false !== $translationPath) {
                 $translations = new Finder();
                 $translations->files()->in($translationPath)->name('/\\.[a-zA-Z_]+\\.yml$/');
                 /** @var SplFileInfo $translation */
                 foreach ($translations as $translation) {
                     $name = $translation->getBasename('.yml');
                     $locale = substr($name, strrpos($name, '.') + 1);
                     $translator->addResource('yaml', $translation->getPathname(), $locale, $module);
                 }
             }
         }
     }
     self::$instance = new \Twig_Environment($loader);
     self::$instance->addExtension(new TranslationExtension($translator));
     return self::$instance;
 }
开发者ID:sgomez,项目名称:simplesamlphp-module-twig,代码行数:32,代码来源:Twig.php


示例5: login

 /**
  * Start a login operation.
  *
  * @param array $params  Various options to the authentication request.
  */
 public function login(array $params = array())
 {
     if (array_key_exists('KeepPost', $params)) {
         $keepPost = (bool) $params['KeepPost'];
     } else {
         $keepPost = TRUE;
     }
     if (!isset($params['ReturnTo']) && !isset($params['ReturnCallback'])) {
         $params['ReturnTo'] = SimpleSAML_Utilities::selfURL();
     }
     if (isset($params['ReturnTo']) && $keepPost && $_SERVER['REQUEST_METHOD'] === 'POST') {
         $params['ReturnTo'] = SimpleSAML_Utilities::createPostRedirectLink($params['ReturnTo'], $_POST);
     }
     $session = SimpleSAML_Session::getInstance();
     $authnRequest = array('IsPassive' => isset($params['isPassive']) ? $params['isPassive'] : FALSE, 'ForceAuthn' => isset($params['ForceAuthn']) ? $params['ForceAuthn'] : FALSE, 'core:State' => $params, 'core:prevSession' => $session->getAuthData($this->authority, 'AuthnInstant'), 'core:authority' => $this->authority);
     if (isset($params['saml:RequestId'])) {
         $authnRequest['RequestID'] = $params['saml:RequestId'];
     }
     if (isset($params['SPMetadata']['entityid'])) {
         $authnRequest['Issuer'] = $params['SPMetadata']['entityid'];
     }
     if (isset($params['saml:RelayState'])) {
         $authnRequest['RelayState'] = $params['saml:RelayState'];
     }
     if (isset($params['saml:IDPList'])) {
         $authnRequest['IDPList'] = $params['saml:IDPList'];
     }
     $authId = SimpleSAML_Utilities::generateID();
     $session->setAuthnRequest('saml2', $authId, $authnRequest);
     $relayState = SimpleSAML_Module::getModuleURL('core/bwc_resumeauth.php', array('RequestID' => $authId));
     $config = SimpleSAML_Configuration::getInstance();
     $authurl = '/' . $config->getBaseURL() . $this->auth;
     SimpleSAML_Utilities::redirect($authurl, array('RelayState' => $relayState, 'AuthId' => $authId, 'protocol' => 'saml2'));
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:39,代码来源:BWC.php


示例6: startLogout

 /**
  * Start the logout operation.
  *
  * @param array &$state  The logout state.
  * @param string|NULL $assocId  The SP we are logging out from.
  */
 public function startLogout(array &$state, $assocId)
 {
     assert('is_string($assocId) || is_null($assocId)');
     $associations = $this->idp->getAssociations();
     if (count($associations) === 0) {
         $this->idp->finishLogout($state);
     }
     foreach ($associations as $id => &$association) {
         $idp = SimpleSAML_IdP::getByState($association);
         $association['core:Logout-IFrame:Name'] = $idp->getSPName($id);
         $association['core:Logout-IFrame:State'] = 'onhold';
     }
     $state['core:Logout-IFrame:Associations'] = $associations;
     if (!is_null($assocId)) {
         $spName = $this->idp->getSPName($assocId);
         if ($spName === NULL) {
             $spName = array('en' => $assocId);
         }
         $state['core:Logout-IFrame:From'] = $spName;
     } else {
         $state['core:Logout-IFrame:From'] = NULL;
     }
     $id = SimpleSAML_Auth_State::saveState($state, 'core:Logout-IFrame');
     $url = SimpleSAML_Module::getModuleURL('core/idp/logout-iframe.php', array('id' => $id));
     SimpleSAML_Utilities::redirect($url);
 }
开发者ID:filonuse,项目名称:fedlab,代码行数:32,代码来源:LogoutIFrame.php


示例7: statistics_hook_frontpage

/**
 * Hook to add the modinfo module to the frontpage.
 *
 * @param array &$links  The links on the frontpage, split into sections.
 */
function statistics_hook_frontpage(&$links)
{
    assert('is_array($links)');
    assert('array_key_exists("links", $links)');
    $links['config']['statistics'] = array('href' => SimpleSAML_Module::getModuleURL('statistics/showstats.php'), 'text' => array('en' => 'Show statistics', 'no' => 'Vis statistikk'), 'shorttext' => array('en' => 'Statistics', 'no' => 'Statistikk'));
    $links['config']['statisticsmeta'] = array('href' => SimpleSAML_Module::getModuleURL('statistics/statmeta.php'), 'text' => array('en' => 'Show statistics metadata', 'no' => 'Vis statistikk metadata'), 'shorttext' => array('en' => 'Statistics metadata', 'no' => 'Statistikk metadata'));
}
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:12,代码来源:hook_frontpage.php


示例8: metalisting_hook_frontpage

/**
 * @param array &$links  The links on the frontpage, split into sections.
 */
function metalisting_hook_frontpage(&$links)
{
    assert('is_array($links)');
    assert('array_key_exists("links", $links)');
    $links['federation'][] = array('href' => SimpleSAML_Module::getModuleURL('metalisting/'), 'text' => array('en' => 'Federation entity listing', 'no' => 'Liste over føderasjonsmedlemmer'));
    $links['federation'][] = array('href' => SimpleSAML_Module::getModuleURL('metalisting/index.php?extended=1'), 'text' => array('en' => 'Federation entity listing (extended)', 'no' => 'Liste over føderasjonsmedlemmer (mer info)'));
}
开发者ID:googlecode-mirror,项目名称:simplesamlphp-labs,代码行数:10,代码来源:hook_frontpage.php


示例9: authenticate

 /**
  * Log-in using Facebook cronus
  *
  * @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);
     SimpleSAML_Logger::debug('facebook auth state id = ' . $stateID);
     $facebook = new Facebook($this->api_key, $this->secret);
     $u = $facebook->require_login(SimpleSAML_Module::getModuleUrl('authfacebook') . '/linkback.php?next=' . $stateID);
     # http://developers.facebook.com/documentation.php?v=1.0&method=users.getInfo
     /* Causes an notice / warning...
     		if ($facebook->api_client->error_code) {
     			throw new Exception('Unable to load profile from facebook');
     		}
     		*/
     // http://developers.facebook.com/docs/reference/rest/users.getInfo
     $info = $facebook->api_client->users_getInfo($u, array('uid', 'first_name', 'middle_name', 'last_name', 'name', 'locale', 'current_location', 'affiliations', 'pic_square', 'profile_url', 'sex', 'email', 'pic', 'username', 'about_me', 'status', 'profile_blurb'));
     $attributes = array();
     foreach ($info[0] as $key => $value) {
         if (is_string($value) && !empty($value)) {
             $attributes['facebook.' . $key] = array((string) $value);
         }
     }
     if (array_key_exists('username', $info[0])) {
         $attributes['facebook_user'] = array($info[0]['username'] . '@facebook.com');
     } else {
         $attributes['facebook_user'] = array($u . '@facebook.com');
     }
     $attributes['facebook_targetedID'] = array('http://facebook.com!' . $u);
     $attributes['facebook_cn'] = array($info[0]['name']);
     SimpleSAML_Logger::debug('Facebook Returned Attributes: ' . implode(", ", array_keys($attributes)));
     $state['Attributes'] = $attributes;
 }
开发者ID:hpgihan,项目名称:cronus,代码行数:38,代码来源:Facebook.php


示例10: consentSimpleAdmin_hook_frontpage

/**
 * Hook to add the simple consenet admin module to the frontpage.
 *
 * @param array &$links  The links on the frontpage, split into sections.
 */
function consentSimpleAdmin_hook_frontpage(&$links)
{
    assert('is_array($links)');
    assert('array_key_exists("links", $links)');
    $links['config'][] = array('href' => SimpleSAML_Module::getModuleURL('consentSimpleAdmin/consentAdmin.php'), 'text' => '{consentSimpleAdmin:consentsimpleadmin:header}');
    $links['config'][] = array('href' => SimpleSAML_Module::getModuleURL('consentSimpleAdmin/consentStats.php'), 'text' => '{consentSimpleAdmin:consentsimpleadmin:headerstats}');
}
开发者ID:danielkjfrog,项目名称:docker,代码行数:12,代码来源:hook_frontpage.php


示例11: process

 /**
  * Process a authentication response.
  *
  * This function checks how long it is since the last time the user was authenticated.
  * If it is to short a while since, we will show a warning to the user.
  *
  * @param array $state  The state of the response.
  */
 public function process(&$state)
 {
     assert('is_array($state)');
     if (!array_key_exists('PreviousSSOTimestamp', $state)) {
         /*
          * No timestamp from the previous SSO to this SP. This is the first
          * time during this session.
          */
         return;
     }
     $timeDelta = time() - $state['PreviousSSOTimestamp'];
     if ($timeDelta >= 10) {
         /* At least 10 seconds since last attempt. */
         return;
     }
     if (array_key_exists('Destination', $state) && array_key_exists('entityid', $state['Destination'])) {
         $entityId = $state['Destination']['entityid'];
     } else {
         $entityId = 'UNKNOWN';
     }
     SimpleSAML_Logger::warning('WarnShortSSOInterval: Only ' . $timeDelta . ' seconds since last SSO for this user from the SP ' . var_export($entityId, TRUE));
     /* Save state and redirect. */
     $id = SimpleSAML_Auth_State::saveState($state, 'core:short_sso_interval');
     $url = SimpleSAML_Module::getModuleURL('core/short_sso_interval.php');
     SimpleSAML_Utilities::redirectTrustedURL($url, array('StateId' => $id));
 }
开发者ID:shirlei,项目名称:simplesaml,代码行数:34,代码来源:WarnShortSSOInterval.php


示例12: unauthorized

 /**
  * When the process logic determines that the user is not
  * authorized for this service, then forward the user to
  * an 403 unauthorized page.
  *
  * Separated this code into its own method so that child
  * classes can override it and change the action. Forward
  * thinking in case a "chained" ACL is needed, more complex
  * permission logic.
  *
  * @param array $request
  */
 protected function unauthorized(&$request)
 {
     SimpleSAML_Logger::error('ExpectedAuthnContextClassRef: Invalid authentication context: ' . $this->AuthnContextClassRef . '. Accepted values are: ' . var_export($this->accepted, true));
     $id = SimpleSAML_Auth_State::saveState($request, 'saml:ExpectedAuthnContextClassRef:unauthorized');
     $url = SimpleSAML_Module::getModuleURL('saml/sp/wrong_authncontextclassref.php');
     \SimpleSAML\Utils\HTTP::redirectTrustedURL($url, array('StateId' => $id));
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:19,代码来源:ExpectedAuthnContextClassRef.php


示例13: portal_hook_htmlinject

/**
 * Hook to inject HTML content into all pages...
 *
 * @param array &$hookinfo  hookinfo
 */
function portal_hook_htmlinject(&$hookinfo)
{
    assert('is_array($hookinfo)');
    assert('array_key_exists("pre", $hookinfo)');
    assert('array_key_exists("post", $hookinfo)');
    assert('array_key_exists("page", $hookinfo)');
    $links = array('links' => array());
    SimpleSAML_Module::callHooks('frontpage', $links);
    $portalConfig = SimpleSAML_Configuration::getOptionalConfig('module_portal.php');
    $allLinks = array();
    foreach ($links as $ls) {
        $allLinks = array_merge($allLinks, $ls);
    }
    $pagesets = $portalConfig->getValue('pagesets', array(array('frontpage_welcome', 'frontpage_config', 'frontpage_auth', 'frontpage_federation')));
    SimpleSAML_Module::callHooks('portalextras', $pagesets);
    $portal = new sspmod_portal_Portal($allLinks, $pagesets);
    if (!$portal->isPortalized($hookinfo['page'])) {
        return;
    }
    // Include jquery UI CSS files in header.
    $hookinfo['jquery']['css'] = TRUE;
    $hookinfo['jquery']['version'] = '1.6';
    // Header
    $hookinfo['pre'][] = '<div id="portalmenu" class="ui-tabs ui-widget ui-widget-content ui-corner-all">' . $portal->getMenu($hookinfo['page']) . '<div id="portalcontent" class="ui-tabs-panel ui-widget-content ui-corner-bottom">';
    // Footer
    $hookinfo['post'][] = '</div></div>';
}
开发者ID:kensnyder,项目名称:simplesamlphp,代码行数:32,代码来源:hook_htmlinject.php


示例14: sanitycheck_hook_cron

/**
 * Hook to run a cron job.
 *
 * @param array &$croninfo  Output
 */
function sanitycheck_hook_cron(&$croninfo)
{
    assert('is_array($croninfo)');
    assert('array_key_exists("summary", $croninfo)');
    assert('array_key_exists("tag", $croninfo)');
    SimpleSAML_Logger::info('cron [sanitycheck]: Running cron in cron tag [' . $croninfo['tag'] . '] ');
    try {
        $sconfig = SimpleSAML_Configuration::getOptionalConfig('config-sanitycheck.php');
        $cronTag = $sconfig->getString('cron_tag', NULL);
        if ($cronTag === NULL || $cronTag !== $croninfo['tag']) {
            return;
        }
        $info = array();
        $errors = array();
        $hookinfo = array('info' => &$info, 'errors' => &$errors);
        SimpleSAML_Module::callHooks('sanitycheck', $hookinfo);
        if (count($errors) > 0) {
            foreach ($errors as $err) {
                $croninfo['summary'][] = 'Sanitycheck error: ' . $err;
            }
        }
    } catch (Exception $e) {
        $croninfo['summary'][] = 'Error executing sanity check: ' . $e->getMessage();
    }
}
开发者ID:Stony-Brook-University,项目名称:doitsbu,代码行数:30,代码来源:hook_cron.php


示例15: getInstance

 /**
  * Retrieve our singleton instance.
  *
  * @return SimpleSAML_Store|FALSE  The datastore, or FALSE if it isn't enabled.
  */
 public static function getInstance()
 {
     if (self::$instance !== NULL) {
         return self::$instance;
     }
     $config = SimpleSAML_Configuration::getInstance();
     $storeType = $config->getString('store.type', NULL);
     if ($storeType === NULL) {
         $storeType = $config->getString('session.handler', 'phpsession');
     }
     switch ($storeType) {
         case 'phpsession':
             /* We cannot support advanced features with the PHP session store. */
             self::$instance = FALSE;
             break;
         case 'memcache':
             self::$instance = new SimpleSAML_Store_Memcache();
             break;
         case 'sql':
             self::$instance = new SimpleSAML_Store_SQL();
             break;
         default:
             if (strpos($storeType, ':') === FALSE) {
                 throw new SimpleSAML_Error_Exception('Unknown datastore type: ' . var_export($storeType, TRUE));
             }
             /* Datastore from module. */
             $className = SimpleSAML_Module::resolveClass($storeType, 'Store', 'SimpleSAML_Store');
             self::$instance = new $className();
     }
     return self::$instance;
 }
开发者ID:shirlei,项目名称:simplesaml,代码行数:36,代码来源:Store.php


示例16: finalStep

 public function finalStep(&$state)
 {
     SimpleSAML_Logger::debug("oauth wrap:  Using this verification code [" . $state['authwindowslive:wrap_verification_code'] . "]");
     // Retrieve Access Token
     // Documentation at: http://msdn.microsoft.com/en-us/library/ff749686.aspx
     $postData = 'wrap_client_id=' . urlencode($this->key) . '&wrap_client_secret=' . urlencode($this->secret) . '&wrap_callback=' . urlencode(SimpleSAML_Module::getModuleUrl('authwindowslive') . '/linkback.php') . '&wrap_verification_code=' . urlencode($state['authwindowslive:wrap_verification_code']);
     $context = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postData));
     $result = \SimpleSAML\Utils\HTTP::fetch('https://consent.live.com/AccessToken.aspx', $context);
     parse_str($result, $response);
     // error checking of $response to make sure we can proceed
     if (!array_key_exists('wrap_access_token', $response)) {
         throw new Exception('[' . $response['error_code'] . '] ' . $response['wrap_error_reason'] . "\r\nNo wrap_access_token returned - cannot proceed\r\n" . $response['internal_info']);
     }
     SimpleSAML_Logger::debug("Got an access token from the OAuth WRAP service provider [" . $response['wrap_access_token'] . "] for user [" . $response['uid'] . "]");
     // Documentation at: http://msdn.microsoft.com/en-us/library/ff751708.aspx
     $opts = array('http' => array('header' => "Accept: application/json\r\nAuthorization: WRAP access_token=" . $response['wrap_access_token'] . "\r\n"));
     $data = \SimpleSAML\Utils\HTTP::fetch('https://apis.live.net/V4.1/cid-' . $response['uid'] . '/Profiles', $opts);
     $userdata = json_decode($data, TRUE);
     $attributes = array();
     $attributes['windowslive_uid'] = array($response['uid']);
     $attributes['windowslive_targetedID'] = array('http://windowslive.com!' . $response['uid']);
     $attributes['windowslive_user'] = array($response['uid'] . '@windowslive.com');
     if (array_key_exists('Entries', $userdata)) {
         foreach ($userdata['Entries'][0] as $key => $value) {
             if (is_string($value)) {
                 $attributes['windowslive.' . $key] = array((string) $value);
             }
         }
         if (array_key_exists('Emails', $userdata['Entries'][0])) {
             $attributes['windowslive_mail'] = array($userdata['Entries'][0]['Emails'][0]['Address']);
         }
     }
     SimpleSAML_Logger::debug('LiveID Returned Attributes: ' . implode(", ", array_keys($attributes)));
     $state['Attributes'] = $attributes;
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:35,代码来源:LiveID.php


示例17: startLogout

 /**
  * Start the logout operation.
  *
  * @param array       &$state The logout state.
  * @param string|null $assocId The SP we are logging out from.
  */
 public function startLogout(array &$state, $assocId)
 {
     assert('is_string($assocId) || is_null($assocId)');
     $associations = $this->idp->getAssociations();
     if (count($associations) === 0) {
         $this->idp->finishLogout($state);
     }
     foreach ($associations as $id => &$association) {
         $idp = SimpleSAML_IdP::getByState($association);
         $association['core:Logout-IFrame:Name'] = $idp->getSPName($id);
         $association['core:Logout-IFrame:State'] = 'onhold';
     }
     $state['core:Logout-IFrame:Associations'] = $associations;
     if (!is_null($assocId)) {
         $spName = $this->idp->getSPName($assocId);
         if ($spName === null) {
             $spName = array('en' => $assocId);
         }
         $state['core:Logout-IFrame:From'] = $spName;
     } else {
         $state['core:Logout-IFrame:From'] = null;
     }
     $params = array('id' => SimpleSAML_Auth_State::saveState($state, 'core:Logout-IFrame'));
     if (isset($state['core:Logout-IFrame:InitType'])) {
         $params['type'] = $state['core:Logout-IFrame:InitType'];
     }
     $url = SimpleSAML_Module::getModuleURL('core/idp/logout-iframe.php', $params);
     \SimpleSAML\Utils\HTTP::redirectTrustedURL($url);
 }
开发者ID:PitcherAG,项目名称:simplesamlphp,代码行数:35,代码来源:LogoutIFrame.php


示例18: idpinstaller_hook_step5

/**
 * Hook a ejecutar antes del paso 5 de la instalación
 * Extrae cuales son las fuentes de datos principales que podría utilizarse
 *
 * @param array &$data  Los datos a utilizar por las plantillas de tipo stepn
 */
function idpinstaller_hook_step5(&$data)
{
    $data['datasources'] = getDataSources();
    $require_mods = array("saml", "idpinstaller", "modinfo", "ldap", "sqlauth", "core", "portal", "sir2skin");
    //Modulos obligatorios
    $ssphpobj = $data['ssphpobj'];
    $modules = SimpleSAML_Module::getModules();
    sort($modules);
    $perms_ko = array();
    $modules_ko = array();
    foreach ($modules as $m) {
        $f = realpath(__DIR__ . '/../../' . $m);
        if (!file_exists($f . '/default-disable') && !file_exists($f . '/default-enable') && in_array($m, $require_mods)) {
            $modules_ko[] = $f;
        } elseif (file_exists($f . '/default-disable') && !is_writable($f . '/default-disable') || file_exists($f . '/default-enable') && !is_writable($f . '/default-enable')) {
            $perms_ko[] = $f;
        } else {
            if (in_array($m, $require_mods)) {
                //PARA LOS QUE SI QUEREMOS ACTIVAR
                if (file_exists($f . '/default-disable')) {
                    @unlink($f . '/default-disable');
                    @touch($f . '/default-enable');
                    if (!file_exists($f . '/default-enable')) {
                        $data['errors'][] = $ssphpobj->t('{idpinstaller:idpinstaller:step4_error}');
                    }
                }
            } else {
                //PARA LOS QUE QUEREMOS DESACTIVAR
                if (file_exists($f . '/default-enable')) {
                    @unlink($f . '/default-enable');
                    @touch($f . '/default-disable');
                    if (!file_exists($f . '/default-disable')) {
                        $data['errors'][] = $ssphpobj->t('{idpinstaller:idpinstaller:step4_error}');
                    }
                }
            }
        }
    }
    if (count($modules_ko) > 0) {
        $data['errors'][] = $ssphpobj->t('{idpinstaller:idpinstaller:step4_error}');
    } elseif (count($perms_ko) > 0) {
        if (function_exists('posix_getgrnam')) {
            $aux = "<br/>" . $ssphpobj->t('{idpinstaller:idpinstaller:step4_perms_ko}');
            $filename = $perms_ko[0];
            $file_owner = posix_getpwuid(fileowner($filename));
            $group = posix_getgrgid(posix_getgid());
            $recursive = is_dir($filename) ? "-R" : "";
            $aux .= "<pre>&gt; chown {$recursive} " . $file_owner['name'] . ":" . $group['name'] . " {$filename}\n&gt; chmod {$recursive} g+w " . $filename . "</pre>";
        }
        $data['errors'][] = $aux;
        $data['errors'][] = $ssphpobj->t("{idpinstaller:idpinstaller:step1_remember_change_perms}");
    }
    if (count($data['errors']) == 0) {
        $data['info'][] = $ssphpobj->t('{idpinstaller:idpinstaller:step4_all_ok}');
    }
    /*else {
          $data['errors'][] = $ssphpobj->t('{idpinstaller:idpinstaller:step4_error}');
      }*/
    return true;
}
开发者ID:rediris-es,项目名称:simplesamlphp-module-idpinstaller,代码行数:66,代码来源:hook_step5.php


示例19: createOutput

 /**
  * Create an output from a configuration object.
  *
  * @param SimpleSAML_Configuration $config  The configuration object.
  * @return
  */
 private static function createOutput(SimpleSAML_Configuration $config)
 {
     $cls = $config->getString('class');
     $cls = SimpleSAML_Module::resolveClass($cls, 'Stats_Output', 'SimpleSAML_Stats_Output');
     $output = new $cls($config);
     return $output;
 }
开发者ID:jstormes,项目名称:simplesamlphp,代码行数:13,代码来源:Stats.php


示例20: core_hook_sanitycheck

/**
 * Hook to do sanitycheck
 *
 * @param array &$hookinfo  hookinfo
 */
function core_hook_sanitycheck(&$hookinfo)
{
    assert('is_array($hookinfo)');
    assert('array_key_exists("errors", $hookinfo)');
    assert('array_key_exists("info", $hookinfo)');
    $config = SimpleSAML_Configuration::getInstance();
    if ($config->getString('auth.adminpassword', '123') === '123') {
        $hookinfo['errors'][] = '[core] Password in config.php is not set properly';
    } else {
        $hookinfo['info'][] = '[core] Password in config.php is set properly';
    }
    if ($config->getString('technicalcontact_email', '[email protected]') === '[email protected]') {
        $hookinfo['errors'][] = '[core] In config.php technicalcontact_email is not set properly';
    } else {
        $hookinfo['info'][] = '[core] In config.php technicalcontact_email is set properly';
    }
    if (version_compare(phpversion(), '5.3', '>=')) {
        $hookinfo['info'][] = '[core] You are running PHP version ' . phpversion() . '. Great.';
    } else {
        $hookinfo['errors'][] = '[core] You are running PHP version ' . phpversion() . '. SimpleSAMLphp requires version >= 5.3. Please upgrade!';
    }
    $info = array();
    $mihookinfo = array('info' => &$info);
    $availmodules = SimpleSAML_Module::getModules();
    SimpleSAML_Module::callHooks('moduleinfo', $mihookinfo);
    foreach ($info as $mi => $i) {
        if (isset($i['dependencies']) && is_array($i['dependencies'])) {
            foreach ($i['dependencies'] as $dep) {
                if (!in_array($dep, $availmodules)) {
                    $hookinfo['errors'][] = '[core] Module dependency not met: ' . $mi . ' requires ' . $dep;
                }
            }
        }
    }
}
开发者ID:palantirnet,项目名称:simplesamlphp,代码行数:40,代码来源:hook_sanitycheck.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SimpleSAML_Session类代码示例发布时间:2022-05-23
下一篇:
PHP SimpleSAML_Metadata_MetaDataStorageHandler类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap