Add SSO feature
To add SSO login I add user in Vtiger and in FreeIPA Domain. Configure SSO authentication in my web server and apply this patch:
diff --git a/config.php b/config.php
index 36dbac1..6d0f251 100644
--- a/config.php
+++ b/config.php
@@ -19,5 +19,5 @@
*/
include('config.inc.php');
-
-?>
\ No newline at end of file
+$AUTHCFG['authType'] = 'SSO';
+?>
diff --git a/modules/Users/Users.php b/modules/Users/Users.php
index 55e23c1..8f2e3af 100644
--- a/modules/Users/Users.php
+++ b/modules/Users/Users.php
@@ -357,7 +357,16 @@ class Users extends CRMEntity {
}
return true;
}
- break;
+ break;
+
+ case 'SSO':
+ $this->log->debug("Using SSO authentication");
+ if (!empty($_SERVER['PHP_AUTH_USER']) && ($_SERVER['PHP_AUTH_USER'] == $usr_name)){
+ return true;
+ }
+ return false;
+ }
+ break;
case 'AD':
$this->log->debug("Using Active Directory authentication");
diff --git a/modules/Users/actions/Login.php b/modules/Users/actions/Login.php
index c38341e..9ca030a 100644
--- a/modules/Users/actions/Login.php
+++ b/modules/Users/actions/Login.php
@@ -20,7 +20,12 @@ class Users_Login_Action extends Vtiger_Action_Controller {
}
function process(Vtiger_Request $request) {
- $username = $request->get('username');
+ if (!empty($_SERVER['PHP_AUTH_USER'])){
+ $username = $_SERVER['PHP_AUTH_USER'];
+ }
+ else {
+ $username = $request->get('username');
+ }
$password = $request->getRaw('password');
$user = CRMEntity::getInstance('Users');
After apply this patch user can login just click login button without enter login/password. SSO works only if variable "PHP_AUTH_USER" exist.