Update loadParameters to check for JSON value type, NULL
[gssweb.git] / json_gssapi / src / GSSAcquireCred.h
1 /*
2  * Copyright (c) 2014 <copyright holder> <email>
3  *
4  * For license details, see the LICENSE file in the root of this project.
5  *
6  */
7
8 #ifndef GSSACQUIRECREDCOMMAND_H
9 #define GSSACQUIRECREDCOMMAND_H
10
11 #include "GSSCommand.h"
12 #include "datamodel/GSSCredential.h"
13 #include "datamodel/GSSOIDSet.h"
14 #include "datamodel/GSSName.h"
15 #include <gssapi/gssapi.h>
16
17 class GSSAcquireCred :  GSSCommand
18 {
19 public:
20     GSSAcquireCred( gss_acq_cred_type fn = &gss_acquire_cred );
21     GSSAcquireCred ( const GSSAcquireCred& other );
22     GSSAcquireCred ( JSONObject *params, gss_acq_cred_type fn = &gss_acquire_cred );
23     ~GSSAcquireCred();
24     
25     GSSAcquireCred& operator= ( const GSSAcquireCred& other );
26     
27     virtual void execute();
28     virtual JSONObject* toJSON();
29     bool loadParameters(JSONObject *params);
30     
31     gss_acq_cred_type getGSSFunction() { return function; };
32     
33     void addDesiredMech ( const GSSOID &newOID ) { this->desiredMechs.addOID(newOID.toGss()); }
34     
35     // Getters & Setters
36     void setDesiredName(const GSSName &name) { this->desired_name = name; }
37     void setTimeReq(OM_uint32 request) { this->time_req = request; }
38     void setCredUsage ( OM_uint32 credential_usage ) {this->cred_usage = credential_usage; }
39     
40     GSSName getDesiredName() { return(desired_name); }
41     OM_uint32 getTimeReq() { return(time_req); }
42     gss_cred_id_t getOutputCredHandle() const { return( cred.toGss() ); }
43     OM_uint32 getRetVal() { return(retVal); }
44     OM_uint32 getMinorStatus() { return(minor_status); }
45     gss_OID_set getDesiredMechs() const { return(desiredMechs.toGss()); }
46     gss_cred_usage_t getCredUsage() const { return(cred_usage); }
47     gss_OID_set getActualMechs() const { return( actualMechs.toGss() ); }
48     OM_uint32 getTimeRec() { return(time_rec); }
49     
50 private:
51     GSSName          desired_name;
52     GSSCredential    cred;
53     OM_uint32        time_req, time_rec;
54     GSSOIDSet        desiredMechs;
55     GSSOIDSet        actualMechs;
56     gss_cred_usage_t cred_usage;
57     OM_uint32        retVal, minor_status;
58     
59     gss_acq_cred_type function;
60
61 };
62
63 #endif // GSSACQUIRECREDCOMMAND_H