2 * Copyright (c) 2014 <copyright holder> <email>
4 * For license details, see the LICENSE file in the root of this project.
8 #include "GSSImportName.h"
9 #include "GSSException.h"
11 void GSSImportName::execute()
13 this->outputName = GSSName(inputName, inputNameType, function);
14 this->retVal = this->outputName.getMajorStatus();
15 this->minor_status = this->outputName.getMinorStatus();
16 this->outputName.setKey("constant for now");
19 JSONObject *GSSImportName::toJSON()
22 JSONObject *ret = new JSONObject();
23 JSONObject *values = new JSONObject();
30 values->set("major_status", this->retVal);
31 values->set("minor_status", this->minor_status);
32 values->set("gss_name", this->outputName.getKey().c_str() );
33 ret->set("command", "gss_import_name");
34 ret->set("return_values", *values);
42 GSSImportName::GSSImportName(JSONObject *params, gss_imp_name_type fn) : GSSCommand(params)
48 loadParameters(params);
55 bool GSSImportName::loadParameters(JSONObject *params)
64 // Easy stuff(*params)
65 if ( params->get("arguments").isNull() )
68 if ( !params->get("arguments").get("input_name").isNull() )
70 if ( params->get("arguments").get("input_name").isString() )
72 std::string input_name = params->get("arguments").get("input_name").string();
73 this->inputName.setValue( input_name );
77 if ( !params->get("arguments").get("input_name_type").isNull() )
79 if ( params->get("arguments").get("input_name_type").isString() )
81 std::string input_name_type = params->get("arguments").get("input_name_type").string();
82 this->inputNameType.setValue( input_name_type );
95 // if ( ! params->get("arguments").get("qop_req").isNull() )
97 // if (params->get("arguments").get("qop_req").isString())
99 // sQopReq = params->get("arguments").get("qop_req").string();
100 // if (sQopReq == "GSS_C_QOP_DEFAULT")
101 // this->qop_req = GSS_C_QOP_DEFAULT;
103 // throw std::invalid_argument( std::string("Invalid QOP type given: ") + sQopReq );
104 // } else if (params->get("arguments").get("qop_req").isInteger())
105 // this->qop_req = (gss_cred_usage_t)( params->get("arguments").get("qop_req").integer() );
107 // throw std::invalid_argument( "Unrecognized argument type for qop_req." );
110 // /*****************
112 // *****************/
113 // if ( ! params->get("arguments").get("input_message").isNull() )
115 // sInputMessage = params->get("arguments").get("input_message").string();
116 // this->inputMessage.setValue(sInputMessage);