Loading client/client.cpp +5 −0 Changes for client/client.cpp: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -448,5 +448,10 @@ bool authdb::client::Client::GPOcheck(class uuid gpoid){ } void authdb::client::Client::addConnection(const std::string &clientname,const std::string &cltsecret){ json_object *jresponse = json_object_new_object(); json_object *cmd=json_object_new_array(); json_object *obj=json_object_new_object(); json_object_object_add(obj,"clientsession", json_object_new_string(_Con.getClientId().c_str())); } src/api.cpp +45 −0 Changes for src/api.cpp: 45 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -70,6 +70,51 @@ 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; 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
client/client.cpp +5 −0 Changes for client/client.cpp: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -448,5 +448,10 @@ bool authdb::client::Client::GPOcheck(class uuid gpoid){ } void authdb::client::Client::addConnection(const std::string &clientname,const std::string &cltsecret){ json_object *jresponse = json_object_new_object(); json_object *cmd=json_object_new_array(); json_object *obj=json_object_new_object(); json_object_object_add(obj,"clientsession", json_object_new_string(_Con.getClientId().c_str())); }
src/api.cpp +45 −0 Changes for src/api.cpp: 45 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -70,6 +70,51 @@ 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; 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