KiCad PCB EDA Suite
Loading...
Searching...
No Matches
remote_provider_client.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 3 of the License, or (at your
9 * option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef REMOTE_PROVIDER_CLIENT_H
21#define REMOTE_PROVIDER_CLIENT_H
22
23#include <functional>
24
25#include <kicommon.h>
26#include <oauth/oauth_session.h>
30#include <wx/string.h>
31
32
38
39
41{
42 wxString name;
43 wxString value;
44};
45
46
54
55
61
62
64 std::function<bool( const REMOTE_PROVIDER_HTTP_REQUEST&, REMOTE_PROVIDER_HTTP_RESPONSE&, wxString& )>;
65
66
68{
69public:
72
73 bool DiscoverProvider( const wxString& aProviderUrl, REMOTE_PROVIDER_METADATA& aMetadata,
74 REMOTE_PROVIDER_ERROR& aError ) const;
75
78 REMOTE_PROVIDER_ERROR& aError ) const;
79
81 const OAUTH_SESSION& aSession,
82 const wxString& aCode,
83 OAUTH_TOKEN_SET& aTokens,
84 REMOTE_PROVIDER_ERROR& aError ) const;
85
87 const wxString& aClientId,
88 const wxString& aRefreshToken,
89 OAUTH_TOKEN_SET& aTokens,
90 REMOTE_PROVIDER_ERROR& aError ) const;
91
93 const wxString& aClientId,
94 const wxString& aToken,
95 REMOTE_PROVIDER_ERROR& aError ) const;
96
98 const wxString& aAccessToken ) const;
99
100 bool FetchManifest( const REMOTE_PROVIDER_METADATA& aProvider, const wxString& aPartId,
101 const wxString& aAccessToken, REMOTE_PROVIDER_PART_MANIFEST& aManifest,
102 REMOTE_PROVIDER_ERROR& aError ) const;
103
105 const wxString& aAccessToken, wxString& aNonceUrl,
106 REMOTE_PROVIDER_ERROR& aError ) const;
107
108 static wxString MetadataDiscoveryUrl( const wxString& aProviderUrl );
109
110private:
112 REMOTE_PROVIDER_ERROR& aError ) const;
113 bool FetchJson( const REMOTE_PROVIDER_HTTP_REQUEST& aRequest, nlohmann::json& aJson,
114 REMOTE_PROVIDER_ERROR& aError ) const;
116 REMOTE_PROVIDER_ERROR& aError ) const;
117
118private:
120};
121
122#endif // REMOTE_PROVIDER_CLIENT_H
REMOTE_PROVIDER_HTTP_HANDLER m_handler
bool RevokeToken(const REMOTE_PROVIDER_OAUTH_SERVER_METADATA &aMetadata, const wxString &aClientId, const wxString &aToken, REMOTE_PROVIDER_ERROR &aError) const
static wxString MetadataDiscoveryUrl(const wxString &aProviderUrl)
REMOTE_PROVIDER_SIGNIN_STATE GetSignInState(const REMOTE_PROVIDER_METADATA &aProvider, const wxString &aAccessToken) const
bool ExchangeBootstrapNonce(const REMOTE_PROVIDER_METADATA &aMetadata, const wxString &aAccessToken, wxString &aNonceUrl, REMOTE_PROVIDER_ERROR &aError) const
bool SendRequest(const REMOTE_PROVIDER_HTTP_REQUEST &aRequest, REMOTE_PROVIDER_HTTP_RESPONSE &aResponse, REMOTE_PROVIDER_ERROR &aError) const
bool FetchOAuthServerMetadata(const REMOTE_PROVIDER_METADATA &aProvider, REMOTE_PROVIDER_OAUTH_SERVER_METADATA &aMetadata, REMOTE_PROVIDER_ERROR &aError) const
bool FetchManifest(const REMOTE_PROVIDER_METADATA &aProvider, const wxString &aPartId, const wxString &aAccessToken, REMOTE_PROVIDER_PART_MANIFEST &aManifest, REMOTE_PROVIDER_ERROR &aError) const
bool ExchangeAuthorizationCode(const REMOTE_PROVIDER_OAUTH_SERVER_METADATA &aMetadata, const OAUTH_SESSION &aSession, const wxString &aCode, OAUTH_TOKEN_SET &aTokens, REMOTE_PROVIDER_ERROR &aError) const
bool RefreshAccessToken(const REMOTE_PROVIDER_OAUTH_SERVER_METADATA &aMetadata, const wxString &aClientId, const wxString &aRefreshToken, OAUTH_TOKEN_SET &aTokens, REMOTE_PROVIDER_ERROR &aError) const
bool FetchJson(const REMOTE_PROVIDER_HTTP_REQUEST &aRequest, nlohmann::json &aJson, REMOTE_PROVIDER_ERROR &aError) const
bool ParseTokenResponse(const REMOTE_PROVIDER_HTTP_RESPONSE &aResponse, OAUTH_TOKEN_SET &aTokens, REMOTE_PROVIDER_ERROR &aError) const
bool DiscoverProvider(const wxString &aProviderUrl, REMOTE_PROVIDER_METADATA &aMetadata, REMOTE_PROVIDER_ERROR &aError) const
#define KICOMMON_API
Definition kicommon.h:28
std::function< bool(const REMOTE_PROVIDER_HTTP_REQUEST &, REMOTE_PROVIDER_HTTP_RESPONSE &, wxString &)> REMOTE_PROVIDER_HTTP_HANDLER
REMOTE_PROVIDER_HTTP_METHOD
REMOTE_PROVIDER_SIGNIN_STATE
std::vector< REMOTE_PROVIDER_HTTP_HEADER > headers
REMOTE_PROVIDER_HTTP_METHOD method