#ifndef SECURITY_CREDENTIALS_H #define SECURITY_CREDENTIALS_H #include #include #include #define SECURITY_WIN32 1 #include #include #include #include #include #include "../worker.h" #include extern "C" { #include "../kerberos_sspi.h" } // SEC_WINNT_AUTH_IDENTITY makes it unusually hard // to compile for both Unicode and ansi, so I use this macro: #ifdef _UNICODE #define USTR(str) (str) #else #define USTR(str) ((unsigned char*)(str)) #endif using namespace v8; using namespace node; class SecurityCredentials : public Nan::ObjectWrap { public: SecurityCredentials(); ~SecurityCredentials(); // Pointer to context object SEC_WINNT_AUTH_IDENTITY m_Identity; // credentials CredHandle m_Credentials; // Expiry time for ticket TimeStamp Expiration; // Has instance check static inline bool HasInstance(Local val) { if (!val->IsObject()) return false; Local obj = val->ToObject(); return Nan::New(constructor_template)->HasInstance(obj); }; // Functions available from V8 static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); static NAN_METHOD(Acquire); // Constructor used for creating new Long objects from C++ static Nan::Persistent constructor_template; private: // Create a new instance static NAN_METHOD(New); // Handles the uv calls static void Process(uv_work_t* work_req); // Called after work is done static void After(uv_work_t* work_req); }; #endif