1 /*!
2  * \brief State machine state: Get TCToken.
3  *
4  * \copyright Copyright (c) 2014-2021 Governikus GmbH & Co. KG, Germany
5  */
6 
7 #pragma once
8 
9 #include "AbstractState.h"
10 #include "context/AuthContext.h"
11 #include "GenericContextContainer.h"
12 
13 #include <QNetworkReply>
14 #include <QSharedPointer>
15 
16 class test_StateGetTcToken;
17 
18 namespace governikus
19 {
20 
21 class StateGetTcToken
22 	: public AbstractState
23 	, public GenericContextContainer<AuthContext>
24 {
25 	Q_OBJECT
26 	friend class StateBuilder;
27 	friend class ::test_StateGetTcToken;
28 
29 	QSharedPointer<QNetworkReply> mReply;
30 
31 	void parseTcToken();
32 	void sendRequest(const QUrl& pUrl);
33 	bool isValidRedirectUrl(const QUrl& pUrl);
34 	void run() override;
35 
36 	explicit StateGetTcToken(const QSharedPointer<WorkflowContext>& pContext);
37 
38 	private Q_SLOTS:
39 		void onNetworkReply();
40 		void onSslHandshakeDone();
41 		void onSslErrors(const QList<QSslError>& pErrors);
42 
43 	public:
44 		void onExit(QEvent* pEvent) override;
45 };
46 
47 } // namespace governikus
48