PLCnext API Documentation 23.6.0.37
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Arp::System::Um::Services::ISessionService Class Referenceabstract

UserManager Service to retrieve and set session properties like sessionId and extended session informations More...

#include <ISessionService.hpp>

Inheritance diagram for Arp::System::Um::Services::ISessionService:
Inheritance graph

Public Types

using Ptr = std::shared_ptr< ISessionService >
 
- Public Types inherited from Arp::System::Rsc::Services::IRscService
typedef std::shared_ptr< IRscServicePtr
 

Public Member Functions

 ISessionService (void)=default
 Constructs an ISessionService instance.
 
virtual boolean GetSessionId (SecurityToken securityToken, RscString< 128 > &sessionId)=0
 Gets a sessionId (strong security Token) for a UserManager(UM) session, represented by its Ade.CommonRemoting.Security.SecurityToken
This is an alternative way to refer to the same session. Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted. More...
 
virtual boolean GetSecurityTokenFromSessionId (const RscString< 128 > &sessionId, SecurityToken &securityToken)=0
 Searchs for a UserManager(UM) Session identified by a StrongSecurityToken. If a valid session was found, the UM securityToken is returned in parameter securityToken
Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted. More...
 
virtual boolean GetSessionProperty (SecurityToken securityToken, const RscString< 128 > &key, RscString< 128 > &value)=0
 Read a named property from a UserManager(UM) session. A property is extended information bound to a UM session identified by a key. Example: the user which opened the session.
Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted. More...
 
virtual boolean SetSessionProperty (SecurityToken securityToken, const RscString< 128 > &key, const RscString< 128 > &value)=0
 Sets a named property for a Um session. A property is extended information bound to a um session identified by a key. If a property was already set, further calls with the same key will override it.
Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted. More...
 
virtual boolean DeleteSessionProperty (SecurityToken securityToken, const RscString< 128 > &key)=0
 Deletes a named property for a Um session.
Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted. More...
 
virtual boolean IsSessionActive (SecurityToken securityToken)=0
 Check if the um session is active or not.
Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted. More...
 
- Public Member Functions inherited from Arp::System::Rsc::Services::IRscService
 IRscService (void)=default
 Constructs an IRscService instance.
 
virtual ~IRscService (void)=default
 Destructs this instance and frees all resouces.
 

Static Public Member Functions

static IRscServiceProxyFactory & GetProxyFactory (void)
 
- Static Public Member Functions inherited from Arp::System::Rsc::Services::IRscService
static IRscServiceProxyFactory & GetProxyFactory (void)
 Returns a reference to service proxy factory to create a proxy instance of the service More...
 

Detailed Description

UserManager Service to retrieve and set session properties like sessionId and extended session informations

This service is only usable from the SDK for other processes running on the PLC; it is not intended for public use over the RSC-Gateway.
All code snippets are written for C++. SessionId and SecurityToken are semantically equivalent; However the SecurityToken is primarily intended for internal use, while the SessionId is a randomised string, which is harder to brute-force and should be preferred for all external applications like web based authentication. SessionProperties are used to add information to a session. Ex. the UserManager will add a property with the key "username" by default. In order to prevent overrides, external applications should prepend "Custom." to their own property-keys.

This service is defined in library Arp.System.Um.

Realtime Usage: This API call does not have to be deterministic in runtime behaviour, so an asynchronous execution should be considered.

Member Function Documentation

◆ DeleteSessionProperty()

virtual boolean Arp::System::Um::Services::ISessionService::DeleteSessionProperty ( SecurityToken  securityToken,
const RscString< 128 > &  key 
)
pure virtual

Deletes a named property for a Um session.
Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted.

Parameters
securityTokenthe um securityToken identifying the session
keykey identifying the extended info which should be deleted
Returns
false if the strongSecurityToken is not valid, true if securityToken is returned

Example:

ISessionService sessionService = ... // subscribe to service
bool result = sessionService.DeleteSessionProperty(securityToken, "CreatedBy");
UserManager Service to retrieve and set session properties like sessionId and extended session inform...
Definition: ISessionService.hpp:38
virtual boolean DeleteSessionProperty(SecurityToken securityToken, const RscString< 128 > &key)=0
Deletes a named property for a Um session. Note: This method must not be called remotely via the RSC...

◆ GetSecurityTokenFromSessionId()

virtual boolean Arp::System::Um::Services::ISessionService::GetSecurityTokenFromSessionId ( const RscString< 128 > &  sessionId,
SecurityToken securityToken 
)
pure virtual

