olp-cpp-sdk  1.19.0
Classes | Public Types | Public Member Functions | List of all members
olp::authentication::AuthenticationClient Class Reference

Provides programmatic access to the HERE Account Authentication Service. More...

#include <AuthenticationClient.h>

Classes

struct  FederatedProperties
 The federated (Facebook, Google, ArcGIS) sign-in properties structure. More...
 
struct  RefreshProperties
 Used to generate a new access token and contains token values returned as a response to the user sign-in operation. More...
 
struct  SignInProperties
 General properties used to sign in with client credentials. More...
 
struct  SignUpProperties
 Used to create a new HERE account for the specified user with the email and password that are your login credentials. More...
 
struct  UserProperties
 The user sign-in properties struct. More...
 

Public Types

using SignInClientResponse = Response< SignInResult >
 The client sign-in response type.
 
using SignInClientCallback = Callback< SignInResult >
 The callback type of the client sign-in response.
 
using SignInUserResponse = Response< SignInUserResult >
 The user sign-in response type.
 
using SignInUserCallback = Callback< SignInUserResult >
 The callback type of the user sign-in response.
 
using SignUpResponse = Response< SignUpResult >
 The client sign-up response type.
 
using SignUpCallback = Callback< SignUpResult >
 The callback type of the user sign-up response.
 
using SignOutUserResponse = Response< SignOutResult >
 The client sign-out response type.
 
using SignOutUserCallback = Callback< SignOutResult >
 The callback type of the user sign-out response.
 

Public Member Functions

 AuthenticationClient (AuthenticationSettings settings)
 Creates the AuthenticationClient instance. More...
 
 AuthenticationClient (const AuthenticationClient &)=delete
 A copy constructor.
 
AuthenticationClientoperator= (const AuthenticationClient &)=delete
 A copy assignment operator.
 
 AuthenticationClient (AuthenticationClient &&) noexcept
 A default move constructor.
 
AuthenticationClientoperator= (AuthenticationClient &&) noexcept
 A move assignment operator.
 
client::CancellationToken SignInClient (AuthenticationCredentials credentials, SignInProperties properties, SignInClientCallback callback)
 Signs in with your HERE Account client credentials and requests the client access token. More...
 
client::CancellationToken SignInHereUser (const AuthenticationCredentials &credentials, const UserProperties &properties, const SignInUserCallback &callback)
 Signs in with the email and password that you used for registration via the sign-up API and requests your user access token. More...
 
client::CancellationToken SignInFederated (AuthenticationCredentials credentials, std::string request_body, SignInUserCallback callback)
 Signs in with a custom request body. More...
 
client::CancellationToken SignInFacebook (const AuthenticationCredentials &credentials, const FederatedProperties &properties, const SignInUserCallback &callback)
 Signs in with your valid Facebook token and requests your user access token. More...
 
client::CancellationToken SignInArcGis (const AuthenticationCredentials &credentials, const FederatedProperties &properties, const SignInUserCallback &callback)
 Signs in with your valid ArcGIS token and requests your user access token. More...
 
client::CancellationToken SignInApple (AppleSignInProperties properties, SignInUserCallback callback)
 Signs in with your valid Apple token and requests your user access token. More...
 
client::CancellationToken SignInRefresh (const AuthenticationCredentials &credentials, const RefreshProperties &properties, const SignInUserCallback &callback)
 Signs in with the refresh token. More...
 
client::CancellationToken SignUpHereUser (const AuthenticationCredentials &credentials, const SignUpProperties &properties, const SignUpCallback &callback)
 Signs up with your user properties and creates a new HERE Account to use your login credentials: email and password. More...
 
client::CancellationToken AcceptTerms (const AuthenticationCredentials &credentials, const std::string &reacceptance_token, const SignInUserCallback &callback)
 Accepts the terms and conditions. More...
 
client::CancellationToken SignOut (const AuthenticationCredentials &credentials, const std::string &user_access_token, const SignOutUserCallback &callback)
 Signs the user out. More...
 
client::CancellationToken IntrospectApp (std::string access_token, IntrospectAppCallback callback)
 Retrieves the application associated with the client access token. More...
 
client::CancellationToken Authorize (std::string access_token, AuthorizeRequest request, AuthorizeCallback callback)
 Retrieves policy decision for a given request context against the HERE Service. More...
 
client::CancellationToken GetMyAccount (std::string access_token, UserAccountInfoCallback callback)
 Retrieves the account information associated with the user access token. More...
 

Detailed Description

Provides programmatic access to the HERE Account Authentication Service.

The supported APIs mirror the REST APIs currently available for the HERE Account Authentication Service.

Constructor & Destructor Documentation

◆ AuthenticationClient()

