Skip to content

Commit

Permalink
add ability to use username password userIdentityToken type in create…
Browse files Browse the repository at this point in the history
…Session
  • Loading branch information
erossignon committed Mar 27, 2014
1 parent d617f52 commit abfbee6
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/opcua-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,13 @@ OPCUAClient.prototype._activateSession = function(session,callback) {
clientSignature: { algorithm: null, signature: null },

clientSoftwareCertificates: [

],

localeIds: [
],
userIdentityToken: new s.AnonymousIdentityToken({
policyId: "0"
}), // extension object

userIdentityToken: this.userIdentityToken,

userTokenSignature: {
algorithm: null,
signature: null
Expand Down Expand Up @@ -570,10 +569,17 @@ OPCUAClient.prototype._activateSession = function(session,callback) {
*
* @param callback
*/
OPCUAClient.prototype.createSession = function(callback) {
OPCUAClient.prototype.createSession = function(userIdentityToken,callback) {

assert(_.isFunction(callback));
var self = this;
if (_.isFunction(userIdentityToken)) {
callback = userIdentityToken;
userIdentityToken = new s.AnonymousIdentityToken({policyId: "0"})
};

self.userIdentityToken = userIdentityToken;

assert(_.isFunction(callback));

self._createSession(function(err,session){
if(err) {
Expand Down

0 comments on commit abfbee6

Please sign in to comment.