OpenDDS  Snapshot(2023/04/28-20:55)
Permissions.h
Go to the documentation of this file.
1 /*
2  * Distributed under the OpenDDS License.
3  * See: http://www.OpenDDS.org/license.html
4  */
5 
6 #ifndef OPENDDS_DCPS_SECURITY_ACCESSCONTROL_PERMISSIONS_H
7 #define OPENDDS_DCPS_SECURITY_ACCESSCONTROL_PERMISSIONS_H
8 
9 #include "DomainIdSet.h"
10 
13 #include <dds/DCPS/RcHandle_T.h>
14 #include <dds/DCPS/RcObject.h>
15 
16 #include <dds/DdsDcpsCoreC.h>
17 #include <dds/DdsSecurityCoreC.h>
18 #include <dds/DdsSecurityParamsC.h>
19 
20 #include <string>
21 #include <vector>
22 #include <ctime>
23 
25 
26 namespace OpenDDS {
27 namespace Security {
28 
31 
32  enum AllowDeny_t {
35  };
36 
40  };
41 
42  struct Validity_t {
43  time_t not_before;
44  time_t not_after;
45  };
46 
47  struct Action {
49  std::vector<std::string> topics;
50  std::vector<std::string> partitions;
51 
52  bool topic_matches(const char* topic) const;
53  bool partitions_match(const DDS::StringSeq& entity_partitions, AllowDeny_t allow_or_deny) const;
54  };
55 
56  typedef std::vector<Action> Actions;
57 
58  struct Rule {
61  Actions actions;
62  };
63 
64  typedef std::vector<Rule> Rules;
65 
66  struct Grant : DCPS::RcObject {
67  std::string name;
71  Rules rules;
72  };
73 
75 
76  typedef std::vector<Grant_rch> Grants;
77 
78  int load(const SSL::SignedDocument& doc);
79 
80  bool has_grant(const SSL::SubjectName& name) const;
81  Grant_rch find_grant(const SSL::SubjectName& name) const;
82 
83  Grants grants_;
86 };
87 
88 }
89 }
90 
92 
93 #endif
Grant_rch find_grant(const SSL::SubjectName &name) const
std::vector< std::string > topics
Definition: Permissions.h:49
int load(const SSL::SignedDocument &doc)
Definition: Permissions.cpp:19
bool has_grant(const SSL::SubjectName &name) const
std::vector< Action > Actions
Definition: Permissions.h:56
std::vector< Rule > Rules
Definition: Permissions.h:64
DDS::Security::PermissionsCredentialToken perm_cred_token_
Definition: Permissions.h:85
std::vector< std::string > partitions
Definition: Permissions.h:50
const char *const name
Definition: debug.cpp:60
std::vector< Grant_rch > Grants
Definition: Permissions.h:76
DCPS::RcHandle< Permissions > shared_ptr
Definition: Permissions.h:30
DCPS::RcHandle< Grant > Grant_rch
Definition: Permissions.h:74
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
DDS::Security::PermissionsToken perm_token_
Definition: Permissions.h:84
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28
sequence< string > StringSeq
Definition: DdsDcpsCore.idl:50