olp::authentication::AuthenticationClient::AuthenticationClient ( AuthenticationSettings  settings)
explicit

Creates the AuthenticationClient instance.

Parameters
settingsThe authentication settings that can be used to configure the AuthenticationClient instance.

Member Function Documentation

◆ AcceptTerms()

client::CancellationToken olp::authentication::AuthenticationClient::AcceptTerms ( const AuthenticationCredentials credentials,
const std::string &  reacceptance_token,
const SignInUserCallback callback 
)

Accepts the terms and conditions.

Requires the "terms re-acceptance required" response represented by the following statuses:

  • HTTP 412 – received after you sign in with the existing user account.
  • HTTP 201 – received after you create a new account.

The terms and conditions are explicitly accepted by providing the terms re-acceptance token back to this API.

Parameters
credentialsThe AuthenticationCredentials instance.
reacceptance_tokenThe terms re-acceptance token from the HTTP 412 or HTTP 201 response: SignInUserResult::GetTermAcceptanceToken().
callbackThe SignInUserCallback method that is called when the user sign-in request is completed. If successful, the returned HTTP status is 204. Otherwise, check the response error.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ Authorize()

client::CancellationToken olp::authentication::AuthenticationClient::Authorize ( std::string  access_token,
AuthorizeRequest  request,
AuthorizeCallback  callback 
)

Retrieves policy decision for a given request context against the HERE Service.

Collects all permissions associated with the authenticated user or application, requested service ID, and requested contract ID.

Parameters
access_tokenA valid access token that is associated with the service.
requestЕру сontext of the Authorize request.
callbackTheAuthorizeCallback method that is called when the Authorize request is completed.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ GetMyAccount()

client::CancellationToken olp::authentication::AuthenticationClient::GetMyAccount ( std::string  access_token,
UserAccountInfoCallback  callback 
)

Retrieves the account information associated with the user access token.

Note
The user information will be filtered based on the scopes in the token: email - 'email', 'emailVerified', 'recoveryEmail'; openid - 'userId', 'state'; phone - 'phoneNumber', 'phoneNumberVerified'; profile - 'realm', 'facebookId', 'firstname', 'lastname', 'dob', 'language', 'countryCode', 'marketingEnabled', 'createdTime', 'updatedTime'.
Parameters
access_tokenA valid access token that is associated with the user.
callbackTheUserAccountInfoCallback method that is called when the user information request is completed.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ IntrospectApp()

client::CancellationToken olp::authentication::AuthenticationClient::IntrospectApp ( std::string  access_token,
IntrospectAppCallback  callback 
)

Retrieves the application associated with the client access token.

The application does not need permissions to access this endpoint. It will allow any client access token to retrieve its own information.

Parameters
access_tokenA valid access token that is associated with the application.
callbackTheIntrospectAppCallback method that is called when the client introspect request is completed.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ SignInApple()

client::CancellationToken olp::authentication::AuthenticationClient::SignInApple ( AppleSignInProperties  properties,
SignInUserCallback  callback 
)

Signs in with your valid Apple token and requests your user access token.

Parameters
propertiesThe AppleSignInProperties instance.
callbackThe SignInUserCallback method that is called when the user sign-in request is completed. If successful, the returned HTTP status is 200. If a new account is created as a part of the sign-in request, and terms must be accepted, the returned HTTP status is 201. Otherwise, check the response error.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ SignInArcGis()

client::CancellationToken olp::authentication::AuthenticationClient::SignInArcGis ( const AuthenticationCredentials credentials,
const FederatedProperties properties,
const SignInUserCallback callback 
)

Signs in with your valid ArcGIS token and requests your user access token.

If this is the first time that you use ArcGIS to sign in, a new HERE Account is automatically created and filled in with the data from your ArcGIS account, including your name and email.

Parameters
credentialsThe AuthenticationCredentials instance.
propertiesThe FederatedProperties structure.
callbackThe SignInUserCallback method that is called when the user sign-in request is completed. If successful, the returned HTTP status is 200. If a new account is created as a part of the sign-in request and terms must be accepted, the returned HTTP status is 201. Otherwise, check the response error.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ SignInClient()

client::CancellationToken olp::authentication::AuthenticationClient::SignInClient ( AuthenticationCredentials  credentials,
SignInProperties  properties,
SignInClientCallback  callback 
)

Signs in with your HERE Account client credentials and requests the client access token.

The client access tokens cannot be refreshed. Instead, request a new client access token using your client credentials.

Parameters
credentialsThe AuthenticationCredentials instance.
propertiesThe SignInProperties structure that has the scope and expiration time.
callbackTheSignInClientCallback method that is called when the client sign-in request is completed. If successful, the returned HTTP status is 200. Otherwise, check the response error.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ SignInFacebook()

