10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
SerializedOIDCSession.h
1#ifndef TENDUKE_OIDC_SERIALIZEDOIDCSESSION_H
2#define TENDUKE_OIDC_SERIALIZEDOIDCSESSION_H
3
4#include "./OIDCSession.h"
5
6#include <chrono>
7#include <memory>
8#include <mutex>
9
10namespace tenduke { namespace oidc {
11
17const std::chrono::seconds DEFAULT_SESSION_CONCURRENCY_TIMEOUT = std::chrono::minutes(7);
18
19
37{
38public:
47 const std::shared_ptr<tenduke::oidc::OIDCSession> &session,
48 const std::chrono::milliseconds &concurrencyTimeout
49 );
50
51 // tenduke::oidc::OIDCSession interface
52public:
53 void abortLogin() override;
54 void ensureValidSession() override;
55 std::string getAccessToken() override;
56 std::shared_ptr<const tenduke::oidc::OIDCState> getOIDCState() override;
57 bool heartbeat() override;
58 void invalidate() override;
59 bool isValid() override;
60 void reEstablish() override;
61 void refresh() override;
62
63private:
64 const std::shared_ptr<tenduke::oidc::OIDCSession> session;
65
66 const std::chrono::milliseconds concurrencyTimeout;
67 std::recursive_timed_mutex serializeStateAccess;
68};
69
70}}
71
72#endif //TENDUKE_OIDC_SERIALIZEDOIDCSESSION_H
SerializedOIDCSession(const std::shared_ptr< tenduke::oidc::OIDCSession > &session, const std::chrono::milliseconds &concurrencyTimeout)
Constructs new instance.
Definition SerializedOIDCSession.cpp:104
Stateful service to manage OIDC-session.
Definition OIDCSession.h:23
bool isValid() override
Checks that local session is valid.
Definition SerializedOIDCSession.cpp:80
void abortLogin() override
Aborts an ongoing login flow.
Definition SerializedOIDCSession.cpp:34
bool heartbeat() override
Executes a heartbeat with the backend, checking that the current access token really works.
Definition SerializedOIDCSession.cpp:64
void refresh() override
Forces refresh of the session.
Definition SerializedOIDCSession.cpp:96
SerializedOIDCSession(const std::shared_ptr< tenduke::oidc::OIDCSession > &session, const std::chrono::milliseconds &concurrencyTimeout)
Constructs new instance.
Definition SerializedOIDCSession.cpp:104
std::shared_ptr< const tenduke::oidc::OIDCState > getOIDCState() override
Returns the current OIDC-state for inspection.
Definition SerializedOIDCSession.cpp:56
std::string getAccessToken() override
Returns access token of the session.
Definition SerializedOIDCSession.cpp:48
void ensureValidSession() override
Checks that the OIDC session is valid, but if it is NOT, either refreshes the access token or authent...
Definition SerializedOIDCSession.cpp:40
void reEstablish() override
Re-establishes the session: Tries first to refresh the state, if it fails, re-authenticates the user.
Definition SerializedOIDCSession.cpp:88
void invalidate() override
Invalidates the session.
Definition SerializedOIDCSession.cpp:72
Implementation of OpenID Connect protocol.
Definition AutoDiscovery.h:17
const std::chrono::seconds DEFAULT_SESSION_CONCURRENCY_TIMEOUT
Default timeout for serialized methods.
Definition SerializedOIDCSession.h:17
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4