echo "\tsetadlogin username password domain\n";
echo "\tsetclientgroup groupname - change the group membership requirements for client's with AD\n";
echo "\tsetadmingroup groupname - change the group membership requirements for admin's with AD\n";
- echo "\tprovisiontoken username [HOTP|TOTP] [KEY]- provision the user \"username\"\n";
+ echo "\tprovisiontoken username [HOTP|TOTP] [KEY] - provision the user \"username\"\n";
echo "\tassign username tokenid - assign a hardware token to a user\n";
echo "\taddtoken token_name token_key token_type - adds a hardware token to the DB\n";
echo "\tgethwtokens - gets a list of hardware tokens by token_name\n";
if(isset($argv[3])) $partof = $argv[3];
if(isset($argv[4])) $onlytokens = $argv[4];
$ret = $myga->MSG_GET_USERS($group, $partof, $onlytokens);
- foreach($ret as $user => $real) {
- echo "$real ($user)\n";
+ foreach($ret as $key => $val) {
+ $real = $val["realname"];
+ $user = $val["username"];
+ $hastok = "";
+ if($val["hastoken"]) {
+ $hastok = " * ";
+ }
+ echo "$hastok$real ($user)\n";
}
break;
case "deleteuser":
function gaasSetADLogin_clientsend($params)
{
$msg["domain"] = $params[2];
- $msg["user"] = $params[0];
+ $msg["user"] = strtolower($params[0]);
$msg["pass"] = $params[1];
return $msg;
function gaasProvisionUser_clientsend($params)
{
- $msg["username"] = $params[0];
+ $msg["username"] = strtolower($params[0]);
$msg["tokentype"] = "";
$msg["tokenkey"] = "";
if(isset($params[1])) {
// TODO ERROR CHECK
function gaasAssignToken_clientsend($params)
{
- $msg["username"] = $params[0];
+ $msg["username"] = strtolower($params[0]);
$msg["tokenid"] = $params[1];
return $msg;
{
$msg["havetokens"] = false;
$msg["userpattern"] = "";
- $msg["group"] = "client";
+ $msg["group"] = "all";
if(isset($params[0])) {
if($params[0] == "admin") {
$msg["group"] = "admin";
}
+ if($params[0] == "client") {
+ $msg["group"] = "client";
+ }
}
if(isset($params[1])) {
$msg["userpattern"] = $params[1];
function gaasDeleteUser_clientsend($params)
{
- $msg["username"] = $params[0];
+ $msg["username"] = strtolower($params[0]);
return $msg;
}
}
-function hasToken($username)
-{
- $db = getDB();
-
- $sql = "select * from users where users_username='$username'";
- $res = $db->query($sql);
- if(!$res) return false;
- foreach($res as $row) {
- print_r($row);
- }
-
- return true;
-}
-
function createUserInDB($username, $realname)
{
$db = getDB();
if(userInGroup($msg["username"], confGetVal("ad.domain"), confGetVal("ad.user"), confGetVal("ad.pass"), confGetVal("ad.clientdef"))) {
$myga = new gaasdGA();
- // TODO - figure out how to deal with the token origin - i.e. software/hardware
- if($msg["origin"] == "hardware") {
- echo "want a hardware token, but i dont know how to do this yet\n";
- } else {
- echo "using software token\n";
- $myga->setUser($msg["username"], $ttype, "", $tkey);
- }
+ echo "using software token\n";
+ $myga->setUser($msg["username"], $ttype, "", $tkey);
} else {
echo "User not in client group\n";
}
$haveTokens = $msg["havetokens"];
$userPatter = $msg["userpattern"];
$group = $msg["group"];
+ $myga = new gaasdGA();
if(confGetval("backend") == "AD") {
$adgroup = "";
$adgroup = confGetVal("ad.admindef");
} else {
$adgroup = confGetVal("ad.clientdef");
- }
+ }
$addom = confGetVal("ad.domain");
$aduser = confGetVal("ad.user");
$adpass = confGetVal("ad.pass");
//echo "using group $adgroup for $group\n";
$users = getUsersInGroup($addom, $aduser, $adpass, $adgroup);
- foreach($users as $user => $real) {
- hasToken($user);
+ foreach($users as $key => $val) {
+ $user = $val["username"];
+ //echo "checking $user for token - ";
+ if($myga->hasToken($user)) {
+ $users[$key]["hastoken"] = true;
+ //echo "yes\n";
+ } else {
+ $users[$key]["hastoken"] = false;
+ //echo "no\n";
+ }
}
} else {
// internal db
}
+ //print_r($users);
return $users;
}
* get qrcode
* re-create user token
* set user pin
- * authenticate token
- * authenticate pin
+ * authenticate user by token
+ * authenticate user by password
*
*/
$i = 0;
foreach($info as $kpot => $lpot) {
if(isset($lpot["samaccountname"])) {
- $arbi[$lpot["samaccountname"][0]] = $lpot["name"][0];
+ $arbi[$i]["realname"] = $lpot["name"][0];
+ $arbi[$i]["username"] = strtolower($lpot["samaccountname"][0]);
+ $i++;
}
}