PLCnext API Documentation 26.0.1.58
RscServiceSecurityStubBase.hxx
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Rsc/Commons/Services/IRscAuthorizator.hpp"
9#include "Arp/Base/Rsc/Commons/Services/RscServiceAuthorizator.hpp"
10
11// forwards
12namespace Arp::Base::Acf::Commons
13{
14class IComponent;
15}
16
17namespace Arp::Base::Rsc::Commons::Services
18{
19
20// imports
22
34template<class T>
36{
37protected: // usings
38 using ServiceImplType = T;
39
40public: // construction
41 RscServiceSecurityStubBase(const char* serviceProviderName, IRscAuthorizator* pAuthorizator);
42 RscServiceSecurityStubBase(const char* serviceProviderName, IRscAuthorizator* pAuthorizator, IComponent& component);
43
44protected: // operations
45 void AuthorizeServiceInvocation(const char* operationName);
46
47private: // fields
48 RscServiceAuthorizator authorizator;
49};
50
52// inline methods of class RscServiceSecurityStubBase
53
58template<class T>
59inline RscServiceSecurityStubBase<T>::RscServiceSecurityStubBase(const char* serviceProviderName, IRscAuthorizator* pAuthorizator)
60 : authorizator(serviceProviderName, ServiceImplType::GetProxyFactory().GetServiceName(), *pAuthorizator)
61{
62}
63
69template<class T>
70inline RscServiceSecurityStubBase<T>::RscServiceSecurityStubBase(const char* serviceProviderName, IRscAuthorizator* pAuthorizator, IComponent& component)
71 : T(component), authorizator(serviceProviderName, ServiceImplType::GetProxyFactory().GetServiceName(), *pAuthorizator)
72{
73}
74
79template<class T>
81{
82 this->authorizator.AuthorizeServiceInvocation(operationName);
83}
84
85} // end of namespace Arp::Base::Rsc::Commons::Services
This is the most important basic interface of the Arp platform. Any component shall implement this in...
Definition: IComponent.hpp:79
This interface is used to authorize a Rsc service call.
Definition: IRscAuthorizator.hpp:21
This class is used to authorize RSC service calls according security rules.
Definition: RscServiceAuthorizator.hpp:18
Base class for RSC service security stubs.
Definition: RscServiceSecurityStubBase.hxx:36
T ServiceImplType
The type of the service implementation (e.g. DemoServiceImpl)
Definition: RscServiceSecurityStubBase.hxx:38
RscServiceSecurityStubBase(const char *serviceProviderName, IRscAuthorizator *pAuthorizator)
Constructs a RscServiceSecurityStubBase instance.
Definition: RscServiceSecurityStubBase.hxx:59
void AuthorizeServiceInvocation(const char *operationName)
This operation is used to authorize any method call of the service implementation.
Definition: RscServiceSecurityStubBase.hxx:80