NodeOPCUA API Documentation
    Preparing search index...

    Interface ISessionContext

    interface ISessionContext {
        clientApplicationUri: string | null;
        clientCertificate: DER | null;
        currentTime?: PreciseClock;
        endpointUrl: string | null;
        object?: UAObjectType | UAObject<UAObjectEvents>;
        requestHeader?: RequestHeader;
        session?: ISessionBase;
        checkPermission(node: BaseNode, action: PermissionType): boolean;
        currentUserHasRole(role: NodeIdLike): boolean;
        getAuditEntryId(): string | undefined;
        getCurrentUserRoles(): NodeId[];
        getPreferredLocales(): string[];
        getUserName(): string;
        isAccessRestricted(node: BaseNode): boolean;
        isBrowseAccessRestricted(node: BaseNode): boolean;
        toJSON(): Record<string, string | null>;
        toString(): string;
    }

    Implemented by

    Index
    clientApplicationUri: string | null

    The application URI extracted from the client certificate's SubjectAltName, or null if unavailable.

    clientCertificate: DER | null

    The client's application-instance certificate, or null if no secure channel is available.

    currentTime?: PreciseClock

    Server timestamp at the time the request was received.

    endpointUrl: string | null

    The URL of the Endpoint the Session was created on, or null if unknown.

    The object on which the current operation is being performed.

    requestHeader?: RequestHeader

    The RequestHeader of the request currently being served through this context, when one is available. A context built for one Call service invocation (see ServerSession's per-request context, opcua_server.ts _on_CallRequest) carries the RequestHeader of that CallRequest, so a bound Method handler can read context.requestHeader?.auditEntryId - OPC 10000-4 v1.05.07 §7.32 RequestHeader - and copy it into ClientAuditEntryId when it raises an AuditEventType - OPC 10000-5 v1.05.06 §6.4.3. undefined for a context with no request behind it, e.g. a Session's own long-lived sessionContext, or most PseudoSession calls.

    session?: ISessionBase

    The underlying OPC UA session, if available.

    • Check whether the current user has the given permission on a node.

      Parameters

      Returns boolean

    • Returns true if the current user has the given role.

      Parameters

      Returns boolean

    • Convenience accessor for requestHeader?.auditEntryId; undefined when either is absent or the id is empty.

      Returns string | undefined

    • Returns the NodeIds of all roles assigned to the current user.

      Returns NodeId[]

    • The Session's preferred locales, most preferred first (OPC 10000-4 v1.05.07 §5.7.3 ActivateSession localeIds, §5.4 Locale Negotiation). Empty when there is no Session, or the Session has not been activated with a non-empty localeIds yet.

      Returns string[]

    • Returns the user name of the current user.

      Returns string

    • Returns true if access to the node is restricted by security settings.

      Parameters

      Returns boolean

    • Returns true if browsing the given node is restricted for the current user.

      Parameters

      Returns boolean

    • Returns a JSON representation of the context

      Returns Record<string, string | null>

    • Returns a string representation of the context

      Returns string