ua_plugin_access_control.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #ifndef UA_PLUGIN_ACCESS_CONTROL_H_
  5. #define UA_PLUGIN_ACCESS_CONTROL_H_
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include "ua_types.h"
  10. /**
  11. * Access Control Plugin API
  12. * =========================
  13. * The access control callback is used to authenticate sessions and grant access
  14. * rights accordingly. */
  15. typedef struct {
  16. /* These booleans are used to create endpoints for the possible
  17. * authentication methods */
  18. UA_Boolean enableAnonymousLogin;
  19. UA_Boolean enableUsernamePasswordLogin;
  20. /* Authenticate a session. The session context is attached to the session and
  21. * later passed into the node-based access control callbacks. */
  22. UA_StatusCode (*activateSession)(const UA_NodeId *sessionId,
  23. const UA_ExtensionObject *userIdentityToken,
  24. void **sessionContext);
  25. /* Deauthenticate a session and cleanup */
  26. void (*closeSession)(const UA_NodeId *sessionId, void *sessionContext);
  27. /* Access control for all nodes*/
  28. UA_UInt32 (*getUserRightsMask)(const UA_NodeId *sessionId, void *sessionContext,
  29. const UA_NodeId *nodeId, void *nodeContext);
  30. /* Additional access control for variable nodes */
  31. UA_Byte (*getUserAccessLevel)(const UA_NodeId *sessionId, void *sessionContext,
  32. const UA_NodeId *nodeId, void *nodeContext);
  33. /* Additional access control for method nodes */
  34. UA_Boolean (*getUserExecutable)(const UA_NodeId *sessionId, void *sessionContext,
  35. const UA_NodeId *methodId, void *methodContext);
  36. /* Additional access control for calling a method node in the context of a
  37. * specific object */
  38. UA_Boolean (*getUserExecutableOnObject)(const UA_NodeId *sessionId, void *sessionContext,
  39. const UA_NodeId *methodId, void *methodContext,
  40. const UA_NodeId *objectId, void *objectContext);
  41. /* Allow adding a node */
  42. UA_Boolean (*allowAddNode)(const UA_NodeId *sessionId, void *sessionContext,
  43. const UA_AddNodesItem *item);
  44. /* Allow adding a reference */
  45. UA_Boolean (*allowAddReference)(const UA_NodeId *sessionId, void *sessionContext,
  46. const UA_AddReferencesItem *item);
  47. /* Allow deleting a node */
  48. UA_Boolean (*allowDeleteNode)(const UA_NodeId *sessionId, void *sessionContext,
  49. const UA_DeleteNodesItem *item);
  50. /* Allow deleting a reference */
  51. UA_Boolean (*allowDeleteReference)(const UA_NodeId *sessionId, void *sessionContext,
  52. const UA_DeleteReferencesItem *item);
  53. } UA_AccessControl;
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif /* UA_PLUGIN_ACCESS_CONTROL_H_ */