PLCnext API Documentation 25.0.2.69
SecurityContext.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
7#ifndef ARP_USE_ARP_SYSTEM_SECURITY
8#include "Arp/Base/Commons/Security/SecurityContext.hpp"
10{
12}
13#else
14#include "Arp/System/Core/Arp.h"
15#include "Arp/System/Security/SecurityToken.hpp"
16#include "Arp/System/Commons/Exceptions/InvalidOperationException.hpp"
17
18namespace Arp { namespace System { namespace Security
19{
20
21ARP_DEPRECATED_IGNORE_BEGIN
22
23//forward declaration of DisableSecurityContext
24namespace Internal
25{
26class DisableSecurityContext;
27}
28
29class ARP_DEPRECATED("Use 'Arp::Base::Commons::Security::SecurityContext' instead") SecurityContext
30{
31 friend class Arp::System::Security::Internal::DisableSecurityContext;
32
33public: // construction/destruction
34 ARP_EXPORT SecurityContext(const SecurityToken& securityToken);
35 ARP_EXPORT SecurityContext(bool isEnabled, const SecurityToken& securityToken);
37 SecurityContext(const SecurityContext& arg) = delete;
39 SecurityContext& operator=(const SecurityContext& arg) = delete;
40
41 ARP_EXPORT ~SecurityContext(void);
42
43public: // static operations
44 ARP_EXPORT static bool HasCurrent(void);
45 ARP_EXPORT static const SecurityContext& GetCurrent(void);
46
47public: // setter/getter operations
48 const SecurityToken& GetSecurityToken(void) const;
49
50private: // fields
51 const SecurityToken& securityToken;
52
53private: // static fields
54 static thread_local const SecurityContext* pCurrent;
55};
56
58// inline methods of class SecurityContext
59
60inline const SecurityToken& SecurityContext::GetSecurityToken()const
61{
62 return this->securityToken;
63}
64
65ARP_DEPRECATED_IGNORE_END
66
67}}} // end of namespace Arp::System::Security
68#endif // ndef ARP_USE_ARP_SYSTEM_SECURITY
This class is an adapter class of the SecurityToken to provide security info into any operations whic...
Definition: SecurityContext.hpp:25
const SecurityToken & GetSecurityToken(void) const
Gets the security token.
Definition: SecurityContext.cpp:69
Namepsace for classes used in the RSC security implementation
Root namespace for the PLCnext API
class ARP_DEPRECATED("Use Arp::Enum<T> instead.") EnumStrings
Deprecated! The class implements an adapter for enums to define the string literals of the enum entri...
Definition: EnumStrings.hxx:38