@@ -36,6 +36,24 @@ function validateParameter(parameter, spec) {
36
36
}
37
37
}
38
38
39
+ /**
40
+ * This function returns the service principal for the server given a service
41
+ * type and hostname.
42
+ *
43
+ * Details are looked up via the `/etc/keytab` file.
44
+ *
45
+ * @param {string } service The Kerberos service type for the server.
46
+ * @param {string } hostname The hostname of the server.
47
+ * @param {function } callback
48
+ */
49
+ function serverPrincipalDetails ( service , hostname , callback ) {
50
+ validateParameter ( service , { name : 'service' , type : 'string' } ) ;
51
+ validateParameter ( hostname , { name : 'options' , type : 'string' } ) ;
52
+ validateParameter ( callback , { name : 'callback' , type : 'function' } ) ;
53
+
54
+ kerberos . serverPrincipalDetails ( service , hostname , callback ) ;
55
+ }
56
+
39
57
/**
40
58
* The callback format for inserts
41
59
* @callback authGSSClientInitCallback
@@ -54,7 +72,7 @@ function validateParameter(parameter, spec) {
54
72
* @param {string } [options.principal] Optional string containing the client principal in the form 'user@realm' (e.g. '[email protected] ').
55
73
* @param {number } [options.gssFlags] Optional integer used to set GSS flags. (e.g. GSS_C_DELEG_FLAG|GSS_C_MUTUAL_FLAG|GSS_C_SEQUENCE_FLAG will allow for forwarding credentials to the remote host)
56
74
* @param {number } [options.mechOID] Optional GSS mech OID. Defaults to None (GSS_C_NO_OID). Other possible values are GSS_MECH_OID_KRB5, GSS_MECH_OID_SPNEGO.
57
- * @param {authGSSClientInitCallback } callback The operation callback
75
+ * @param {initializeClientCallback } callback The operation callback
58
76
*/
59
77
function initializeClient ( service , options , callback ) {
60
78
if ( typeof options === 'function' ) ( callback = options ) , ( options = { } ) ;
@@ -74,7 +92,7 @@ function initializeClient(service, options, callback) {
74
92
* are complete.
75
93
*
76
94
* @param {string } service A string containing the service principal in the form 'type@fqdn' (e.g. '[email protected] ').
77
- * @param {function } callback
95
+ * @param {initializeServerCallback } callback
78
96
*/
79
97
function initializeServer ( service , callback ) {
80
98
validateParameter ( service , { name : 'service' , type : 'string' } ) ;
@@ -83,105 +101,50 @@ function initializeServer(service, callback) {
83
101
kerberos . initializeServer ( service , callback ) ;
84
102
}
85
103
86
- /**
87
- * Destroys the context for GSSAPI client-side authentication.
88
- *
89
- * @param {KerberosContext } context The context object returned from `authGSSClientInit`
90
- * @param {function } callback
91
- */
92
- // function authGSSClientClean(context, callback) {
93
- // validateParameter(context, { name: 'context', type: 'object' });
94
- // validateParameter(callback, { name: 'callback', type: 'function' });
95
-
96
- // kerberos.authGSSClientClean(context, callback);
97
- // }
98
-
99
104
/**
100
105
* Processes a single GSSAPI client-side step using the supplied server data.
101
106
*
102
- * @param { KerberosContext } context The context object returned from `authGSSClientInit`
107
+ * @memberof KerberosClient
103
108
* @param {string } challenge A string containing the base64-encoded server data (which may be empty for the first step)
104
109
* @param {function } callback Returns a result code, or an error if one was encountered
105
110
*/
106
- // function authGSSClientStep(context, challenge, callback) {
107
- // validateParameter(context, { name: 'context', type: 'object' });
108
- // validateParameter(challenge, { name: 'challenge', type: 'string' });
109
- // validateParameter(callback, { name: 'callback', type: 'function' });
110
-
111
- // kerberos.authGSSClientStep(context, challenge, callback);
112
- // }
113
111
114
112
/**
115
113
* Perform the client side GSSAPI unwrap step
116
114
*
117
- * @param { KerberosContext } context The context object returned from `authGSSClientInit`
115
+ * @memberof KerberosClient
118
116
* @param {string } challenge A string containing the base64-encoded server data
119
117
* @param {function } callback
120
118
*/
121
- // function authGSSClientUnwrap(context, challenge, callback) {
122
- // validateParameter(context, { name: 'context', type: 'object' });
123
- // validateParameter(challenge, { name: 'challenge', type: 'string' });
124
- // validateParameter(callback, { name: 'callback', type: 'function' });
125
-
126
- // kerberos.authGSSClientUnwrap(context, challenge, callback);
127
- // }
128
119
129
120
/**
130
121
* Perform the client side GSSAPI wrap step.
131
122
*
132
- * @param { KerberosContext } context The context object returned from `authGSSClientInit`
123
+ * @memberof KerberosClient
133
124
* @param {string } challenge The result of the `authGSSClientResponse` after the `authGSSClientUnwrap`
134
125
* @param {object } [options] Optional settings
135
126
* @param {string } [options.user] The user to authorize
136
127
* @param {function } callback
137
128
*/
138
- // function authGSSClientWrap(context, challenge, options, callback) {
139
- // if (typeof options === 'function') (callback = options), (options = {});
140
- // options = options || {};
141
-
142
- // validateParameter(context, { name: 'context', type: 'object' });
143
- // validateParameter(challenge, { name: 'challenge', type: 'string' });
144
- // validateParameter(options, { name: 'options', type: 'object' });
145
- // validateParameter(callback, { name: 'callback', type: 'function' });
146
-
147
- // kerberos.authGSSClientWrap(context, challenge, options, callback);
148
- // }
149
-
150
- /**
151
- * Destroys the context for GSSAPI server-side authentication.
152
- *
153
- * @param {KerberosContext } context The context object returned from `authGSSServerInit`
154
- * @param {function } callback
155
- */
156
- // function authGSSServerClean(context, callback) {
157
- // validateParameter(context, { name: 'context', type: 'object' });
158
- // validateParameter(callback, { name: 'callback', type: 'function' });
159
-
160
- // kerberos.authGSSServerClean(context, callback);
161
- // }
162
129
163
130
/**
164
131
* Processes a single GSSAPI server-side step using the supplied client data.
165
132
*
166
- * @param { KerberosContext } context The context object returned from `authGSSServerInit`
133
+ * @memberof KerberosServer
167
134
* @param {string } challenge A string containing the base64-encoded client data
168
135
* @param {function } callback
169
136
*/
170
- // function authGSSServerStep(context, challenge, callback) {
171
- // validateParameter(context, { name: 'context', type: 'object' });
172
- // validateParameter(challenge, { name: 'challenge', type: 'string' });
173
- // validateParameter(callback, { name: 'callback', type: 'function' });
174
-
175
- // kerberos.authGSSServerStep(context, challenge, callback);
176
- // }
177
137
178
138
module . exports = {
179
139
initializeClient,
180
140
initializeServer,
141
+ serverPrincipalDetails,
181
142
182
- // Constants
143
+ // result codes
183
144
AUTH_GSS_CONTINUE ,
184
145
AUTH_GSS_COMPLETE ,
146
+
147
+ // gss flags
185
148
GSS_C_DELEG_FLAG ,
186
149
GSS_C_MUTUAL_FLAG ,
187
150
GSS_C_REPLAY_FLAG ,
@@ -192,6 +155,8 @@ module.exports = {
192
155
GSS_C_PROT_READY_FLAG ,
193
156
GSS_C_TRANS_FLAG ,
194
157
GSS_C_NO_OID ,
158
+
159
+ // mechanism OIDs
195
160
GSS_MECH_OID_KRB5 ,
196
161
GSS_MECH_OID_SPNEGO
197
162
} ;
0 commit comments