client::CancellationToken olp::authentication::AuthenticationClient::SignInFacebook ( const AuthenticationCredentials credentials,
const FederatedProperties properties,
const SignInUserCallback callback 
)

Signs in with your valid Facebook token and requests your user access token.

If this is the first time that you use Facebook to sign in, a new HERE Account is automatically created and filled in with the data from your Facebook account, including your name and email.

Parameters
credentialsThe AuthenticationCredentials instance.
propertiesThe FederatedProperties structure.
callbackThe SignInUserCallback method that is called when the user sign-in request is completed. If successful, the returned HTTP status is 200. If a new account is created as a part of the sign-in request and terms must be accepted, the returned HTTP status is 201. Otherwise, check the response error.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ SignInFederated()

client::CancellationToken olp::authentication::AuthenticationClient::SignInFederated ( AuthenticationCredentials  credentials,
std::string  request_body,
SignInUserCallback  callback 
)

Signs in with a custom request body.

This method provides the mechanism to authenticate with the HERE platform using a custom request body. You should use this method when the HERE platform authentication backend offers you individual parameters or endpoint.

Parameters
credentialsThe AuthenticationCredentials instance.
request_bodyThe request body that will be passed to the OAuth endpoint.
callbackThe SignInUserCallback method that is called when the user sign-in request is completed. If successful, the returned HTTP status is 200. If a new account is created as a part of the sign-in request and terms must be accepted, the returned HTTP status is 201 for the first time and 412 for subsequent requests as long as you accept the terms. Otherwise, check the response error.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ SignInHereUser()

client::CancellationToken olp::authentication::AuthenticationClient::SignInHereUser ( const AuthenticationCredentials credentials,
const UserProperties properties,
const SignInUserCallback callback 
)

Signs in with the email and password that you used for registration via the sign-up API and requests your user access token.

The user access tokens can be refreshed using the SignInRefresh method.

Parameters
credentialsThe AuthenticationCredentials instance.
propertiesThe UserProperties structure.
callbackThe SignInUserCallback method that is called when the user sign-in request is completed. If successful, the returned HTTP status is 200. Otherwise, check the response error.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ SignInRefresh()

client::CancellationToken olp::authentication::AuthenticationClient::SignInRefresh ( const AuthenticationCredentials credentials,
const RefreshProperties properties,
const SignInUserCallback callback 
)

Signs in with the refresh token.

Exchanges the user access token and refresh token for a new user access token. The HERE user access token expires in 24 hours. Not to ask to specify the credentials again, a new access token can be requested using the refresh token. The refresh token is always matched to a particular access token and must be kept secure in the client. The access token can already be expired when used together with the refresh token. The refresh token expires after being used. There is a limit of 3 simultaneously active refresh tokens per user. After logging in 4 times, the first token-pair can no longer be refreshed.

Parameters
credentialsThe AuthenticationCredentials instance.
propertiesThe RefreshProperties structure.
callbackThe SignInUserCallback method that is called when the user sign-in request is completed. If successful, the returned HTTP status is 200. Otherwise, check the response error.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ SignOut()

client::CancellationToken olp::authentication::AuthenticationClient::SignOut ( const AuthenticationCredentials credentials,
const std::string &  user_access_token,
const SignOutUserCallback callback 
)

Signs the user out.

Calls the sign-out API and deletes any locally stored tokens. The access token that is used to sign out is immediately invalidated for the token refresh purposes.

Note
This is not a global sign-out. Other devices or services that have different access tokens for the same user remain signed in.
Parameters
credentialsThe AuthenticationCredentials instance.
user_access_tokenThe access token from the SignInUserResponse instance.
callbackThe SignOutUserCallback method that is called when the user sign-out request is completed. If successful, the returned HTTP status is 204. Otherwise, check the response error.
Returns
The CancellationToken instance that can be used to cancel the request.

◆ SignUpHereUser()

client::CancellationToken olp::authentication::AuthenticationClient::SignUpHereUser ( const AuthenticationCredentials credentials,
const SignUpProperties properties,
const SignUpCallback callback 
)

Signs up with your user properties and creates a new HERE Account to use your login credentials: email and password.

The HERE user is uniquely identified by the user ID that is consistent across the other HERE platform Services, regardless of the authentication method used.

Parameters
credentialsThe AuthenticationCredentials instance.
propertiesThe SignUpProperties structure.
callbackThe SignUpCallback method that is called when the user sign-up request is completed. If successful, the returned HTTP status is 201. Otherwise, check the response error.
Returns
The CancellationToken instance that can be used to cancel the request.

The documentation for this class was generated from the following file: