AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface Class Referenceabstract

#include <AuthDelegateInterface.h>

Inheritance diagram for alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface:
Inheritance graph
[legend]

Public Member Functions

virtual ~AuthDelegateInterface ()=default
 
virtual void addAuthObserver (std::shared_ptr< avsCommon::sdkInterfaces::AuthObserverInterface > observer)=0
 
virtual void removeAuthObserver (std::shared_ptr< avsCommon::sdkInterfaces::AuthObserverInterface > observer)=0
 
virtual std::string getAuthToken ()=0
 
virtual void onAuthFailure (const std::string &token)=0
 

Detailed Description

The AuthDelegateInterface is used to provide clients with valid LWA authorization tokens.

See also
https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/content/avs-api-overview#authorization Given an AuthDelegateInterface pointer, the client is expected to call getAuthToken() immediately before making AVS requests. The returned value is passed in the HTTP/2 header of requests sent to AVS. These authorization tokens may expire, so AuthDelegates also track the state of authorization (essentially, whether an immediate call to getAuthToken() will return a token that is expected to be viable). The client may elect to receive callbacks when this state changes by calling setAuthObserver(). This allows the client to avoid sending requests tha are doomed to fail because the authorization token has already expired. This also allows the client to know when authorization has been restored.

Constructor & Destructor Documentation

◆ ~AuthDelegateInterface()

virtual alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface::~AuthDelegateInterface ( )
virtualdefault

Virtual destructor to assure proper cleanup of derived types.

Member Function Documentation

◆ addAuthObserver()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface::addAuthObserver ( std::shared_ptr< avsCommon::sdkInterfaces::AuthObserverInterface observer)
pure virtual

Specify an object to observe changes to the authorization state of this AuthDelegate. During the call to this setter the observers onAuthStateChange() method will be called back with the current authorization state.

Parameters
observerThe object to observe this authorization state of this AuthDelegate.

◆ getAuthToken()

virtual std::string alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface::getAuthToken ( )
pure virtual

Get the current LWA authorization token.

Returns
The current authorization token. The returned value will be empty if an authorization token has yet to be acquired or if the most recently acquired token has expired.

Implemented in alexaClientSDK::acsdkAuthorization::AuthorizationManager, alexaClientSDK::authorization::cblAuthDelegate::CBLAuthDelegate, alexaClientSDK::acsdkAssets::common::AuthDelegateMock, and alexaClientSDK::acl::test::MockAuthDelegate.

◆ onAuthFailure()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface::onAuthFailure ( const std::string &  token)
pure virtual

Receive notification that an operation using the specified auth token experienced an authorization failure.

Parameters
tokenThe token used to authorize the forbidden operation.

Implemented in alexaClientSDK::acsdkAuthorization::AuthorizationManager, alexaClientSDK::authorization::cblAuthDelegate::CBLAuthDelegate, and alexaClientSDK::acsdkAssets::common::AuthDelegateMock.

◆ removeAuthObserver()

virtual void alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface::removeAuthObserver ( std::shared_ptr< avsCommon::sdkInterfaces::AuthObserverInterface observer)
pure virtual

Remove an observer

Parameters
observerThe observer to remove.

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

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0