Skip to content

Commit 65d5b8d

Browse files
authored
Expose introspect app API (#694)
Added new IntrospectApp method for AuthenticationClient. Now it's possible to obtain application info like name, description, realm etc. using access token. Functional and integration tests added also. Resolves: OLPEDGE-1489 Signed-off-by: Kostiantyn Zvieriev <[email protected]>
1 parent a9730c2 commit 65d5b8d

File tree

9 files changed

+506
-20
lines changed

9 files changed

+506
-20
lines changed

olp-cpp-sdk-authentication/include/olp/authentication/AuthenticationClient.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <string>
2727

2828
#include <olp/authentication/AuthenticationSettings.h>
29+
#include <olp/authentication/Types.h>
2930
#include <olp/core/client/ApiResponse.h>
3031
#include <olp/core/client/CancellationToken.h>
3132
#include <olp/core/http/NetworkProxySettings.h>
@@ -585,6 +586,23 @@ class AUTHENTICATION_API AuthenticationClient {
585586
const std::string& user_access_token,
586587
const SignOutUserCallback& callback);
587588

589+
/**
590+
* @brief Retrieves the application associated with the client access token.
591+
*
592+
* The application does not need permissions to access this endpoint.
593+
* It will allow any client access token to retrieve its own information.
594+
*
595+
* @param access_token A valid access token that is associated with the
596+
* application.
597+
* @param callback The`IntrospectAppCallback` method that is called when
598+
* the client introspect request is completed.
599+
*
600+
* @return The `CancellationToken` instance that can be used to cancel
601+
* the request.
602+
*/
603+
client::CancellationToken IntrospectApp(std::string access_token,
604+
IntrospectAppCallback callback);
605+
588606
/**
589607
* @brief Sets the `NetworkProxySettings` instance used by the underlying
590608
* network layer to make requests.

olp-cpp-sdk-authentication/include/olp/authentication/IntrospectAppResult.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ class AUTHENTICATION_API IntrospectAppResult {
121121
/**
122122
* @brief Token endpoint authentication method.
123123
*
124-
* The default value will be "client_secret_jwt".
125-
*
126124
* @return The token endpoint authentication method.
127125
*/
128126
const std::string& GetTokenEndpointAuthMethod() const {
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (C) 2020 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 <memory>
23+
24+
#include <olp/authentication/AuthenticationError.h>
25+
#include <olp/authentication/IntrospectAppResult.h>
26+
#include <olp/core/client/ApiError.h>
27+
#include <olp/core/client/ApiResponse.h>
28+
29+
namespace olp {
30+
namespace authentication {
31+
32+
/// The response template type.
33+
template <typename ResultType>
34+
using Response = client::ApiResponse<ResultType, AuthenticationError>;
35+
36+
/// The callback template type.
37+
template <typename ResultType>
38+
using Callback = std::function<void(Response<ResultType>)>;
39+
40+
/// Defines the callback signature when the user request is completed.
41+
using IntrospectAppResponse = Response<IntrospectAppResult>;
42+
43+
/// Called when the user introspect app request is completed.
44+
using IntrospectAppCallback = Callback<IntrospectAppResult>;
45+
46+
} // namespace authentication
47+
} // namespace olp

0 commit comments

Comments
 (0)