API Change:

Add a new API call to the sysadm-server: rpc/identify (no arguments)
This generates a responce identifying the type of sysadm system ("server" in this case). This will be important and I am going to be adding this same API call to all the various sysadm utilities so they can identify which one they are ("server", "bridge", "client").

REST Request:
-------------------------------
PUT /rpc/identify
{}

WebSocket Request:
-------------------------------
{
   "args" : {},
   "namespace" : "rpc",
   "id" : "fooid",
   "name" : "identify"
}

Response:
-------------------------------
{
  "args": {
    "type": "server"
  },
  "id": "fooid",
  "name": "response",
  "namespace": "rpc"
}
This commit is contained in:
Ken Moore
2016-05-03 10:26:08 -04:00
parent 26f54ff4f0
commit f7333470a9

View File

@@ -121,8 +121,8 @@ void WebSocket::EvaluateREST(QString msg){
this->sendReply(out.assembleMessage());
}else{
//EvaluateRequest(IN);
if(IN.name.startsWith("auth") ){
//Keep auth system requests in order
if(IN.name.startsWith("auth") || (IN.namesp.toLower()=="rpc" && IN.name.toLower()=="identify") ){
//Keep auth/pre-auth system requests in order
EvaluateRequest(IN);
}else{
QtConcurrent::run(this, &WebSocket::EvaluateRequest, IN);
@@ -153,7 +153,12 @@ void WebSocket::EvaluateRequest(const RestInputStruct &REQ){
//Now check the body of the message and do what it needs
if(out.in_struct.namesp.toLower() == "rpc"){
if(out.in_struct.name.startsWith("auth")){
if(out.in_struct.name == "identify"){
QJsonObject obj;
obj.insert("type", "server");
out.out_args = obj;
out.CODE = RestOutputStruct::OK;
}else if(out.in_struct.name.startsWith("auth")){
//Now perform authentication based on type of auth given
//Note: This sets/changes the current SockAuthToken
AUTHSYSTEM->clearAuth(SockAuthToken); //new auth requested - clear any old token