ua_plugin_access_control.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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:
  12. *
  13. * Access Control Plugin API
  14. * =========================
  15. * The access control callback is used to authenticate sessions and grant access
  16. * rights accordingly. */
  17. typedef struct {
  18. /* These booleans are used to create endpoints for the possible
  19. * authentication methods */
  20. UA_Boolean enableAnonymousLogin;
  21. UA_Boolean enableUsernamePasswordLogin;
  22. /* Authenticate a session. The session context is attached to the session and
  23. * later passed into the node-based access control callbacks. */
  24. UA_StatusCode (*activateSession)(const UA_NodeId *sessionId,
  25. const UA_ExtensionObject *userIdentityToken,
  26. void **sessionContext);
  27. /* Deauthenticate a session and cleanup */
  28. void (*closeSession)(const UA_NodeId *sessionId, void *sessionContext);
  29. /* Access control for all nodes*/
  30. UA_UInt32 (*getUserRightsMask)(const UA_NodeId *sessionId, void *sessionContext,
  31. const UA_NodeId *nodeId, void *nodeContext);
  32. /* Additional access control for variable nodes */
  33. UA_Byte (*getUserAccessLevel)(const UA_NodeId *sessionId, void *sessionContext,
  34. const UA_NodeId *nodeId, void *nodeContext);
  35. /* Additional access control for method nodes */
  36. UA_Boolean (*getUserExecutable)(const UA_NodeId *sessionId, void *sessionContext,
  37. const UA_NodeId *methodId, void *methodContext);
  38. /* Additional access control for calling a method node in the context of a
  39. * specific object */
  40. UA_Boolean (*getUserExecutableOnObject)(const UA_NodeId *sessionId, void *sessionContext,
  41. const UA_NodeId *methodId, void *methodContext,
  42. const UA_NodeId *objectId, void *objectContext);
  43. /* Allow adding a node */
  44. UA_Boolean (*allowAddNode)(const UA_NodeId *sessionId, void *sessionContext,
  45. const UA_AddNodesItem *item);
  46. /* Allow adding a reference */
  47. UA_Boolean (*allowAddReference)(const UA_NodeId *sessionId, void *sessionContext,
  48. const UA_AddReferencesItem *item);
  49. /* Allow deleting a node */
  50. UA_Boolean (*allowDeleteNode)(const UA_NodeId *sessionId, void *sessionContext,
  51. const UA_DeleteNodesItem *item);
  52. /* Allow deleting a reference */
  53. UA_Boolean (*allowDeleteReference)(const UA_NodeId *sessionId, void *sessionContext,
  54. const UA_DeleteReferencesItem *item);
  55. } UA_AccessControl;
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif /* UA_PLUGIN_ACCESS_CONTROL_H_ */