open62541pp 0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
accesscontrol_default.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5
7
8namespace opcua {
9
10/// Login credentials.
11struct Login {
12 std::string username;
13 std::string password;
14};
15
16/**
17 * Default access control.
18 *
19 * This class implements the same logic as @ref UA_AccessControl_default().
20 * The log-in can be anonymous or username-password. A logged-in user has all access rights.
21 *
22 * @warning Use less permissive access control in production!
23 */
25public:
26 explicit AccessControlDefault(bool allowAnonymous = true, std::vector<Login> logins = {});
27
29
31 Session& session,
32 const EndpointDescription& endpointDescription,
33 const ByteString& secureChannelRemoteCertificate,
34 const ExtensionObject& userIdentityToken
35 ) override;
36
37 void closeSession(Session& session) override;
38
39 Bitmask<WriteMask> getUserRightsMask(Session& session, const NodeId& nodeId) override;
40
41 Bitmask<AccessLevel> getUserAccessLevel(Session& session, const NodeId& nodeId) override;
42
43 bool getUserExecutable(Session& session, const NodeId& methodId) override;
44
45 bool getUserExecutableOnObject(Session& session, const NodeId& methodId, const NodeId& objectId)
46 override;
47
48 bool allowAddNode(Session& session, const AddNodesItem& item) override;
49
50 bool allowAddReference(Session& session, const AddReferencesItem& item) override;
51
52 bool allowDeleteNode(Session& session, const DeleteNodesItem& item) override;
53
54 bool allowDeleteReference(Session& session, const DeleteReferencesItem& item) override;
55
56 bool allowBrowseNode(Session& session, const NodeId& nodeId) override;
57
58 bool allowTransferSubscription(Session& oldSession, Session& newSession) override;
59
61 Session& session,
62 const NodeId& nodeId,
63 PerformUpdateType performInsertReplace,
64 const DataValue& value
65 ) override;
66
68 Session& session,
69 const NodeId& nodeId,
70 DateTime startTimestamp,
71 DateTime endTimestamp,
72 bool isDeleteModified
73 ) override;
74
75private:
76 bool allowAnonymous_;
77 std::vector<Login> logins_;
78 std::vector<UserTokenPolicy> userTokenPolicies_;
79};
80
81} // namespace opcua
Access control base class.
bool allowAddNode(Session &session, const AddNodesItem &item) override
Allow adding a node.
bool getUserExecutable(Session &session, const NodeId &methodId) override
Additional access control for method nodes.
Bitmask< WriteMask > getUserRightsMask(Session &session, const NodeId &nodeId) override
Access control for all nodes.
bool allowAddReference(Session &session, const AddReferencesItem &item) override
Allow adding a reference.
void closeSession(Session &session) override
Deauthenticate a session and cleanup session context.
Span< UserTokenPolicy > getUserTokenPolicies() override
Get available user token policies.
bool allowDeleteNode(Session &session, const DeleteNodesItem &item) override
Allow deleting a node.
bool allowTransferSubscription(Session &oldSession, Session &newSession) override
Allow transfer of a subscription to another session.
bool getUserExecutableOnObject(Session &session, const NodeId &methodId, const NodeId &objectId) override
Additional access control for calling a method node in the context of a specific object.
StatusCode activateSession(Session &session, const EndpointDescription &endpointDescription, const ByteString &secureChannelRemoteCertificate, const ExtensionObject &userIdentityToken) override
Authenticate a session.
bool allowBrowseNode(Session &session, const NodeId &nodeId) override
Allow browsing a node.
bool allowHistoryDelete(Session &session, const NodeId &nodeId, DateTime startTimestamp, DateTime endTimestamp, bool isDeleteModified) override
Allow delete of historical data.
bool allowHistoryUpdate(Session &session, const NodeId &nodeId, PerformUpdateType performInsertReplace, const DataValue &value) override
Allow insert, replace, update of historical data.
Bitmask< AccessLevel > getUserAccessLevel(Session &session, const NodeId &nodeId) override
Additional access control for variable nodes.
bool allowDeleteReference(Session &session, const DeleteReferencesItem &item) override
Allow deleting a reference.
AccessControlDefault(bool allowAnonymous=true, std::vector< Login > logins={})
UA_AddNodesItem wrapper class.
UA_AddReferencesItem wrapper class.
Bitmask using (scoped) enums.
Definition bitmask.hpp:125
UA_ByteString wrapper class.
Definition types.hpp:490
UA_DataValue wrapper class.
Definition types.hpp:1478
UA_DateTime wrapper class.
Definition types.hpp:354
UA_DeleteNodesItem wrapper class.
UA_DeleteReferencesItem wrapper class.
UA_EndpointDescription wrapper class.
UA_ExtensionObject wrapper class.
Definition types.hpp:1664
UA_NodeId wrapper class.
Definition types.hpp:590
High-level session class to manage client sessions.
Definition session.hpp:20
View to a contiguous sequence of objects, similar to std::span in C++20.
Definition span.hpp:26
UA_StatusCode wrapper class.
Definition types.hpp:44
PerformUpdateType
Perform update type for structured data history updates.
Login credentials.