[Fusionforge-commits] r12759 - in trunk/src/plugins: authcas/etc authcas/include authcas/www ldapextauth/include
Roland Mas
lolando at fusionforge.org
Mon Mar 14 17:49:51 CET 2011
Author: lolando
Date: 2011-03-14 17:49:51 +0100 (Mon, 14 Mar 2011)
New Revision: 12759
Modified:
trunk/src/plugins/authcas/etc/authcas.ini
trunk/src/plugins/authcas/include/AuthCASPlugin.class.php
trunk/src/plugins/authcas/www/post-login.php
trunk/src/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php
Log:
Fixes
Modified: trunk/src/plugins/authcas/etc/authcas.ini
===================================================================
--- trunk/src/plugins/authcas/etc/authcas.ini 2011-03-14 16:49:36 UTC (rev 12758)
+++ trunk/src/plugins/authcas/etc/authcas.ini 2011-03-14 16:49:51 UTC (rev 12759)
@@ -11,3 +11,4 @@
cas_server = cas.example.com
cas_port = 443
cas_version = 2.0
+validate_server_certificate = no
Modified: trunk/src/plugins/authcas/include/AuthCASPlugin.class.php
===================================================================
--- trunk/src/plugins/authcas/include/AuthCASPlugin.class.php 2011-03-14 16:49:36 UTC (rev 12758)
+++ trunk/src/plugins/authcas/include/AuthCASPlugin.class.php 2011-03-14 16:49:51 UTC (rev 12759)
@@ -54,6 +54,12 @@
forge_get_config('cas_server', $this->name),
intval(forge_get_config('cas_port', $this->name)),
'');
+ if (forge_get_config('validate_server_certificate', $this->name)) {
+ // TODO
+ } else {
+ phpCAS::setNoCasServerValidation();
+ }
+
self::$init = true;
}
@@ -84,9 +90,9 @@
$user_id_from_cookie = $this->checkSessionCookie();
if ($user_id_from_cookie) {
$user = user_get_object($user_id_from_cookie);
+ $this->login($user->getUnixName());
} elseif (phpCAS::isAuthenticated()) {
- $user = user_get_object_by_name(phpCAS::getUser());
- $this->login($user);
+ $this->login(phpCAS::getUser());
}
if ($user) {
@@ -130,6 +136,8 @@
forge_define_config_item ('cas_port', $this->name, 443);
forge_define_config_item ('cas_version', $this->name, '2.0');
+ forge_define_config_item('validate_server_certificate', $this->name, 'no');
+ forge_set_config_item_bool('validate_server_certificate', $this->name);
}
}
Modified: trunk/src/plugins/authcas/www/post-login.php
===================================================================
--- trunk/src/plugins/authcas/www/post-login.php 2011-03-14 16:49:36 UTC (rev 12758)
+++ trunk/src/plugins/authcas/www/post-login.php 2011-03-14 16:49:51 UTC (rev 12759)
@@ -65,30 +65,43 @@
header('Location: https://'.getStringFromServer('HTTP_HOST').getStringFromServer('REQUEST_URI'));
}
-// Start authentication proper
-if ($login) { // The user just clicked the Login button
- // Let's send them to CAS
+$plugin->initCAS();
- $plugin->initCAS();
- $return_url = util_make_url('/plugins/authcas/post-login.php?postcas=true&return_to='.htmlspecialchars($return_to));
-
- $GLOBALS['PHPCAS_CLIENT']->setURL($return_url);
-
- phpCAS::forceAuthentication();
-
-} elseif ($postcas) { // The user is coming back from CAS
- if (phpCAS::isAuthenticated()) {
- if ($plugin->isSufficient()) {
- $plugin->login($form_loginname);
- }
- if ($return_to) {
- header ("Location: " . util_make_url($return_to));
- exit;
- } else {
- header ("Location: " . util_make_url("/my"));
- exit;
- }
+if (phpCAS::isAuthenticated()) {
+ if ($plugin->isSufficient()) {
+ $plugin->login(phpCAS::getUser());
}
+ if ($return_to) {
+ header ("Location: " . util_make_url($return_to));
+ exit;
+ } else {
+ header ("Location: " . util_make_url("/my"));
+ exit;
+ }
+} else {
+ if ($login) { // The user just clicked the Login button
+ // Let's send them to CAS
+
+ $return_url = util_make_url('/plugins/authcas/post-login.php?postcas=true&return_to='.htmlspecialchars($return_to));
+
+ $GLOBALS['PHPCAS_CLIENT']->setURL($return_url);
+
+ phpCAS::forceAuthentication();
+
+ } elseif ($postcas) { // The user is coming back from CAS
+ if (phpCAS::isAuthenticated()) {
+ if ($plugin->isSufficient()) {
+ $plugin->login(phpCAS::getUser());
+ }
+ if ($return_to) {
+ header ("Location: " . util_make_url($return_to));
+ exit;
+ } else {
+ header ("Location: " . util_make_url("/my"));
+ exit;
+ }
+ }
+ }
}
// Otherwise, display the login form again
Modified: trunk/src/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php
===================================================================
--- trunk/src/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php 2011-03-14 16:49:36 UTC (rev 12758)
+++ trunk/src/plugins/ldapextauth/include/LdapExtAuthPlugin.class.php 2011-03-14 16:49:51 UTC (rev 12759)
@@ -108,7 +108,7 @@
foreach (explode(',', forge_get_config('mapping', $this->name))
as $map_entry) {
list ($fffield, $ldapfield) = explode('=',$map_entry);
- $user_data[$fffield] = $this->data[$ldapfield][0];
+ $user_data[$fffield] = $data[$ldapfield][0];
}
if (!$u->create ($user_data['unix_name'],
@@ -161,7 +161,7 @@
foreach (explode(',', forge_get_config('mapping', $this->name))
as $map_entry) {
list ($fffield, $ldapfield) = explode('=',$map_entry);
- $mapped_data[$fffield] = $this->saved_data[$ldapfield][0];
+ $mapped_data[$fffield] = $data[$ldapfield][0];
}
$u->update($mapped_data['firstname'],
@@ -241,7 +241,7 @@
foreach (explode(',', forge_get_config('mapping', $this->name))
as $map_entry) {
list ($fffield, $ldapfield) = explode('=',$map_entry);
- if ($fffield = 'username') {
+ if ($fffield == 'username') {
$fieldname = $ldapfield;
}
}
More information about the Fusionforge-commits
mailing list