Example #1
0
<?php

namespace AU\CASAuth;

/*
 * by the time this file is called,
 * the user is either returning from CAS
 * or else is a local login
 */
// need to grab the ticket first because it seems to get pulled out later down the line
$ticket = get_input('ticket');
$redirect_url = urldecode(get_input('redirectURL'));
// get plugin configuration
$plugin_settings = elgg_get_plugin_from_id('au_cas_auth');
// grab cas url
$cas_url = build_cas_url($redirect_url, true);
// if no ticket, redirect to cas
if (empty($ticket)) {
    // register error and redirect
    register_error(elgg_echo('au_cas_auth:failed:auth'));
    forward($redirect_url);
} else {
    // if ticket, has been to cas already
    // set request var for phpCAS library to use
    $_REQUEST['ticket'] = $ticket;
}
// check cas result
$ldap_username = check_cas_result($plugin_settings);
// if no username returned, something went wrong, not sure what
if (!$ldap_username) {
    register_error("ERROR: Failed authenticating user.");
Example #2
0
<?php

namespace AU\CASAuth;

/**
 * Elgg login form
 *
 * @package Elgg
 * @subpackage Core
 */
elgg_require_js('au_cas_auth/login');
$plugin_settings = elgg_get_plugin_from_id(PLUGIN_ID);
// grab casurl
$cas_url = build_cas_url('', FALSE);
?>

<div>
	<h2><?php 
echo elgg_echo('cas:au_login');
?>
</h2>
	<p class="loginbox"><?php 
echo elgg_echo('cas:au_login:description');
?>
</p>
	<a href="<?php 
echo $cas_url;
?>
"><?php 
echo elgg_echo('cas:login');
?>