more authserver code
[ga4php.git] / authserver / usercmd.php
1 <?php
2 /*
3  * 
4  * 
5  * This file is designed as a "script" extension to freeradius (or some such tool) for radius authentication.
6  * Also provided is a simple web interface for managing users in freeradius.
7  * 
8  * The simple web interface should also provide a mechanism for configuring freeradius itself
9  * 
10  */
11
12 require_once("lib/authClient.php");
13
14 $myAC = new GAAuthClient();
15
16 /*
17 define("MSG_AUTH_USER_TOKEN", 1);
18 define("MSG_ADD_USER_TOKEN", 2);
19 define("MSG_DELETE_USER", 3);
20 define("MSG_AUTH_USER_PASSWORD", 4);
21 define("MSG_SET_USER_PASSWORD", 5);
22 define("MSG_SET_USER_REALNAME", 6);
23 define("MSG_SET_USER_TOKEN", 7);
24 define("MSG_SET_USER_TOKEN_TYPE", 8);
25
26  */
27 if(!isset($argv[1])) {
28         echo "Usage: ".$argv[0]." command username [args]\n";
29         echo "\tadd: add <username> - returns token code url\n";
30         echo "\tauth: auth <username> <passcode> - returns 0/1 for pass/fail\n";
31         echo "\tdelete: delete <username> - deletes user\n";
32         echo "\tauthpass: authpass <username> <password> - returns 0/1 for pass/fail\n";
33         echo "\tsetpass: setpass <username> <password> - sets a password for a user (x to remove pass)\n";
34         echo "\tsetname: setname <username> <realname> - sets the real name for a user\n";
35         echo "\tsettoken: settoken <username> <tokenkey> - sets the key (hex) for a token\n";
36         echo "\tsettype: settype <username> <tokentype> - sets a token type for a user\n";
37         return 0;       
38 }
39
40 switch($argv[1]) {
41         case "auth":
42                 if($myAC->authUser($argv[2], $argv[3])==1) {
43                         echo "Pass!";
44                 } else {
45                         echo "Fail!";
46                 }
47                 break;
48         case "add":
49                 $myAC->addUser($argv[2]);
50                 break;
51         case "delete":
52                 break;
53         case "authpass":
54                 break;
55         case "setpass":
56                 break;
57         case "setname":
58                 break;
59         case "settoken":
60                 break;
61         case "settype":
62                 break;
63 }
64 ?>