2 * Copyright (c) 2014, JANET(UK)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of JANET(UK) nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
31 * OF THE POSSIBILITY OF SUCH DAMAGE.
35 #ifndef GSSACQUIRECREDCOMMAND_H
36 #define GSSACQUIRECREDCOMMAND_H
38 #include "GSSCommand.h"
39 #include "datamodel/GSSCredential.h"
40 #include "datamodel/GSSOIDSet.h"
41 #include "datamodel/GSSName.h"
42 #include <gssapi/gssapi.h>
44 class GSSAcquireCred : public GSSCommand
47 GSSAcquireCred( gss_acq_cred_type fn = &gss_acquire_cred );
48 GSSAcquireCred ( const GSSAcquireCred& other );
49 GSSAcquireCred ( JSONObject *params, gss_acq_cred_type fn = &gss_acquire_cred );
52 GSSAcquireCred& operator= ( const GSSAcquireCred& other );
54 virtual void execute();
55 virtual JSONObject* toJSON();
56 bool loadParameters(JSONObject *params);
58 gss_acq_cred_type getGSSFunction() { return function; };
60 void addDesiredMech ( const GSSOID &newOID ) { this->desiredMechs.addOID(newOID.toGss()); }
63 void setDesiredName(const GSSName &name) { this->desired_name = name; }
64 void setTimeReq(OM_uint32 request) { this->time_req = request; }
65 void setCredUsage ( OM_uint32 credential_usage ) {this->cred_usage = credential_usage; }
67 GSSName getDesiredName() { return(desired_name); }
68 OM_uint32 getTimeReq() { return(time_req); }
69 gss_cred_id_t getOutputCredHandle() const { return( cred.toGss() ); }
70 OM_uint32 getRetVal() { return(retVal); }
71 OM_uint32 getMinorStatus() { return(minor_status); }
72 gss_OID_set getDesiredMechs() const { return(desiredMechs.toGss()); }
73 gss_cred_usage_t getCredUsage() const { return(cred_usage); }
74 gss_OID_set getActualMechs() const { return( actualMechs.toGss() ); }
75 OM_uint32 getTimeRec() { return(time_rec); }
80 OM_uint32 time_req, time_rec;
81 GSSOIDSet desiredMechs;
82 GSSOIDSet actualMechs;
83 gss_cred_usage_t cred_usage;
84 OM_uint32 retVal, minor_status;
86 gss_acq_cred_type function;
92 #endif // GSSACQUIRECREDCOMMAND_H