olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
AuthenticationClient.h
1/*
2 * Copyright (C) 2019-2025 HERE Europe B.V.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * SPDX-License-Identifier: Apache-2.0
17 * License-Filename: LICENSE
18 */
19
20#pragma once
21
22#include <chrono>
23#include <functional>
24#include <memory>
25#include <string>
26
27#include <olp/authentication/AppleSignInProperties.h>
28#include <olp/authentication/AuthenticationApi.h>
29#include <olp/authentication/AuthenticationCredentials.h>
30#include <olp/authentication/AuthenticationSettings.h>
31#include <olp/authentication/AuthorizeRequest.h>
32#include <olp/authentication/SignInResult.h>
33#include <olp/authentication/SignInUserResult.h>
34#include <olp/authentication/SignOutResult.h>
35#include <olp/authentication/SignUpResult.h>
36#include <olp/authentication/Types.h>
37#include <olp/core/client/ApiResponse.h>
38#include <olp/core/client/CancellationToken.h>
39#include <olp/core/porting/optional.h>
40
44namespace olp {
45
49namespace authentication {
50class AuthenticationClientImpl;
51
59class AUTHENTICATION_API AuthenticationClient {
60 public:
68 porting::optional<std::string> scope{porting::none};
69
76 porting::optional<std::string> device_id{porting::none};
77
85 std::chrono::seconds expires_in{0};
86
92 porting::optional<std::string> custom_body{olp::porting::none};
93 };
94
102 std::string email;
103
107 std::string password;
108
116 unsigned int expires_in{0};
117 };
118
128 std::string access_token;
129
137 std::string country_code;
138
146 std::string language;
147
154 std::string email;
155
164 unsigned int expires_in{0};
165 };
166
175 std::string email;
176
180 std::string password;
181
185 std::string date_of_birth;
186
190 std::string first_name;
191
195 std::string last_name;
196
201 std::string country_code;
202
207 std::string language;
208
212 bool marketing_enabled{false};
213
219 std::string phone_number;
220
229 std::string realm;
230
236 std::string invite_token;
237 };
238
250 std::string access_token;
251
258 std::string refresh_token;
259
268 unsigned int expires_in{0};
269 };
270
273
276
279
282
285
288
291
294
302 virtual ~AuthenticationClient();
303
306
309
312
315
333 client::CancellationToken SignInClient(AuthenticationCredentials credentials,
334 SignInProperties properties,
335 SignInClientCallback callback);
336
352 client::CancellationToken SignInHereUser(
353 const AuthenticationCredentials& credentials,
354 const UserProperties& properties, const SignInUserCallback& callback);
355
377 client::CancellationToken SignInFederated(
378 AuthenticationCredentials credentials, std::string request_body,
379 SignInUserCallback callback);
380
400 client::CancellationToken SignInFacebook(
401 const AuthenticationCredentials& credentials,
402 const FederatedProperties& properties,
403 const SignInUserCallback& callback);
404
424 client::CancellationToken SignInArcGis(
425 const AuthenticationCredentials& credentials,
426 const FederatedProperties& properties,
427 const SignInUserCallback& callback);
428
443 client::CancellationToken SignInApple(AppleSignInProperties properties,
444 SignInUserCallback callback);
445
468 client::CancellationToken SignInRefresh(
469 const AuthenticationCredentials& credentials,
470 const RefreshProperties& properties, const SignInUserCallback& callback);
471
489 client::CancellationToken SignUpHereUser(
490 const AuthenticationCredentials& credentials,
491 const SignUpProperties& properties, const SignUpCallback& callback);
492
516 client::CancellationToken AcceptTerms(
517 const AuthenticationCredentials& credentials,
518 const std::string& reacceptance_token,
519 const SignInUserCallback& callback);
520
540 client::CancellationToken SignOut(
541 const AuthenticationCredentials& credentials,
542 const std::string& user_access_token,
543 const SignOutUserCallback& callback);
544
559 client::CancellationToken IntrospectApp(std::string access_token,
560 IntrospectAppCallback callback);
561
578 client::CancellationToken Authorize(std::string access_token,
579 AuthorizeRequest request,
580 AuthorizeCallback callback);
581
603 client::CancellationToken GetMyAccount(std::string access_token,
604 UserAccountInfoCallback callback);
605
606 private:
607 std::shared_ptr<AuthenticationClientImpl> impl_;
608};
609
610} // namespace authentication
611} // namespace olp
The Apple sign-in properties.
Definition AppleSignInProperties.h:30
Provides programmatic access to the HERE Account Authentication Service.
Definition AuthenticationClient.h:59
AuthenticationClient & operator=(const AuthenticationClient &)=delete
A copy assignment operator.
AuthenticationClient(AuthenticationSettings settings)
Creates the AuthenticationClient instance.
Callback< SignOutResult > SignOutUserCallback
The callback type of the user sign-out response.
Definition AuthenticationClient.h:293
Callback< SignInUserResult > SignInUserCallback
The callback type of the user sign-in response.
Definition AuthenticationClient.h:281
Callback< SignInResult > SignInClientCallback
The callback type of the client sign-in response.
Definition AuthenticationClient.h:275
AuthenticationClient(const AuthenticationClient &)=delete
A copy constructor.
AuthenticationClient(AuthenticationClient &&) noexcept
A default move constructor.
Callback< SignUpResult > SignUpCallback
The callback type of the user sign-up response.
Definition AuthenticationClient.h:287
The access key ID and access key secret that you got from the HERE Account as a part of the onboardin...
Definition AuthenticationCredentials.h:45
Encapsulates the fields required to make a policy decision for a given request context against the HE...
Definition AuthorizeRequest.h:47
Represents a request outcome.
Definition ApiResponse.h:65
Callback< AuthorizeResult > AuthorizeCallback
Called when the user decision request is completed.
Definition Types.h:52
Callback< model::UserAccountInfoResponse > UserAccountInfoCallback
Called when the get user account request is completed.
Definition Types.h:58
Callback< IntrospectAppResult > IntrospectAppCallback
Called when the user introspect app request is completed.
Definition Types.h:46
std::function< void(Response< ResultType >)> Callback
The callback template type.
Definition Types.h:40
Rules all the other namespaces.
Definition AppleSignInProperties.h:24
The federated (Facebook, Google, ArcGIS) sign-in properties structure.
Definition AuthenticationClient.h:123
std::string access_token
(Required) A valid Facebook, Google, or ArcGIS access token obtained from the Facebook,...
Definition AuthenticationClient.h:128
std::string language
The code of the language that you speak in the ISO 639-1 alpha-2 format.
Definition AuthenticationClient.h:146
std::string email
Your valid email address.
Definition AuthenticationClient.h:154
std::string country_code
The code of the country in which you live in the ISO 3166-1 alpha-3 format.
Definition AuthenticationClient.h:137
Used to generate a new access token and contains token values returned as a response to the user sign...
Definition AuthenticationClient.h:243
std::string refresh_token
(Required) The refresh token value returned in the response of the user sign-in operation.
Definition AuthenticationClient.h:258
std::string access_token
(Required) The access token value returned as a response to the user sign-in operation.
Definition AuthenticationClient.h:250
General properties used to sign in with client credentials.
Definition AuthenticationClient.h:64
Used to create a new HERE account for the specified user with the email and password that are your lo...
Definition AuthenticationClient.h:171
std::string email
(Required) Your valid email address.
Definition AuthenticationClient.h:175
std::string language
(Required) The code of the language that you speak in the ISO 639-1 alpha-2 format.
Definition AuthenticationClient.h:207
std::string password
(Required) Your plain-text password.
Definition AuthenticationClient.h:180
std::string date_of_birth
(Required) Your date of birth in the following format: dd/mm/yyyy.
Definition AuthenticationClient.h:185
std::string phone_number
(Optional) Your valid phone number.
Definition AuthenticationClient.h:219
std::string last_name
(Required) Your last name.
Definition AuthenticationClient.h:195
std::string first_name
(Required) Your first name.
Definition AuthenticationClient.h:190
std::string realm
(Optional) The realm in which you want to create the user.
Definition AuthenticationClient.h:229
std::string country_code
(Required) The code of the country in which you live in the ISO 3166-1 alpha-3 format.
Definition AuthenticationClient.h:201
std::string invite_token
(Optional) The valid Authorization Invite Token with a payload that matches the user email and reques...
Definition AuthenticationClient.h:236
The user sign-in properties struct.
Definition AuthenticationClient.h:98
std::string password
(Required) Your plain-text password.
Definition AuthenticationClient.h:107
std::string email
(Required) Your valid email address.
Definition AuthenticationClient.h:102
Configures the TokenEndpoint instance.
Definition AuthenticationSettings.h:49