コード例 #1
0
ファイル: app.php プロジェクト: felixrupp/user_cas
        if (OC_USER_CAS::initialized_php_cas()) {
            phpCAS::forceAuthentication();
            $user = phpCAS::getUser();
            $application = new \OC\Core\Application();
            $loginController = $application->getContainer()->query('LoginController');
            $loginController->tryLogin($user, NULL, NULL);
            if (isset($_SERVER["QUERY_STRING"]) && !empty($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] != 'app=user_cas') {
                header('Location: ' . OC::$WEBROOT . '/?' . $_SERVER["QUERY_STRING"]);
                exit;
            }
        }
        OC::$REQUESTEDAPP = '';
        \OC_Util::redirectToDefaultPage();
    }
    if (!phpCAS::isAuthenticated() && !OCP\User::isLoggedIn()) {
        \OC_App::registerLogIn(array('href' => '?app=user_cas', 'name' => 'CAS Login'));
    }
}
/**
 * Check if login should be enforced using user_cas
 */
function shouldEnforceAuthentication()
{
    if (OC::$CLI) {
        return false;
    }
    if (OCP\Config::getAppValue('user_cas', 'cas_force_login', false) !== 'on') {
        return false;
    }
    if (OCP\User::isLoggedIn() || isset($_GET['admin_login'])) {
        return false;
コード例 #2
0
ファイル: app.php プロジェクト: EUDAT-B2DROP/user_shibboleth
 *
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library. If not, see <http://www.gnu.org/licenses/>.
 */
require_once OC_App::getAppPath('user_shibboleth') . '/appinfo/bootstrap.php';
OCP\App::registerAdmin('user_shibboleth', 'settings');
OCP\App::registerPersonal('user_shibboleth', 'personal');
// register user backend
OC_User::useBackend(new OCA\user_shibboleth\UserShibboleth());
// add settings page to navigation
$entry = array('id' => 'user_shibboleth_settings', 'order' => 1, 'href' => OCP\Util::linkTo('user_shibboleth', 'settings.php'), 'name' => 'Shibboleth Authentication');
//add login button
$link = OCA\user_shibboleth\LoginLib::getForwardingPageUrl();
$buttonText = 'Shibboleth';
$federationName = OCP\Config::getAppValue('user_shibboleth', 'federation_name', '');
if ($federationName !== '') {
    $buttonText .= ' – ' . $federationName;
}
$shibbolethLogin = array('href' => $link, 'name' => $buttonText);
OC_App::registerLogIn($shibbolethLogin);
コード例 #3
0
<?php

/**
 * ownCloud - registration
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author Pellaeon Lin <*****@*****.**>
 * @copyright Pellaeon Lin 2014
 */
namespace OCA\Registration\App;

$app = new Registration();
$c = $app->getContainer();
\OC_App::registerLogIn(array('name' => $c->query('L10N')->t('Register'), 'href' => $c->query('URLGenerator')->linkToRoute('registration.register.askEmail')));
\OCP\App::registerAdmin($c->getAppName(), 'admin');
コード例 #4
0
ファイル: app.php プロジェクト: jeanaimar2/user_servervars2
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
namespace OCA\User_Servervars2\AppInfo;

$app = new ConfigApp();
$c = $app->getContainer();
$appName = 'user_servervars2';
if (!\OCP\App::isEnabled($appName)) {
    return;
}
//To put a template into admin menu
\OCP\App::registerAdmin('user_servervars2', 'settings/admin');
\OCP\App::registerPersonal('user_servervars2', 'settings/user');
$login = array('href' => $app->getAppConfig()->getValue('user_servervars2', 'sso_url'), 'name' => $app->getAppConfig()->getValue('user_servervars2', 'button_name', 'Use Your ID Provider'));
\OC_App::registerLogIn($login);
$app->getUserManager()->registerBackend($c->query('UserBackend'));
//$app->getGroupManager()->addBackend( new \OC_Group_Database() );
$c->query('ServerVarsHooks')->register($app->getUserSession());
$authStatus = $c->isLoggedIn();
// - trigger authentication -
// http://localhost/core/index.php?XDEBUG_SESSION_START=sublime.xdebug&app=usv2&debug=1
//-- TRIGGERS --
$interceptor = $c->query('Interceptor');
$interceptor->run();
コード例 #5
0
ファイル: app.php プロジェクト: mirekys/user_shib
$c = $app->getContainer();
// It is not necessary to activate Shibboleth backend
// for these URLs. The list comes from here:
// https://doc.owncloud.com/server/8.2/admin_manual/enterprise_user_management/user_auth_shibboleth.html#apache-configuration
$nonShibUrls = '^/' . '(status.php' . '|remote.php' . '|index.php/s/' . '|public.php' . '|cron.php' . '|core/img/' . '|index.php/apps/files_sharing/ajax/publicpreview.php$' . '|index.php/apps/files/ajax/upload.php$' . '|apps/files/templates/fileexists.html$' . '|index.php/apps/files/ajax/mimeicon.php$' . '|apps/gallery/templates/slideshow.html$' . '|index.php/apps/gallery/ajax/getimages.php' . '|index.php/apps/gallery/ajax/thumbnail.php' . '|index.php/apps/gallery/ajax/image.php' . '|.*\\.css$' . '|.*\\.js$' . '|.*\\.woff$' . '|index.php/settings/personal/changepassword' . '|ocs' . ')';
$nonShibRegex = '/' . str_replace('/', '\\/', $nonShibUrls) . '/i';
$request = $c->query('Request');
$requestUri = $request->getRequestUri();
if (!\OC::$CLI && !preg_match($nonShibRegex, $requestUri)) {
    // Register itself as User Backend
    $c->query('UserManager')->registerBackend($c->query('UserBackend'));
    // Register Hooks
    $c->query('UserHooks')->register();
    $c->query('UserHooks')->registerPostSetPassword();
    // Prepare login URL with possible redirect URL
    $urlGen = $c->query('URLGenerator');
    $urlParams = $request->getParams();
    if (array_key_exists('redirect_url', $urlParams)) {
        $loginRoute = $urlGen->linkToRoute('user_shib.session.login', array('redirect_url' => $urlParams['redirect_url'], 'requesttoken' => \OCP\Util::callRegister()));
    } else {
        $loginRoute = $urlGen->linkToRoute('user_shib.session.login', array('requesttoken' => \OCP\Util::callRegister()));
    }
    // Templates registration
    // TODO: Couldn't find an \OCP way for achieving this
    \OC_App::registerLogIn(array('name' => 'Shibboleth Login', 'href' => $loginRoute));
    \OCP\App::registerAdmin($c->query('AppName'), 'admin');
    \OCP\App::registerPersonal($c->query('AppName'), 'personal');
} elseif ($requestUri === '/index.php/settings/personal/changepassword') {
    // Register only Non-Shib Hook for password setting
    $c->query('UserHooks')->registerPostSetPassword();
}