ua_plugin_access_control.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 handle 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 **sessionHandle);
  25. /* Deauthenticate a session and cleanup */
  26. void (*closeSession)(const UA_NodeId *sessionId, void *sessionHandle);
  27. /* Access control for all nodes*/
  28. UA_UInt32 (*getUserRightsMask)(const UA_NodeId *sessionId,
  29. void *sessionHandle,
  30. const UA_NodeId *nodeId);
  31. /* Additional access control for variable nodes */
  32. UA_Byte (*getUserAccessLevel)(const UA_NodeId *sessionId,
  33. void *sessionHandle,
  34. const UA_NodeId *nodeId);
  35. /* Additional access control for method nodes */
  36. UA_Boolean (*getUserExecutable)(const UA_NodeId *sessionId,
  37. void *sessionHandle,
  38. const UA_NodeId *methodId);
  39. /* Additional access control for calling a method node in the context of a
  40. * specific object */
  41. UA_Boolean (*getUserExecutableOnObject)(const UA_NodeId *sessionId,
  42. void *sessionHandle,
  43. const UA_NodeId *methodId,
  44. const UA_NodeId *objectId);
  45. /* Allow adding a node */
  46. UA_Boolean (*allowAddNode)(const UA_NodeId *sessionId,
  47. void *sessionHandle,
  48. const UA_AddNodesItem *item);
  49. /* Allow adding a reference */
  50. UA_Boolean (*allowAddReference)(const UA_NodeId *sessionId,
  51. void *sessionHandle,
  52. const UA_AddReferencesItem *item);
  53. /* Allow deleting a node */
  54. UA_Boolean (*allowDeleteNode)(const UA_NodeId *sessionId,
  55. void *sessionHandle,
  56. const UA_DeleteNodesItem *item);
  57. /* Allow deleting a reference */
  58. UA_Boolean (*allowDeleteReference)(const UA_NodeId *sessionId,
  59. void *sessionHandle,
  60. const UA_DeleteReferencesItem *item);
  61. } UA_AccessControl;
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /* UA_PLUGIN_ACCESS_CONTROL_H_ */