LuciadCPillar 2023.1.04
luciad::ICredentialsProvider Class Referenceabstract

This interface provides methods to retrieve a user and password for sites requesting authentication. More...

#include <luciad/loaders/ICredentialsProvider.h>

Public Member Functions

virtual ~ICredentialsProvider ()=default
 
virtual void confirmCredentials (const AuthenticationScope &authenticationScope, const std::shared_ptr< Credentials > &credentials)=0
 This method indicates that previously supplied credentials are accepted by the server. More...
 
virtual std::shared_ptr< CredentialsgetCredentials (const AuthenticationScope &authenticationScope)=0
 Get the user credentials for the authentication request. More...
 
virtual void removeCredentials (const AuthenticationScope &authenticationScope, const std::shared_ptr< Credentials > &credentials)=0
 This method indicates that previously supplied credentials are not accepted by the server. More...
 

Detailed Description

This interface provides methods to retrieve a user and password for sites requesting authentication.

Implementations of this interface must be thread-safe.

This interface allows writing a credentials provider that caches valid user credentials such that a user doesn't have to supply them on every http(s) request.

The main method to implement is the getCredentials method. When no user credentials are available a typical implementation shows a login dialog to the user to enter the information. The implementation can cache those credentials for the authentication scope.

The methods confirmCredentials and removeCredentials allow to manage cached credentials. They provide information on whether the supplied credentials were accepted or rejected by the server.

See also the related guide on How to provide authentication credentials.

Since
2022.0

Constructor & Destructor Documentation

◆ ~ICredentialsProvider()

virtual luciad::ICredentialsProvider::~ICredentialsProvider ( )
virtualdefault

Member Function Documentation

◆ confirmCredentials()

virtual void luciad::ICredentialsProvider::confirmCredentials ( const AuthenticationScope authenticationScope,
const std::shared_ptr< Credentials > &  credentials 
)
pure virtual

This method indicates that previously supplied credentials are accepted by the server.

The confirmation allows to cache the credentials.

Parameters
authenticationScopethe authentication scope.
credentialsthe confirmed credentials, cannot be nullptr.

◆ getCredentials()

virtual std::shared_ptr< Credentials > luciad::ICredentialsProvider::getCredentials ( const AuthenticationScope authenticationScope)
pure virtual

Get the user credentials for the authentication request.

Parameters
authenticationScopethe scope for the authentication request.
Returns
the user credentials for the authentication scope. Can be nullptr.

◆ removeCredentials()

virtual void luciad::ICredentialsProvider::removeCredentials ( const AuthenticationScope authenticationScope,
const std::shared_ptr< Credentials > &  credentials 
)
pure virtual

This method indicates that previously supplied credentials are not accepted by the server.

The remove call indicates that cached values are invalid and that correct credentials have to be supplied on the next getCredentials call.

Parameters
authenticationScopethe authentication scope.
credentialsthe rejected credentials, cannot be nullptr.