Beispiel #1
0
function cas_auth_authenticate($credentials)
{
    elgg_load_library('elgg:cas_auth');
    $config = elgg_get_calling_plugin_entity('cas_auth');
    // Perform the authentication
    return authCAS($config, $credentials);
}
Beispiel #2
0
<?php

ini_set('display_errors', '1');
// Elgg obliterates the &ticket query paramter; we need
// to reinstate it from the $vals variable.
//$_REQUEST['ticket'] = $vals[1];
global $CONFIG, $messages, $vars;
require_once dirname(dirname(dirname(__FILE__))) . '/lib/lib.php';
// get module configuration
$config = find_plugin_settings('cas_auth');
$NetUsername = authCAS($config);
// get user details out of LDAP.
//$attr = cas_ldapSearch($NetUsername);
$casUser = cas_mysqlSearch($NetUsername);
if (!empty($casUser->username)) {
    $username = $casUser->username;
} else {
    $username = $NetUsername;
}
//$username = empty($username) ? $username : str_replace(".", "",$username);
$user = get_user_by_username($username);
if (!$user) {
    $user_guid = cas_insertUser($username, $casUser, $config);
    $user = get_user_by_username($username);
    $result = cas_do_login($user, false);
} else {
    $result = cas_do_login($user, false);
}
if ($result) {
    system_message(elgg_echo('loginok'));
    if ($_SESSION['last_forward_from']) {