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


PHP SimpleSAML_Utilities::redirectTrustedUrl方法代码示例

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


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

示例1: redirectTrustedUrl

/**
 * Ajax compatible redirect method
 *
 * @param string $url
 * @param array $params
 * @param bool $isAjax
 */
function redirectTrustedUrl($url, array $params = array(), $isAjax = false)
{
    if ($isAjax) {
        $redirectUrl = str_replace(TAB_AJAX_CONTENT_PREFIX, '', $url) . '?' . http_build_query($params);
        die('<script type="text/javascript">window.location =\'' . $redirectUrl . '\';</script>');
    } else {
        SimpleSAML_Utilities::redirectTrustedUrl($url, $params);
    }
}
开发者ID:janus-ssp,项目名称:janus,代码行数:16,代码来源:dashboard.php

示例2: SimpleSAML_Auth_Simple

$session = SimpleSAML_Session::getSessionFromRequest();
$config = SimpleSAML_Configuration::getInstance();
$janus_config = sspmod_janus_DiContainer::getInstance()->getConfig();
$authsource = $janus_config->getValue('auth', 'login-admin');
$useridattr = $janus_config->getValue('useridattr', 'eduPersonPrincipalName');
$as = new SimpleSAML_Auth_Simple($authsource);
if ($as->isAuthenticated()) {
    $attributes = $as->getAttributes();
    // Check if userid exists
    if (!isset($attributes[$useridattr])) {
        throw new Exception('User ID is missing');
    }
    $userid = $attributes[$useridattr][0];
} else {
    $session->setData('string', 'refURL', SimpleSAML_Utilities::selfURL());
    SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/index.php'));
}
if (isset($_GET['eid'])) {
    $eid = $_GET['eid'];
} else {
    throw new SimpleSAML_Error_Exception('Eid must be set');
}
if (isset($_GET['revisionid'])) {
    $revisionid = $_GET['revisionid'];
} else {
    throw new SimpleSAML_Error_Exception('Revisionid must be set');
}
$md_options = $janus_config->getValue('mdexport.default_options');
$metaxml = sspmod_janus_MetaExport::getReadableXMLMetadata($eid, $revisionid, array('maxCache' => $md_options['maxCache'], 'maxDuration' => $md_options['maxDuration']));
$metaflat = sspmod_janus_MetaExport::getFlatMetadata($eid, $revisionid);
$metaarray = sspmod_janus_MetaExport::getPHPArrayMetadata($eid, $revisionid);
开发者ID:janus-ssp,项目名称:janus,代码行数:31,代码来源:exportentity.php

