public interface ICredentialsProvider
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.
Modifier and Type | Method and Description |
---|---|
void |
confirmCredentials(AuthenticationScope authenticationScope,
Credentials credentials)
This method indicates that previously supplied credentials are accepted by the server.
|
Credentials |
getCredentials(AuthenticationScope authenticationScope)
Get the user credentials for the authentication request.
|
void |
removeCredentials(AuthenticationScope authenticationScope,
Credentials credentials)
This method indicates that previously supplied credentials are not accepted by the server.
|
@Nullable Credentials getCredentials(@NotNull AuthenticationScope authenticationScope)
authenticationScope
- the scope for the authentication request.null
.void confirmCredentials(@NotNull AuthenticationScope authenticationScope, @NotNull Credentials credentials)
The confirmation allows to cache the credentials.
authenticationScope
- the authentication scope.credentials
- the confirmed credentials, cannot be null
.void removeCredentials(@NotNull AuthenticationScope authenticationScope, @NotNull Credentials credentials)
The remove call indicates that cached values are invalid and that correct credentials have to be supplied on the next getCredentials
call.
authenticationScope
- the authentication scope.credentials
- the rejected credentials, cannot be null
.