CAS parameters
ronpeterson - September 16, 2008 - 19:44
| Project: | CAS |
| Version: | HEAD |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
I need to include the parameter renew=true to authentic against our CAS server. I've looked all over, but I don't see any way to do that. Does anyone know how to do set up that parameter in Drupal?
Thanks.

#1
It is not something that is supported in the current version of the cas module. Patches are welcome here.
Dave
#2
To address the problem I added a new checkbox in the CAS settings:
$form['server']['cas_renew'] = array (
'#type' => 'checkbox',
'#title' => t('Force renew'),
'#default_value' => variable_get('cas_renew', 0),
'#description' => t('Check this box if you require users to renew their credentials when they login to Drupal using CAS. Or if your CAS server is configured to require the renew=true parameter.'),
);
And then if the checkbox is checked I add the renew parameter to the URL and use phpCAS::setServerLoginUrl() to update the URL used by phpCAS::forceAuthentication()
if (is_callable(array(phpCAS,'authenticateIfNeeded')))
{
phpCAS::authenticateIfNeeded();
}
else
{
// If Force Renew is checked, add renew parameter to Server Login URL
if ($cas_renew != 0) {
$ServerLoginUrl = phpCAS::getServerLoginUrl()."&renew=true";
phpCAS::setServerLoginUrl($ServerLoginUrl);
}
phpCAS::forceAuthentication();
}
I didn't use phpCAS::renewAuthentication() because it only includes the renew parameter if the user is already authenticated and the CAS server I am using for authentication requires the renew parameter for all requests.
See attached for updated file.
#3
FYI: The reason that this hasn't gone anywhere is that this is not in patch format, but rather includes the whole module. I'll try and integrate this functionality if I have time, but it would be great if you created a regular patch from the HEAD CVS file. See the Handbooks for more information about how to do this.
#4
#5
Here is a proper patch against the HEAD