NodeOPCUA API Documentation
    Preparing search index...

    Class SessionContext

    Implements

    Index
    continuationPoints: Buffer<ArrayBufferLike>[]
    currentTime?: PreciseClock

    Server timestamp at the time the request was received.

    object: UAObjectType | UAObject<UAObjectEvents> | undefined

    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.

    server?: IServerBase
    session?: ISessionBase

    The underlying OPC UA session, if available.

    defaultContext: SessionContext
    • get clientApplicationUri(): string | null

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

      Returns string | null

    • get clientCertificate(): DER | null

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

      Returns DER | null

    • get endpointUrl(): string | null

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

      Returns string | null

    • 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

    • requestHeader?.auditEntryId, or undefined when either is absent or the id is empty - see ISessionContext.getAuditEntryId.

      Returns string | undefined

    • getCurrentUserRoles

      guest => anonymous user (unauthenticated) default => default authenticated 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). [] without a Session, or before the Session's first successful ActivateSession with a non-empty localeIds.

      Returns string[]

    • Returns the user name of the current user.

      Returns string

    • Parameters

      Returns boolean

      true if the context is access restricted

    • Parameters

      Returns boolean

      true if the browse is denied (access is restricted)

    • Returns a JSON representation of the context

      Returns Record<string, string | null>

    • Returns a string representation of the context

      Returns string

    • A SessionContext identical to this one, plus requestHeader (and the getAuditEntryId() it feeds). Deliberately a new instance rather than a mutation of this: build one per Call service invocation (see opcua_server.ts _on_CallRequest), never by writing onto the Session's own long-lived sessionContext. That object is shared and read concurrently by every request in flight on the Session (ServerSession#sessionContext is one instance for the Session's whole lifetime - see also UAMethodImpl#execute, which already mutates context.object on whatever context it is handed), so a shared mutable RequestHeader field would let two Calls running at once on the same Session overwrite or read back the wrong id. A fresh instance per Call has none of that: nothing but the caller holds a reference to it.

      Parameters

      Returns SessionContext