How to use the node-opcua-service-session.UserNameIdentityToken function in node-opcua-service-session

To help you get started, we’ve selected a few node-opcua-service-session examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-server / src / opcua_server.js View on Github external
// clientCertificate
            clientCertificate: {dataType: "ByteString", value: session.channel.clientCertificate},

            // clientCertificateThumbprint
            clientCertificateThumbprint: {dataType: "ByteString", value: thumbprint(session.channel.clientCertificate)}

        });
    }
    // ----------------------------------------------------------------------------------------------------------------

    assert(response.authenticationToken);
    channel.send_response("MSG", response, message);
};

const UserNameIdentityToken = session_service.UserNameIdentityToken;
const AnonymousIdentityToken = session_service.AnonymousIdentityToken;

const getCryptoFactory = require("node-opcua-secure-channel").getCryptoFactory;

function adjustSecurityPolicy(channel, userTokenPolicy_securityPolicyUri) {
    // check that userIdentityToken
    let securityPolicy = fromURI(userTokenPolicy_securityPolicyUri);

    // if the security policy is not specified we use the session security policy
    if (securityPolicy === SecurityPolicy.Invalid) {
        securityPolicy = fromURI(channel.clientSecurityHeader.securityPolicyUri);
        assert(securityPolicy);
    }
    return securityPolicy;
}
github node-opcua / node-opcua / packages / node-opcua-client / src / opcua_client.js View on Github external
const ActivateSessionRequest = session_service.ActivateSessionRequest;
const ActivateSessionResponse = session_service.ActivateSessionResponse;
const CloseSessionRequest = session_service.CloseSessionRequest;

const endpoints_service = require("node-opcua-service-endpoints");
const ApplicationDescription = endpoints_service.ApplicationDescription;
const ApplicationType = endpoints_service.ApplicationType;
const EndpointDescription = endpoints_service.EndpointDescription;
const MessageSecurityMode = require("node-opcua-service-secure-channel").MessageSecurityMode;

const SecurityPolicy = require("node-opcua-secure-channel").SecurityPolicy;
const getCryptoFactory = require("node-opcua-secure-channel").getCryptoFactory;
const fromURI = require("node-opcua-secure-channel").fromURI;

const crypto_utils = require("node-opcua-crypto");
const UserNameIdentityToken = session_service.UserNameIdentityToken;


const buffer_utils = require("node-opcua-buffer-utils");
const createFastUninitializedBuffer = buffer_utils.createFastUninitializedBuffer;

const UserIdentityTokenType = require("node-opcua-service-endpoints").UserIdentityTokenType;

const ClientSession = require("./client_session").ClientSession;

const utils = require("node-opcua-utils");
const debugLog = require("node-opcua-debug").make_debugLog(__filename);
const doDebug = require("node-opcua-debug").checkDebugFlag(__filename);

const OPCUAClientBase = require("./client_base").OPCUAClientBase;
const isNullOrUndefined = require("node-opcua-utils").isNullOrUndefined;