2 /** External authentication via A-Select for Gforge
4 * This file is part of Gforge
6 * This plugin, like Gforge, is free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * GForge is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GForge; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
22 require_once $gfplugins.'aselectextauth/include/Aselect.class.php';
25 class ASelectextauthPlugin extends Plugin {
26 function ASelectextauthPlugin () {
28 $this->name = "aselectextauth";
29 $this->hooks[] = "session_set_entry";
32 function CallHook ($hookname, $params) {
36 case "session_set_entry":
38 $Aselect = new Aselect();
39 $loginname = strtolower($Aselect->getUserName());//Since A-Select UserID is
40 //not case sensitive we pass it to lower case
43 $this->AuthUser($loginname, $passwd) ;
50 function AuthUser ($loginname, $passwd) {
58 $u = user_get_object_by_name ($loginname) ;
61 if($u->getStatus()=='A'){ //we check if it's active
62 $user_id = $u->getID();
63 session_set_new($user_id); //create session cookie
64 $GLOBALS['aselect_auth_failed']=false;
67 $GLOBALS['aselect_auth_failed']=true;
71 $GLOBALS['aselect_auth_failed']=true;
82 // c-file-style: "bsd"