示例3: SimpleSAML_Error_BadRequest

        throw new SimpleSAML_Error_BadRequest('Missing valid csrf token!');
    }
    // Update entity if updated
    if ($update) {
        $entityController->saveEntity();
        $entityController->loadEntity();
        $entity = $entityController->getEntity();
        // Notify users who have asked to be updated when
        $pm = new sspmod_janus_Postman();
        $addresses[] = 'ENTITYUPDATE-' . $entity->getEid();
        $editLink = SimpleSAML_Module::getModuleURL('janus/editentity.php', array('eid' => $entity->getEid(), 'revisionid' => $entity->getRevisionid()));
        $pm->post('Entity updated - ' . $entity->getEntityid(), 'Permalink: <a href="' . htmlspecialchars($editLink) . '">' . htmlspecialchars($editLink) . '</a><br /><br />' . htmlspecialchars($entity->getRevisionnote()) . '<br /><br />' . htmlspecialchars($note), $addresses, $user->getUid());
    }
    $session->deleteData('string', 'meta_xml');
    $session->deleteData('string', 'meta_json');
    SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/editentity.php'), array('eid' => $entity->getEid(), 'revisionid' => $entity->getRevisionid()));
    exit;
}
$et->data['update'] = $update;
$newMetadata = $entityController->getMetaArray();
unset($newMetadata['attributes']);
$newMetadata = $converter->execute($newMetadata);
$et->data['new'] = $newMetadata;
$et->data['newArp'] = $entityController->getArpAttributes();
$et->data['newAcl'] = array('AllowedAll' => $entityController->getAllowedAll(), 'Allowed' => array_map(function ($allowedEntity) use($janusConfig) {
    // @todo this is very inefficient for large sets
    $controller = sspmod_janus_DiContainer::getInstance()->getEntityController();
    $controller->setEntity($allowedEntity['remoteeid']);
    return $controller->getEntity()->getPrettyname();
}, $entityController->getAllowedEntities()), 'Blocked' => array_map(function ($blockedEntity) use($janusConfig) {
    // @todo this is very inefficient for large sets
开发者ID:janus-ssp,项目名称:janus,代码行数:31,代码来源:importentity.php

示例4: Exception

    // Check if userid exists
    if (!isset($attributes[$useridattr])) {
        throw new Exception('User ID is missing');
    }
    $userid = $attributes[$useridattr][0];
} else {
    $returnURL = $session->getData('string', 'refURL');
    if (is_null($returnURL)) {
        $returnURL = SimpleSAML_Utilities::selfURL();
    } else {
        $session->deleteData('string', 'refURL');
    }
    SimpleSAML_Auth_Default::initLogin($authsource, $returnURL, NULL, $_GET);
}
$user = new sspmod_janus_User();
$user->setUserid($userid);
if (!$user->load(sspmod_janus_User::USERID_LOAD)) {
    $autocreatenewuser = $janus_config->getValue('user.autocreate', false);
    if ($autocreatenewuser) {
        SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/newUser.php'), array('userid' => $userid));
    } else {
        SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/noNewUser.php'), array('userid' => $userid));
    }
} else {
    if ($user->getActive() === 'yes') {
        SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/dashboard.php/entities'));
    } else {
        $session->doLogout();
        SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/index.php?error=error_index_user_inactive'));
    }
}
开发者ID:baszoetekouw,项目名称:janus,代码行数:31,代码来源:index.php

示例5: array

<?php

require __DIR__ . '/_includes.php';
$session = SimpleSAML_Session::getInstance();
$janusConfig = sspmod_janus_DiContainer::getInstance()->getConfig();
$authSource = $janusConfig->getValue('auth', 'login-admin');
// Validate user
if (!$session->isValid($authSource)) {
    SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/index.php', array('selectedtab' => "'federation'")));
}
$entities = array();
$util = new sspmod_janus_AdminUtil();
$userController = sspmod_janus_DiContainer::getInstance()->getUserController();
$entities = array_merge($userController->searchEntitiesByType('saml20-idp'), $userController->searchEntitiesByType('saml20-sp'));
foreach ($entities as $entity) {
    /**
     * @var sspmod_janus_Entity $entity
     */
    $entityId = $entity->getEid();
    $entityController = sspmod_janus_DiContainer::getInstance()->getEntityController();
    $entityController->setEntity($entityId);
    $entityController->loadEntity();
    $controllerEntity = $entityController->getEntity();
    $entityType = $controllerEntity->getType();
    if (!isset($entities[$entityType])) {
        $entities[$entityType] = array();
    }
    $entities_info[$entityType][] = array('Id' => $controllerEntity->getEntityid(), 'Name' => $controllerEntity->getPrettyname(), 'WorkflowStatus' => $controllerEntity->getWorkflow(), 'MetadataUrl' => $controllerEntity->getMetadataURL(), 'Eid' => $controllerEntity->getEid());
}
ksort($entities_info);
$template = new SimpleSAML_XHTML_Template(SimpleSAML_Configuration::getInstance(), 'janus:show-entities-validation.php', 'janus:show-entities-validation');
开发者ID:baszoetekouw,项目名称:janus,代码行数:31,代码来源:show-entities-validation.php

示例6: sspmod_janus_Postman

        $entity->setRevisionnote($_POST['revisionnote']);
    }
    // Update entity if updated
    if ($update) {
        $entityController->saveEntity();
        $entityController->loadEntity();
        $pm = new sspmod_janus_Postman();
        $addresses[] = 'ENTITYUPDATE-' . $eid;
        $directlink = SimpleSAML_Module::getModuleURL('janus/editentity.php', array('eid' => $entity->getEid(), 'revisionid' => $entity->getRevisionid()));
        $pm->post('Entity updated - ' . $entity->getEntityid(), 'Permalink: <a href="' . htmlspecialchars($directlink) . '">' . htmlspecialchars($directlink) . '</a><br /><br />' . htmlspecialchars($entity->getRevisionnote()) . '<br /><br />' . htmlspecialchars($note), $addresses, $user->getUid());
    }
    if ($redirectToImport) {
        $entity = $entityController->getEntity();
        SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Module::getModuleURL('janus/importentity.php'), array('eid' => $entity->getEid()));
    } else {
        SimpleSAML_Utilities::redirectTrustedUrl(SimpleSAML_Utilities::selfURLNoQuery(), array('eid' => $eid, 'msg' => $msg, 'selectedtab' => isset($_POST['selectedtab']) ? (int) $_POST['selectedtab'] : 0));
    }
}
// Get remote entities
if ($entity->getType() == 'saml20-sp') {
    $remoteTypes = array('saml20-idp', 'shib13-idp');
} else {
    if ($entity->getType() == 'saml20-idp') {
        $remoteTypes = array('saml20-sp', 'shib13-sp');
    } else {
        if ($entity->getType() == 'shib13-sp') {
            $remoteTypes = array('saml20-idp', 'shib13-idp');
        } else {
            if ($entity->getType() == 'shib13-idp') {
                $remoteTypes = array('saml20-sp', 'shib13-sp');
            } else {
开发者ID:baszoetekouw,项目名称:janus,代码行数:31,代码来源:editentity.php


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