04b625a9204086e3e4d92c927d4fa23acb794674
[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 );
23     ~GSSAcquireCred();
24     
25     GSSAcquireCred& operator= ( const GSSAcquireCred& other );
26     
27     virtual void execute();
28     virtual JSONObject* toJSON();
29     
30     gss_acq_cred_type getGSSFunction() { return function; };
31     
32     void addDesiredMech ( const GSSOID &newOID ) { this->desiredMechs.addOID(newOID.toGss()); }
33     
34     // Getters & Setters
35     void setDesiredName(const GSSName &name) { this->desired_name = name; }
36     void setTimeReq(OM_uint32 request) { this->time_req = request; }
37     void setCredUsage ( OM_uint32 credential_usage ) {this->cred_usage = credential_usage; }
38     
39     GSSName getDesiredName() { return(desired_name); }
40     OM_uint32 getTimeReq() { return(time_req); }
41     gss_cred_id_t getOutputCredHandle() const { return( cred.toGss() ); }
42     OM_uint32 getRetVal() { return(retVal); }
43     OM_uint32 getMinorStatus() { return(minor_status); }
44     gss_OID_set getDesiredMechs() const { return(desiredMechs.toGss()); }
45     gss_cred_usage_t getCredUsage() const { return(cred_usage); }
46     gss_OID_set getActualMechs() const { return( actualMechs.toGss() ); }
47     OM_uint32 getTimeRec() { return(time_rec); }
48     
49 private:
50     GSSName          desired_name;
51     GSSCredential    cred;
52     OM_uint32        time_req, time_rec;
53     GSSOIDSet        desiredMechs;
54     GSSOIDSet        actualMechs;
55     gss_cred_usage_t cred_usage;
56     OM_uint32        retVal, minor_status;
57     
58     gss_acq_cred_type function;
59
60 };
61
62 #endif // GSSACQUIRECREDCOMMAND_H