Skip to content
Permalink
Browse files

feat(src): begin to develop the new version of the module in `src`

  • Loading branch information
mbroadst committed Jun 23, 2018
1 parent ca3877a commit f45da50ae4c745ff223eee5b517a9a5e10f5b125
Showing with 176 additions and 4 deletions.
  1. +2 −4 binding.gyp
  2. +151 −0 src/kerberos.cc
  3. +23 −0 src/kerberos.h
@@ -8,8 +8,7 @@
'conditions': [
['OS=="mac" or OS=="linux"', {
'sources': [
'lib/kerberos.cc',
'lib/kerberos_unix.cc'
'src/kerberos.cc'
],
'link_settings': {
'libraries': [
@@ -20,8 +19,7 @@
}],
['OS=="win"', {
'sources': [
'lib/kerberos.cc',
'lib/kerberos_win32.cc'
'src/kerberos.cc'
]
}]
]
@@ -0,0 +1,151 @@
#include "kerberos.h"

using v8::FunctionTemplate;

class DummyWorker : public Nan::AsyncWorker {
public:
DummyWorker(Nan::Callback *callback)
: AsyncWorker(callback, "kerberos:DummyWorker") {}
~DummyWorker() {}

void Execute () {}
};

NAN_METHOD(AuthGSSClientInit) {
v8::MaybeLocal<v8::String> service = Nan::To<v8::String>(info[0]);
v8::MaybeLocal<v8::Object> options = Nan::To<v8::Object>(info[1]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[2]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSClientClean) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[1]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSClientStep) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
v8::MaybeLocal<v8::String> challenge = Nan::To<v8::String>(info[1]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[2]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSClientResponse) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[1]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSClientResponseConf) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[1]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSClientUserName) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[1]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSClientUnwrap) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
v8::MaybeLocal<v8::String> challenge = Nan::To<v8::String>(info[1]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[2]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSClientWrap) {
v8::MaybeLocal<v8::String> service = Nan::To<v8::String>(info[0]);
v8::MaybeLocal<v8::Object> options = Nan::To<v8::Object>(info[1]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[2]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSServerInit) {
v8::MaybeLocal<v8::String> service = Nan::To<v8::String>(info[0]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[2]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSServerClean) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[1]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSServerStep) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
v8::MaybeLocal<v8::String> challenge = Nan::To<v8::String>(info[1]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[2]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSServerResponse) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[1]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSServerUserName) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[1]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_METHOD(AuthGSSServerTargetName) {
v8::MaybeLocal<v8::Object> context = Nan::To<v8::Object>(info[0]);
Nan::Callback *callback = new Nan::Callback(Nan::To<v8::Function>(info[1]).ToLocalChecked());

AsyncQueueWorker(new DummyWorker(callback));
}

NAN_MODULE_INIT(Init) {
// Client
Nan::Set(target, Nan::New("authGSSClientInit").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSClientInit)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSClientClean").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSClientClean)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSClientStep").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSClientStep)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSClientResponse").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSClientResponse)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSClientResponseConf").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSClientResponseConf)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSClientUserName").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSClientUserName)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSClientUnwrap").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSClientUnwrap)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSClientWrap").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSClientWrap)).ToLocalChecked());

// Server
Nan::Set(target, Nan::New("authGSSServerInit").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSServerInit)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSServerClean").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSServerClean)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSServerStep").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSServerStep)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSServerResponse").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSServerResponse)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSServerUserName").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSServerUserName)).ToLocalChecked());
Nan::Set(target, Nan::New("authGSSServerTargetName").ToLocalChecked(),
Nan::GetFunction(Nan::New<FunctionTemplate>(AuthGSSServerTargetName)).ToLocalChecked());
}

NODE_MODULE(kerberos, Init)
@@ -0,0 +1,23 @@

#ifndef KERBEROS_NATIVE_EXTENSION_H
#define KERBEROS_NATIVE_EXTENSION_H

#include <nan.h>

NAN_METHOD(AuthGSSClientInit);
NAN_METHOD(AuthGSSClientClean);
NAN_METHOD(AuthGSSClientStep);
NAN_METHOD(AuthGSSClientResponse);
NAN_METHOD(AuthGSSClientResponseConf);
NAN_METHOD(AuthGSSClientUserName);
NAN_METHOD(AuthGSSClientUnwrap);
NAN_METHOD(AuthGSSClientWrap);

NAN_METHOD(AuthGSSServerInit);
NAN_METHOD(AuthGSSServerClean);
NAN_METHOD(AuthGSSServerStep);
NAN_METHOD(AuthGSSServerResponse);
NAN_METHOD(AuthGSSServerUserName);
NAN_METHOD(AuthGSSServerTargetName);

#endif

0 comments on commit f45da50

Please sign in to comment.
You can’t perform that action at this time.