Searchs for a UserManager(UM) Session identified by a StrongSecurityToken. If a valid session was found, the UM securityToken is returned in parameter securityToken
Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted.

Parameters
sessionIdThe strong sessionId to search for
securityTokenreturns the Ade.CommonRemoting.Security.SecurityToken for the Um session
Returns
false if the strongSecurityToken is not valid, true otherwise

Example:

ISessionService sessionService = ... // subscribe to service
uint32 securityToken = 0;
String sessionId = //sessionId
bool result = sessionService.GetSecurityTokenFromSessionId(sessionId, securityToken);
if(!result) {...}
virtual boolean GetSecurityTokenFromSessionId(const RscString< 128 > &sessionId, SecurityToken &securityToken)=0
Searchs for a UserManager(UM) Session identified by a StrongSecurityToken. If a valid session was fou...
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:36

◆ GetSessionId()

virtual boolean Arp::System::Um::Services::ISessionService::GetSessionId ( SecurityToken  securityToken,
RscString< 128 > &  sessionId 
)
pure virtual

Gets a sessionId (strong security Token) for a UserManager(UM) session, represented by its Ade.CommonRemoting.Security.SecurityToken
This is an alternative way to refer to the same session. Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted.

Parameters
securityTokenAde.CommonRemoting.Security.SecurityToken identifying the session
sessionIdreturns the strongToken, only valid if true is returned, Should be ignored otherwise
Returns
false if the securityToken is not valid (session expired or has never existed), true otherwise.

Example:

ISessionService sessionService = ... // subscribe to service
uint32 securityToken = 112345;
String sessionId;
bool result = sessionService.GetSessionId(securityToken, sessionId);
if(!result) {...}
virtual boolean GetSessionId(SecurityToken securityToken, RscString< 128 > &sessionId)=0
Gets a sessionId (strong security Token) for a UserManager(UM) session, represented by its Ade....

◆ GetSessionProperty()

virtual boolean Arp::System::Um::Services::ISessionService::GetSessionProperty ( SecurityToken  securityToken,
const RscString< 128 > &  key,
RscString< 128 > &  value 
)
pure virtual

Read a named property from a UserManager(UM) session. A property is extended information bound to a UM session identified by a key. Example: the user which opened the session.
Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted.

Parameters
securityTokenthe Ade.CommonRemoting.Security.SecurityTokenidentifying the session
keykey identifying the extended info
valuevalue of the session information identifying by key
Returns
true if the SecurityToken is valid and the Sessionproperty was set, false otherwise

Example:

ISessionService sessionService = ... // subscribe to service
String sessionCreator;
bool result = sessionService.GetSessionProperty(securityToken, "CreatedBy", sessionCreator);
if(!result) {...}
virtual boolean GetSessionProperty(SecurityToken securityToken, const RscString< 128 > &key, RscString< 128 > &value)=0
Read a named property from a UserManager(UM) session. A property is extended information bound to a U...

◆ IsSessionActive()

virtual boolean Arp::System::Um::Services::ISessionService::IsSessionActive ( SecurityToken  securityToken)
pure virtual

Check if the um session is active or not.
Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted.

Parameters
securityTokenSecurity token of the session to be checked
Returns
true if the session is active, false otherwise
ISessionService sessionService = ... // subscribe to service
bool sessionActive = sessionService.IsSessionActive(securityToken);
virtual boolean IsSessionActive(SecurityToken securityToken)=0
Check if the um session is active or not. Note: This method must not be called remotely via the RSC-...

◆ SetSessionProperty()

virtual boolean Arp::System::Um::Services::ISessionService::SetSessionProperty ( SecurityToken  securityToken,
const RscString< 128 > &  key,
const RscString< 128 > &  value 
)
pure virtual

Sets a named property for a Um session. A property is extended information bound to a um session identified by a key. If a property was already set, further calls with the same key will override it.
Note: This method must not be called remotely via the RSC-Gateway and will throw an exception if attempted.

Parameters
securityTokenthe Ade.CommonRemoting.Security.SecurityToken identifying the session
keykey identifying the extended info
valuevalue to set as extended info for the um session
Returns
false if the securityToken is not valid, true if securityToken is valid.

Example:

ISessionService sessionService = ... // subscribe to service
bool result = sessionService.SetSessionProperty(securityToken, "CreatedBy", "TestUser");
if(!result) {...}
virtual boolean SetSessionProperty(SecurityToken securityToken, const RscString< 128 > &key, const RscString< 128 > &value)=0
Sets a named property for a Um session. A property is extended information bound to a um session iden...

The documentation for this class was generated from the following file: