AccessControl¶
Canonical path: o6.server.AccessControl
Root shortcut: o6.AccessControl
AccessControl
¶
Python implementation of the open62541 UA_AccessControl plugin.
Subclass it, override activateSession for authentication, and override the
authorization hooks that matter. The base authorization policy is permissive
and the base authentication policy accepts anonymous sessions only, so an
unmodified instance behaves like an open server.
Only overridden hooks cost anything: the server installs a callback trampoline for the methods a subclass actually replaces, and leaves the rest to open62541.
Every hook is called on the server's event loop with a
Session proxy, so hooks must not block.
See Access control and authentication.
Attributes¶
Functions¶
__init__
¶
activateSession
¶
Authenticate a session and return its context or activation result.
The base implementation accepts anonymous tokens and rejects everything
else. Override it to authenticate; raise
StatusCodeError to reject.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint
|
EndpointDescription
|
The endpoint the session is connecting through. |
required |
remoteCertificate
|
bytes
|
The client certificate, empty when unsecured. |
required |
session
|
Session
|
The session being activated. |
required |
userIdentityToken
|
Any
|
The decoded identity token, for example an
|
required |
Returns:
| Type | Description |
|---|---|
Any | SessionActivation
|
Any object to keep as |
Any | SessionActivation
|
|
Raises:
| Type | Description |
|---|---|
StatusCodeError
|
Authentication failed. |
closeSession
¶
Release a context returned by activateSession.
Called once per session, when the session ends for any reason. The base implementation does nothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
The session that is closing. |
required |
getUserRightsMask
¶
Return the session's UserWriteMask for one node.
The base implementation grants every bit. See
o6.WriteMask for the bit layout.
getUserAccessLevel
¶
Return the session's UserAccessLevel for one Variable.
The base implementation grants every bit. See
o6.AccessLevel for the bit layout.
getUserExecutable
¶
Return whether the session may execute a Method at all.
The base implementation allows it.
getUserExecutableOnObject
¶
Return whether the session may execute a Method on one Object.
The base implementation allows it. This is the hook to use when the answer depends on which instance is being addressed.
allowAddNode
¶
allowAddReference
¶
allowDeleteNode
¶
allowDeleteReference
¶
allowBrowseNode
¶
Return whether the session may browse one node.
The base implementation allows it. This hook runs for every browsed node, so keep it cheap.
allowTransferSubscription
¶
Return whether subscriptions may move between two sessions.
The base implementation allows the transfer when both sessions carry an equal context, which is what keeps a reconnecting client's subscriptions alive while refusing another user's.
allowCreateSubscription
¶
Return whether the session may create a subscription.
The base implementation allows it.
allowHistoryUpdate
¶
Return whether the session may update history for one node.
The base implementation allows it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
The requesting session. |
required |
nodeId
|
NodeId
|
The node whose history is being updated. |
required |
performUpdateType
|
int
|
The requested |
required |
value
|
DataValue
|
The |
required |
allowHistoryDelete
¶
Return whether the session may delete history for one node.
The base implementation allows it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
The requesting session. |
required |
nodeId
|
NodeId
|
The node whose history is being deleted. |
required |
startTimestamp
|
Any
|
Start of the range to delete. |
required |
endTimestamp
|
Any
|
End of the range to delete. |
required |
isDeleteModified
|
bool
|
Delete modified values rather than raw ones. |
required |