public class UsernamePasswordCredentials extends Object implements Credentials
AuthenticationProvider
that requires tokens, for example JWT, Oauth2, OpenId ConnectModifier | Constructor and Description |
---|---|
protected |
UsernamePasswordCredentials() |
|
UsernamePasswordCredentials(JsonObject jsonObject) |
|
UsernamePasswordCredentials(String username,
String password) |
Modifier and Type | Method and Description |
---|---|
UsernamePasswordCredentials |
applyHttpChallenge(String challenge,
HttpMethod method,
String uri,
Integer nc,
String cnonce)
Applies the HTTP Authorization challenge to this Credential instance.
|
<V> void |
checkValid(V arg)
Implementors should override this method to perform validation.
|
String |
getPassword() |
String |
getUsername() |
UsernamePasswordCredentials |
setPassword(String password) |
UsernamePasswordCredentials |
setUsername(String username) |
String |
toHttpAuthorization()
Encodes this credential as an HTTP Authorization https://tools.ietf.org/html/rfc7235.
|
JsonObject |
toJson()
Simple interop to downcast back to JSON for backwards compatibility.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
applyHttpChallenge, applyHttpChallenge
protected UsernamePasswordCredentials()
public UsernamePasswordCredentials(JsonObject jsonObject)
public String getPassword()
public String getUsername()
public UsernamePasswordCredentials setPassword(String password)
public UsernamePasswordCredentials setUsername(String username)
public <V> void checkValid(V arg) throws CredentialValidationException
Credentials
checkValid
in interface Credentials
V
- the generic type of the argumentarg
- optional argument or null.CredentialValidationException
- when the validation failspublic JsonObject toJson()
Credentials
toJson
in interface Credentials
public UsernamePasswordCredentials applyHttpChallenge(String challenge, HttpMethod method, String uri, Integer nc, String cnonce) throws CredentialValidationException
Credentials
applyHttpChallenge
in interface Credentials
challenge
- the challenge is the WWW-Authenticate
header response from a 401 request.
Null challenges are allowed, and in this case, no verification will be performed, however it is
up to the implementation to permit this.method
- The http method this response is responding.uri
- The http uri this response is responding.nc
- The client internal counter (optional).cnonce
- The client internal nonce (optional).CredentialValidationException
- if the challenge cannot be applicable.public String toHttpAuthorization()
Credentials
Credentials.applyHttpChallenge(String, HttpMethod, String, Integer, String)
has
been prior executed. For some Authentication schemes, this isn't a requirement but doing so ensures that the
object is on the right state.toHttpAuthorization
in interface Credentials
Copyright © 2022 Eclipse. All rights reserved.