AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage Class Reference

A SQLite based version of LWAAuthorizationStorageInterface. More...

#include <LWAAuthorizationStorage.h>

Inheritance diagram for alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage:
Collaboration graph
[legend]

Public Member Functions

 ~LWAAuthorizationStorage ()
 
LWAAuthorizationStorageInterface method overrides.
bool createDatabase () override
 
bool open () override
 
bool openOrCreate () override
 
bool setRefreshToken (const std::string &refreshToken) override
 
bool clearRefreshToken () override
 
bool getRefreshToken (std::string *refreshToken) override
 
bool setUserId (const std::string &userId) override
 
bool getUserId (std::string *userId) override
 
bool clear () override
 
- Public Member Functions inherited from alexaClientSDK::acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface
virtual ~LWAAuthorizationStorageInterface ()=default
 

Static Public Member Functions

static std::shared_ptr< LWAAuthorizationStorageInterface > createStorage (const std::shared_ptr< propertiesInterfaces::PropertiesFactoryInterface > &propertiesFactory)
 Create storage interface. More...
 
static std::shared_ptr< acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterfacecreateLWAAuthorizationStorageInterface (const std::shared_ptr< avsCommon::utils::configuration::ConfigurationNode > &configurationRoot, const std::string &storageRootKey, const std::shared_ptr< cryptoInterfaces::CryptoFactoryInterface > &cryptoFactory, const std::shared_ptr< cryptoInterfaces::KeyStoreInterface > &keyStore)
 Create storage interface backed by SQLite. More...
 

Detailed Description

A SQLite based version of LWAAuthorizationStorageInterface.

Storage implementation based on Properties API.

This implementation class adapts properties interface to domain-specific authorization storage interface. Depending on

See also
Properties API

Constructor & Destructor Documentation

◆ ~LWAAuthorizationStorage()

alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::~LWAAuthorizationStorage ( )

Destructor.

Member Function Documentation

◆ clear()

bool alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::clear ( )
overridevirtual

A utility function to clear all records from storage. Note that the storage will still exist, it will just have not content.

Returns
Whether the database was successfully cleared.

Implements alexaClientSDK::acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface.

◆ clearRefreshToken()

bool alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::clearRefreshToken ( )
overridevirtual

Clear the stored refresh token value.

Returns
Whether the refresh token was successfully cleared.

Implements alexaClientSDK::acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface.

◆ createDatabase()

bool alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::createDatabase ( )
overridevirtual
Deprecated:
The recommendation is to use use openOrCreate().

Creates a new database with the given filepath. If the file specified already exists, or if a database is already being handled by this object, then this function returns false.

Returns
true If the database is created ok, or false if either the file exists or a database is already being handled by this object.

Implements alexaClientSDK::acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface.

◆ createLWAAuthorizationStorageInterface()

static std::shared_ptr<acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface> alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::createLWAAuthorizationStorageInterface ( const std::shared_ptr< avsCommon::utils::configuration::ConfigurationNode > &  configurationRoot,
const std::string &  storageRootKey,
const std::shared_ptr< cryptoInterfaces::CryptoFactoryInterface > &  cryptoFactory,
const std::shared_ptr< cryptoInterfaces::KeyStoreInterface > &  keyStore 
)
static

Create storage interface backed by SQLite.

Factory method for creating a storage object for creating a storage interface based on an SQLite database. If platform configuration has both cryptography and hardware security module support, all the stored values will be encrypted. If there is no cryptography module and/or HSM support, all values will be stored in unencrypted form.

Parameters
[in]configurationRootThe global config object.
[in]storageRootKeyThe key to use to find the parent node.
[in]cryptoFactoryCrypto factory interface. This interface is required if HSM integration is enabled.
[in]keyStoreKey store interface. This interface is required if HSM integration is enabled.
Returns
Pointer to the LWAAuthorizationStorage object, nullptr if there's an error creating it.
See also
CryptoIMPL
CryptoPKCS11

◆ createStorage()

static std::shared_ptr<LWAAuthorizationStorageInterface> alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::createStorage ( const std::shared_ptr< propertiesInterfaces::PropertiesFactoryInterface > &  propertiesFactory)
static

Create storage interface.

Factory method for creating a storage interface using properties API. For certification it is important to use encrypted properties factory.

Parameters
[in]propertiesFactoryProperties factory interface.
Returns
Pointer to the LWAAuthorizationStorage object, nullptr if there's an error creating it.

◆ getRefreshToken()

bool alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::getRefreshToken ( std::string *  refreshToken)
overridevirtual

Get the stored refresh token value.

Parameters
[out]refreshToken
Returns
Whether or not the operation was successful.

Implements alexaClientSDK::acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface.

◆ getUserId()

bool alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::getUserId ( std::string *  userId)
overridevirtual

Retrieves the UserId associated with the account.

Parameters
[out]userId
Returns
Whether or not the operation was successful.

Implements alexaClientSDK::acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface.

◆ open()

bool alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::open ( )
overridevirtual
Deprecated:
The recommendation is to use use openOrCreate().

Open a database with the given filepath. If this object is already managing an open database, or the file does not exist, or there is a problem opening the database, this function returns false.

Returns
true If the database is opened ok, false if either the file does not exist, if this object is already managing an open database, or if there is another internal reason the database could not be opened.

Implements alexaClientSDK::acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface.

◆ openOrCreate()

bool alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::openOrCreate ( )
overridevirtual

Open the database with the given filepath or creates it if it does not exist.

Returns
true If the database is opened and usable. false if this object is already managing an open database, or if there is another internal reason the database is unusable.

Implements alexaClientSDK::acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface.

◆ setRefreshToken()

bool alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::setRefreshToken ( const std::string &  refreshToken)
overridevirtual

Set the stored refresh token value.

Parameters
refreshTokenThe refresh token to insert into the database.
Returns
Whether the refresh token was successfully stored.

Implements alexaClientSDK::acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface.

◆ setUserId()

bool alexaClientSDK::acsdkAuthorization::lwa::LWAAuthorizationStorage::setUserId ( const std::string &  userId)
overridevirtual

Stores the UserId associated with the account.

Parameters
userIdThe userId to store.

Implements alexaClientSDK::acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface.


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