Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
MessageBuilder.prototype.setSecurity = function (securityMode, securityPolicy) {
assert(this.securityMode === MessageSecurityMode.INVALID, "security already set");
this.securityPolicy = SecurityPolicy.get(securityPolicy);
this.securityMode = MessageSecurityMode.get(securityMode);
assert(this.securityPolicy !== undefined, "invalid security policy " + securityPolicy);
assert(this.securityMode !== undefined, "invalid security mode " + securityMode);
assert(this.securityPolicy !== SecurityPolicy.Invalid);
assert(this.securityMode !== MessageSecurityMode.INVALID);
};
OPCUAClientBase.prototype.findEndpointForSecurity = function (securityMode, securityPolicy) {
securityMode = MessageSecurityMode.get(securityMode);
securityPolicy = SecurityPolicy.get(securityPolicy);
assert(this.knowsServerEndpoint, "Server end point are not known yet");
return _.find(this._server_endpoints, function (endpoint) {
return endpoint.securityMode === securityMode &&
endpoint.securityPolicyUri === securityPolicy.value;
});
};
this._sessions = [];
this._server_endpoints = [];
this._secureChannel = null;
this.defaultSecureTokenLifetime = options.defaultSecureTokenLifetime || 600000;
this.tokenRenewalInterval = options.tokenRenewalInterval || 0;
assert(_.isFinite(this.tokenRenewalInterval) && this.tokenRenewalInterval >= 0);
/**
* @property securityMode
* @type MessageSecurityMode
*/
this.securityMode = options.securityMode || MessageSecurityMode.NONE;
this.securityMode = MessageSecurityMode.get(this.securityMode);
/**
* @property securityPolicy
* @type {SecurityPolicy}
*/
this.securityPolicy = options.securityPolicy || toURI("None");
this.securityPolicy = SecurityPolicy.get(this.securityPolicy);
/**
* @property serverCertificate
* @type {Certificate}
*/
this.serverCertificate = options.serverCertificate || null;
/**
* true if session shall periodically probe the server to keep the session alive and prevent timeout