public class UsernamePasswordCredentials extends Object implements Credentials
AuthenticationProvider that requires tokens, for example JWT, Oauth2, OpenId Connect| Modifier | 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, waitapplyHttpChallenge, applyHttpChallengeprotected 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
CredentialscheckValid in interface CredentialsV - the generic type of the argumentarg - optional argument or null.CredentialValidationException - when the validation failspublic JsonObject toJson()
CredentialstoJson in interface Credentialspublic UsernamePasswordCredentials applyHttpChallenge(String challenge, HttpMethod method, String uri, Integer nc, String cnonce) throws CredentialValidationException
CredentialsapplyHttpChallenge in interface Credentialschallenge - 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()
CredentialsCredentials.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 CredentialsCopyright © 2023 Eclipse. All rights reserved.