public class KnoxSession extends Object implements Closeable
| Modifier and Type | Field and Description |
|---|---|
static String |
BEGIN_CERTIFICATE |
static String |
END_CERTIFICATE |
static String |
JGSS_LOGIN_MOUDLE |
| Modifier | Constructor and Description |
|---|---|
protected |
KnoxSession() |
|
KnoxSession(ClientContext clientContext) |
| Modifier and Type | Method and Description |
|---|---|
String |
base() |
void |
close() |
protected org.apache.http.impl.client.CloseableHttpClient |
createClient(ClientContext clientContext) |
protected void |
discoverTruststoreDetails(ClientContext clientContext) |
<T> Future<T> |
executeLater(Callable<T> callable) |
org.apache.http.client.methods.CloseableHttpResponse |
executeNow(org.apache.http.HttpRequest request) |
protected X509Certificate |
generateCertificateFromBytes(byte[] certBytes) |
Map<String,String> |
getHeaders() |
static KnoxSession |
kerberosLogin(String url)
Support kerberos authentication.
|
static KnoxSession |
kerberosLogin(String url,
boolean debug)
Support kerberos authentication.
|
static KnoxSession |
kerberosLogin(String url,
String jaasConf,
String krb5Conf,
boolean debug)
Support kerberos authentication.
|
static KnoxSession |
login(ClientContext context) |
static KnoxSession |
login(String url,
Map<String,String> headers) |
static KnoxSession |
login(String url,
Map<String,String> headers,
String truststoreLocation,
String truststorePass) |
static KnoxSession |
login(String url,
String username,
String password) |
static KnoxSession |
login(String url,
String username,
String password,
String truststoreLocation,
String truststorePass) |
static KnoxSession |
loginInsecure(String url,
String username,
String password) |
void |
setHeaders(Map<String,String> headers) |
void |
shutdown() |
boolean |
shutdown(long timeout,
TimeUnit unit) |
String |
toString() |
void |
waitFor(Future<?>... futures) |
void |
waitFor(long timeout,
TimeUnit units,
Future<?>... futures) |
public static final String JGSS_LOGIN_MOUDLE
public static final String END_CERTIFICATE
public static final String BEGIN_CERTIFICATE
protected KnoxSession()
throws KnoxShellException,
URISyntaxException
KnoxShellExceptionURISyntaxExceptionpublic KnoxSession(ClientContext clientContext) throws KnoxShellException, URISyntaxException
KnoxShellExceptionURISyntaxExceptionpublic static KnoxSession login(String url, Map<String,String> headers) throws URISyntaxException
URISyntaxExceptionpublic static KnoxSession login(String url, Map<String,String> headers, String truststoreLocation, String truststorePass) throws URISyntaxException
URISyntaxExceptionpublic static KnoxSession login(String url, String username, String password) throws URISyntaxException
URISyntaxExceptionpublic static KnoxSession login(String url, String username, String password, String truststoreLocation, String truststorePass) throws URISyntaxException
URISyntaxExceptionpublic static KnoxSession login(ClientContext context) throws URISyntaxException
URISyntaxExceptionpublic static KnoxSession kerberosLogin(String url, String jaasConf, String krb5Conf, boolean debug) throws URISyntaxException
url - Gateway urljaasConf - jaas configuration (optional- can be null)krb5Conf - kerberos configuration (optional - can be null)debug - enable debug messagesURISyntaxException - exception in case of malformed urlpublic static KnoxSession kerberosLogin(String url) throws URISyntaxException
url - Gateway urlURISyntaxException - exception in case of malformed urlpublic static KnoxSession kerberosLogin(String url, boolean debug) throws URISyntaxException
url - Gateway urldebug - enable debug messagesURISyntaxException - exception in case of malformed urlpublic static KnoxSession loginInsecure(String url, String username, String password) throws URISyntaxException
URISyntaxExceptionprotected org.apache.http.impl.client.CloseableHttpClient createClient(ClientContext clientContext) throws GeneralSecurityException
GeneralSecurityExceptionprotected X509Certificate generateCertificateFromBytes(byte[] certBytes) throws CertificateException
CertificateExceptionprotected void discoverTruststoreDetails(ClientContext clientContext)
public String base()
public org.apache.http.client.methods.CloseableHttpResponse executeNow(org.apache.http.HttpRequest request)
throws IOException
IOExceptionpublic void waitFor(Future<?>... futures) throws ExecutionException, InterruptedException
public void waitFor(long timeout,
TimeUnit units,
Future<?>... futures)
throws ExecutionException,
TimeoutException,
InterruptedException
public void shutdown()
throws InterruptedException,
IOException
InterruptedExceptionIOExceptionpublic boolean shutdown(long timeout,
TimeUnit unit)
throws InterruptedException,
IOException
InterruptedExceptionIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2019 The Apache Software Foundation. All rights reserved.