Loading cli/authcli.cpp +1 −1 Changes for cli/authcli.cpp: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ void addclient(int argc,char **argv){ con.setUserPassword(cmdc.getCmdbyKey("password")->getValue()); authdb::client::Client clt(con); if(clt.UserAuth()) clt.addConnection(cmdc.getCmdbyKey("name")->getValue(),cmdc.getCmdbyKey("secret")->getValue()); } Loading client/client.cpp +3 −3 Changes for client/client.cpp: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -454,10 +454,10 @@ void authdb::client::Client::addConnection(const std::string &clientname,const s json_object *addclt=json_object_new_object(); json_object_object_add(obj,"usersession", json_object_new_string(_Con.getSessionID().c_str())); json_object_object_add(obj,"addclient", addclt); json_object_object_add(obj,"addconnection", addclt); json_object_object_add(addclt,"name",json_object_new_string(clientname.c_str())); json_object_object_add(addclt,"secret",json_object_new_string(cltsecret.c_str())); json_object_object_add(addclt,"clientname",json_object_new_string(clientname.c_str())); json_object_object_add(addclt,"clientsecret",json_object_new_string(cltsecret.c_str())); json_object_array_add(cmd,obj); json_object_object_add(jresponse,"commands",cmd); Loading src/api.cpp +2 −52 Changes for src/api.cpp: 2 added lines, 52 removed lines. Original line number Diff line number Diff line Loading @@ -70,54 +70,6 @@ namespace authdb { } } void addClient(json_object *request,json_object *response){ json_object *cmd=json_object_object_get(request,"commands"); if(!cmd) throw(AuthBackendError("Invalid Api Commands")); int fcount = json_object_array_length(cmd); for(int i =0; i<fcount; ++i) { json_object_object_foreach(json_object_array_get_idx(cmd,i), key, val) { if(strcmp(key,"addclient")==0){ std::string name,secret; int ocount = json_object_object_length(val); for(int ii =0; ii<ocount; ++ii) { json_object_object_foreach(val,okey,oval){ if(strcmp(okey,"name")==0){ name=json_object_get_string(oval); }else if(strcmp(okey,"secret")==0){ secret=json_object_get_string(oval); } } } if(secret.empty() || name.empty()){ continue; } authdb::uuid uclt; uclt.generate(); class authdb::ClientData cltdat(uclt); authdb::Client clt; cltdat.setName(name.c_str()); cltdat.setKey(secret.c_str()); clt.create(_Backend,&cltdat); json_object *respid=json_object_new_object(); json_object *value=json_object_new_object(); json_object_object_add(value,"clientid",json_object_new_string(uclt.c_str())); json_object_object_add(respid,"addclient",value); json_object_array_add(response,respid); } } } } const SessionData *checkUser(json_object *request,json_object *response){ json_object *cmd=json_object_object_get(request,"commands"); Loading Loading @@ -313,6 +265,8 @@ namespace authdb { if(!cmd || json_object_get_type(cmd)!=json_type::json_type_array) throw(AuthBackendError("Invalid Api Commands")); std::cout << "test" << std::endl; int fcount = json_object_array_length(cmd); for(int i =0; i<fcount; ++i) { json_object_object_foreach(json_object_array_get_idx(cmd,i), key, val) { Loading Loading @@ -532,10 +486,6 @@ namespace authdb { remSession(jrequest,jresponse); } if(curcon){ addClient(jrequest,jresponse); } size_t outsize=0; const char *out=json_object_to_json_string_length(jresponse,0,&outsize); Loading Loading
cli/authcli.cpp +1 −1 Changes for cli/authcli.cpp: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ void addclient(int argc,char **argv){ con.setUserPassword(cmdc.getCmdbyKey("password")->getValue()); authdb::client::Client clt(con); if(clt.UserAuth()) clt.addConnection(cmdc.getCmdbyKey("name")->getValue(),cmdc.getCmdbyKey("secret")->getValue()); } Loading
client/client.cpp +3 −3 Changes for client/client.cpp: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -454,10 +454,10 @@ void authdb::client::Client::addConnection(const std::string &clientname,const s json_object *addclt=json_object_new_object(); json_object_object_add(obj,"usersession", json_object_new_string(_Con.getSessionID().c_str())); json_object_object_add(obj,"addclient", addclt); json_object_object_add(obj,"addconnection", addclt); json_object_object_add(addclt,"name",json_object_new_string(clientname.c_str())); json_object_object_add(addclt,"secret",json_object_new_string(cltsecret.c_str())); json_object_object_add(addclt,"clientname",json_object_new_string(clientname.c_str())); json_object_object_add(addclt,"clientsecret",json_object_new_string(cltsecret.c_str())); json_object_array_add(cmd,obj); json_object_object_add(jresponse,"commands",cmd); Loading
src/api.cpp +2 −52 Changes for src/api.cpp: 2 added lines, 52 removed lines. Original line number Diff line number Diff line Loading @@ -70,54 +70,6 @@ namespace authdb { } } void addClient(json_object *request,json_object *response){ json_object *cmd=json_object_object_get(request,"commands"); if(!cmd) throw(AuthBackendError("Invalid Api Commands")); int fcount = json_object_array_length(cmd); for(int i =0; i<fcount; ++i) { json_object_object_foreach(json_object_array_get_idx(cmd,i), key, val) { if(strcmp(key,"addclient")==0){ std::string name,secret; int ocount = json_object_object_length(val); for(int ii =0; ii<ocount; ++ii) { json_object_object_foreach(val,okey,oval){ if(strcmp(okey,"name")==0){ name=json_object_get_string(oval); }else if(strcmp(okey,"secret")==0){ secret=json_object_get_string(oval); } } } if(secret.empty() || name.empty()){ continue; } authdb::uuid uclt; uclt.generate(); class authdb::ClientData cltdat(uclt); authdb::Client clt; cltdat.setName(name.c_str()); cltdat.setKey(secret.c_str()); clt.create(_Backend,&cltdat); json_object *respid=json_object_new_object(); json_object *value=json_object_new_object(); json_object_object_add(value,"clientid",json_object_new_string(uclt.c_str())); json_object_object_add(respid,"addclient",value); json_object_array_add(response,respid); } } } } const SessionData *checkUser(json_object *request,json_object *response){ json_object *cmd=json_object_object_get(request,"commands"); Loading Loading @@ -313,6 +265,8 @@ namespace authdb { if(!cmd || json_object_get_type(cmd)!=json_type::json_type_array) throw(AuthBackendError("Invalid Api Commands")); std::cout << "test" << std::endl; int fcount = json_object_array_length(cmd); for(int i =0; i<fcount; ++i) { json_object_object_foreach(json_object_array_get_idx(cmd,i), key, val) { Loading Loading @@ -532,10 +486,6 @@ namespace authdb { remSession(jrequest,jresponse); } if(curcon){ addClient(jrequest,jresponse); } size_t outsize=0; const char *out=json_object_to_json_string_length(jresponse,0,&outsize); Loading