Skip to content

Commit dfd4c9d

Browse files
author
Liubov Didkivska
authored
DecisionAPI implementation (#801)
* DecisionAPI implementation Add functionality to perform DecisionAPI authorization. Add functional tests. Relates-To: OLPEDGE-1802 Signed-off-by: Liubov Didkivska <ext-liubov.didkivska@here.com>
1 parent 0ae1eef commit dfd4c9d

File tree

12 files changed

+720
-48
lines changed

12 files changed

+720
-48
lines changed

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

Lines changed: 21 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/AuthorizeRequest.h>
2930
#include <olp/authentication/Types.h>
3031
#include <olp/core/client/ApiResponse.h>
3132
#include <olp/core/client/CancellationToken.h>
@@ -564,6 +565,26 @@ class AUTHENTICATION_API AuthenticationClient {
564565
client::CancellationToken IntrospectApp(std::string access_token,
565566
IntrospectAppCallback callback);
566567

568+
/**
569+
* @brief Retrieves policy decision for a given request context against the
570+
* HERE Service.
571+
*
572+
* Collects all permissions associated with the authenticated user or
573+
* application, requested service ID, and requested contract ID.
574+
*
575+
* @param access_token A valid access token that is associated with the
576+
* service.
577+
* @param request Context of the Authorize request.
578+
* @param callback The`AuthorizeCallback` method that is called when
579+
* the Authorize request is completed.
580+
*
581+
* @return The `CancellationToken` instance that can be used to cancel
582+
* the request.
583+
*/
584+
client::CancellationToken Authorize(std::string access_token,
585+
AuthorizeRequest request,
586+
AuthorizeCallback callback);
587+
567588
private:
568589
class Impl;
569590
std::unique_ptr<Impl> impl_;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class AUTHENTICATION_API AuthorizeRequest final {
145145
/**
146146
* @brief Gets all actions.
147147
*
148-
* @return The vector of the actions (action-resorce pairs).
148+
* @return The vector of the actions (action-resource pairs).
149149
*/
150150
inline const Actions& GetActions() const { return actions_; }
151151

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class AUTHENTICATION_API ActionResult {
4444
/**
4545
* @brief Represents the permission pair with the action and policy decision.
4646
*/
47-
using Permisions = std::pair<std::string, DecisionType>;
47+
using Permissions = std::pair<std::string, DecisionType>;
4848

4949
/**
5050
* @brief Gets the overall policy decision.
@@ -63,7 +63,7 @@ class AUTHENTICATION_API ActionResult {
6363
void SetDecision(DecisionType decision) { decision_ = decision; }
6464

6565
/**
66-
* @brief Gets the list of permitions that are evaluated against the
66+
* @brief Gets the list of permissions that are evaluated against the
6767
action and resource.
6868
*
6969
* @note The algorithm of evaluating each permission in the set against the
@@ -75,22 +75,22 @@ class AUTHENTICATION_API ActionResult {
7575
* * If ALL considered permissions for the action result in ALLOW, the
7676
* individual policy decision for the action is ALLOW.
7777
*
78-
* @return The list of permitions.
78+
* @return The list of permissions.
7979
*/
80-
const std::vector<Permisions>& GetPermitions() const { return permisions_; }
80+
const std::vector<Permissions>& GetPermissions() const { return permissions_; }
8181

8282
/**
83-
* @brief Sets the list of permitions.
83+
* @brief Sets the list of permissions.
8484
*
85-
* @param permitions The vector of the action-decision pair.
85+
* @param permissions The vector of the action-decision pair.
8686
*/
87-
void SetPermitions(std::vector<Permisions> permisions) {
88-
permisions_ = std::move(permisions);
87+
void SetPermissions(std::vector<Permissions> permissions) {
88+
permissions_ = std::move(permissions);
8989
}
9090

9191
private:
9292
DecisionType decision_{DecisionType::kDeny};
93-
std::vector<Permisions> permisions_;
93+
std::vector<Permissions> permissions_;
9494
};
9595

9696
/**

0 commit comments

Comments
 (0)