PLCnext API Documentation  20.3.1.28622
SecurityContext.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 #include "Arp/System/Security/SecurityToken.hpp"
9 #include "Arp/System/Commons/Exceptions/InvalidOperationException.hpp"
10 
11 using namespace Arp::System::Commons;
12 
13 namespace Arp { namespace System { namespace Security
14 {
15 
17 {
18 public: // typedefs
19 
20 public: // construction/destruction
22  ARP_CXX_SYMBOL_EXPORT SecurityContext(const SecurityToken& securityToken);
24  SecurityContext(const SecurityContext& arg) = delete;
26  SecurityContext& operator=(const SecurityContext& arg) = delete;
28  ARP_CXX_SYMBOL_EXPORT ~SecurityContext(void);
29 
30 public: // static operations
31  ARP_CXX_SYMBOL_EXPORT static bool HasCurrent(void);
32  ARP_CXX_SYMBOL_EXPORT static const SecurityContext& GetCurrent(void);
33 
34 public: // setter/getter operations
35  const SecurityToken& GetSecurityToken(void)const;
36 
37 private: // fields
38  const SecurityToken& securityToken;
39 
40 private: // static fields
41  static thread_local const SecurityContext* pCurrent;
42 };
43 
45 // inline methods of class SecurityContext
46 
47 inline const SecurityToken& SecurityContext::GetSecurityToken()const
48 {
49  return this->securityToken;
50 }
51 
52 }}} // end of namespace Arp::System::Security
Definition: SecurityToken.hpp:11
Root namespace for the PLCnext API
Definition: SecurityContext.hpp:16
System components used by the System, Device, Plc or Io domains.
Namespace for basic functions of the framework