#ifndef KERBEROS_CONTEXT_H #define KERBEROS_CONTEXT_H #include #include #include #include #include "nan.h" #include #include extern "C" { #include "kerberosgss.h" } using namespace v8; using namespace node; class KerberosContext : public Nan::ObjectWrap { public: KerberosContext(); ~KerberosContext(); static inline bool HasInstance(Local val) { if (!val->IsObject()) return false; Local obj = val->ToObject(); return Nan::New(constructor_template)->HasInstance(obj); }; inline bool IsClientInstance() { return state != NULL; } inline bool IsServerInstance() { return server_state != NULL; } // Constructor used for creating new Kerberos objects from C++ static Nan::Persistent constructor_template; // Initialize function for the object static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); // Public constructor static KerberosContext* New(); // Handle to the kerberos client context gss_client_state *state; // Handle to the kerberos server context gss_server_state *server_state; private: static NAN_METHOD(New); // In either client state or server state static NAN_GETTER(ResponseGetter); static NAN_GETTER(UsernameGetter); // Only in the "server_state" static NAN_GETTER(TargetnameGetter); static NAN_GETTER(DelegatedCredentialsCacheGetter); }; #endif