public abstract class CertificateAuthentication extends HTTPAuthentication
Supports certificates in pk12 or pem format. This method has a Keystone authentication method as fallback.
Example:
HTTPAuthentication auth = new CertificateAuthentication("/path/to/certificate.pem", "password");
auth.setCAPath("/etc/grid-security/certificates/"); //path to CA directory
Client client = new HTTPClient(URI.create("https://remote.server.net"), auth);
Constructor and Description |
---|
CertificateAuthentication() |
Modifier and Type | Method and Description |
---|---|
void |
authenticate()
Runs the authentication.
|
protected SSLContext |
createSSLContext()
Creates a ssl context with custom CAs if set.
|
String |
getCertificate()
Returns user's certificate.
|
String |
getPassword()
Returns user's password.
|
void |
setCertificate(String certificate)
Sets user's certificate.
|
void |
setPassword(String password)
Sets user's password.
|
getCAFile, getCAPath, getConnection, getCredentialsProvider, getFallback, getIdentifier, getTarget, loadCAs, setCAFile, setCAPath, setConnection, setCredentialsProvider, setTarget
public String getCertificate()
public void setCertificate(String certificate)
certificate
- user's certificate, cannot be null nor emptypublic String getPassword()
public void setPassword(String password)
password
- user's password, cannot be nullprotected SSLContext createSSLContext() throws AuthenticationException
HTTPAuthentication
createSSLContext
in class HTTPAuthentication
AuthenticationException
public void authenticate() throws CommunicationException
Authentication
authenticate
in interface Authentication
authenticate
in class HTTPAuthentication
CommunicationException
- when error occures during the
communicationCopyright © 2016. All Rights Reserved.