public class JobSecurityUtil extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CREDENTIALS_FILE_LOCATION
Location of the (optional) credentials file; if set,
the credentials file is used to pass the credentials
rather than the JobContext.
|
static String |
USE_SECURE_CREDENTIALS
Property in the job configuration that controls whether
secure credentials will be used.
|
Constructor and Description |
---|
JobSecurityUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
cleanupCredentials(SolrClient server,
org.apache.hadoop.conf.Configuration conf,
String serviceName)
Cleanup job credentials; call at the end of the job so that credentials
can't be used outside of the lifetime of the job.
|
static void |
cleanupCredentials(SolrClient server,
org.apache.hadoop.mapreduce.JobContext job,
String serviceName)
Cleanup job credentials; call at the end of the job so that credentials
can't be used outside of the lifetime of the job.
|
static void |
initCredentials(File tokenFile,
org.apache.hadoop.conf.Configuration conf,
String serviceName)
Init job credentials from a file.
|
static void |
initCredentials(SolrClient server,
org.apache.hadoop.mapreduce.JobContext job,
String serviceName)
Init job credentials for when the tasks need to communicate with
secure solr directly.
|
static void |
loadCredentialsForClients(org.apache.hadoop.conf.Configuration conf,
String serviceName)
Load job credentials for Solr clients running in this process.
|
static void |
loadCredentialsForClients(org.apache.hadoop.mapreduce.JobContext job,
String serviceName)
Load job credentials for Solr clients running in this process.
|
public static final String USE_SECURE_CREDENTIALS
initCredentials(org.apache.solr.client.solrj.SolrClient, org.apache.hadoop.mapreduce.JobContext, java.lang.String)
if a JAAS configuration is configured
(via System property java.security.auth.login.config).public static final String CREDENTIALS_FILE_LOCATION
public static void initCredentials(SolrClient server, org.apache.hadoop.mapreduce.JobContext job, String serviceName) throws SolrServerException, IOException
server
- SolrServer to get credentials fromjob
- JobContext to store the credentialsserviceName
- service name for which the credentials are valid. Should be a
unique identifier for the solr cluster, i.e. the zkHost.SolrServerException
IOException
public static void initCredentials(File tokenFile, org.apache.hadoop.conf.Configuration conf, String serviceName) throws IOException
tokenFile
- file storing the tokens. File should be the output of a curl
call to get the token, e.g.
"curl --negotiate -u: 'http://host:port/solr/?op=GETDELEGATIONTOKEN'"conf
- configuration passed to MR/Spark job.serviceName
- service name for which the credentials are valid. Should be a
unique identifier for the solr cluster, i.e. the zkHost.IOException
public static void loadCredentialsForClients(org.apache.hadoop.mapreduce.JobContext job, String serviceName) throws IOException
job
- JobContext to load the credentials fromserviceName
- should be the same as passed to initCredentials(org.apache.solr.client.solrj.SolrClient, org.apache.hadoop.mapreduce.JobContext, java.lang.String)
IOException
public static void loadCredentialsForClients(org.apache.hadoop.conf.Configuration conf, String serviceName) throws IOException
conf
- Configuration that stores the CREDENTIALS_FILE_LOCATION, probably
passed to initCredentials(File, Configuration, String)
serviceName
- should be the same as passed to initCredentials(org.apache.solr.client.solrj.SolrClient, org.apache.hadoop.mapreduce.JobContext, java.lang.String)
IOException
public static void cleanupCredentials(SolrClient server, org.apache.hadoop.mapreduce.JobContext job, String serviceName) throws SolrServerException, IOException
server
- SolrServer to cleanup the credentials onjob
- JobContext to load the credentials fromserviceName
- should be the same as passed to initCredentials(org.apache.solr.client.solrj.SolrClient, org.apache.hadoop.mapreduce.JobContext, java.lang.String)
SolrServerException
IOException
public static void cleanupCredentials(SolrClient server, org.apache.hadoop.conf.Configuration conf, String serviceName) throws SolrServerException, IOException
server
- SolrServer to cleanup the credentials onconf
- Configuration that stores the CREDENTIALS_FILE_LOCATION, probably
passed to initCredentials(File, Configuration, String)
serviceName
- should be the same as passed to initCredentials(org.apache.solr.client.solrj.SolrClient, org.apache.hadoop.mapreduce.JobContext, java.lang.String)
SolrServerException
IOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.