olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
OauthToken.h
1/*
2 * Copyright (C) 2021 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 <ctime>
24#include <string>
25
26#include <olp/core/CoreApi.h>
27#include <olp/core/client/ApiError.h>
28#include <olp/core/client/ApiResponse.h>
29
30namespace olp {
31namespace client {
39class CORE_API OauthToken {
40 public:
47 OauthToken(std::string access_token, time_t expiry_time);
48
55 OauthToken(std::string access_token, std::chrono::seconds expires_in);
56
60 OauthToken() = default;
61
67 const std::string& GetAccessToken() const;
68
74 time_t GetExpiryTime() const;
75
81 std::chrono::seconds GetExpiresIn() const;
82
83 private:
84 std::string access_token_;
85 std::chrono::seconds expires_in_;
86 time_t expiry_time_;
87};
88
91
92} // namespace client
93} // namespace olp
Represents a request outcome.
Definition ApiResponse.h:65
A parsed response received from the OAuth2.0 token endpoint.
Definition OauthToken.h:39
std::chrono::seconds GetExpiresIn() const
Gets the number of seconds the token is still valid for.
time_t GetExpiryTime() const
Gets the Epoch time when the token expires.
const std::string & GetAccessToken() const
Gets the access token issued by the authorization server.
OauthToken(std::string access_token, std::chrono::seconds expires_in)
Creates the OauthToken instance.
OauthToken()=default
Creates the default OauthToken instance.
OauthToken(std::string access_token, time_t expiry_time)
Creates the OauthToken instance.
Rules all the other namespaces.
Definition AppleSignInProperties.h:24