Package org.apache.accumulo.harness
Class TestingKdc
- java.lang.Object
-
- org.apache.accumulo.harness.TestingKdc
-
public class TestingKdc extends Object
Creates aMiniKdc
for tests to use to exercise secure Accumulo
-
-
Field Summary
Fields Modifier and Type Field Description protected ClusterUser
accumuloAdmin
protected ClusterUser
accumuloServerUser
protected List<ClusterUser>
clientPrincipals
protected org.apache.hadoop.minikdc.MiniKdc
kdc
static long
MAX_TICKET_LIFETIME_MILLIS
static int
NUM_USERS
String
ORG_DOMAIN
String
ORG_NAME
-
Constructor Summary
Constructors Constructor Description TestingKdc()
TestingKdc(File kdcDir, File keytabDir)
TestingKdc(File kdcDir, File keytabDir, long maxTicketLifetime)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static File
computeKdcDir()
static File
computeKeytabDir()
void
createPrincipal(File keytabFile, String... principals)
ClusterUser
getAccumuloServerUser()
AClusterUser
for Accumulo server processes to useClusterUser
getClientPrincipal(int offset)
TheClusterUser
corresponding to the given offset.File
getKeytabDir()
A directory where the automatically-created keytab files are writtenString
getOrgDomain()
String
getOrgName()
ClusterUser
getRootUser()
AClusterUser
which is the Accumulo "root" userString
qualifyUser(String primary)
Qualify a username (only the primary from the kerberos principal) with the proper realmvoid
start()
Starts the KDC and creates the principals and their keytabsvoid
stop()
-
-
-
Field Detail
-
NUM_USERS
public static final int NUM_USERS
- See Also:
- Constant Field Values
-
MAX_TICKET_LIFETIME_MILLIS
public static final long MAX_TICKET_LIFETIME_MILLIS
- See Also:
- Constant Field Values
-
kdc
protected org.apache.hadoop.minikdc.MiniKdc kdc
-
accumuloServerUser
protected ClusterUser accumuloServerUser
-
accumuloAdmin
protected ClusterUser accumuloAdmin
-
clientPrincipals
protected List<ClusterUser> clientPrincipals
-
ORG_NAME
public final String ORG_NAME
- See Also:
- Constant Field Values
-
ORG_DOMAIN
public final String ORG_DOMAIN
- See Also:
- Constant Field Values
-
-
Method Detail
-
computeKdcDir
public static File computeKdcDir()
-
computeKeytabDir
public static File computeKeytabDir()
-
start
public void start() throws Exception
Starts the KDC and creates the principals and their keytabs- Throws:
Exception
-
stop
public void stop()
-
getKeytabDir
public File getKeytabDir()
A directory where the automatically-created keytab files are written
-
getAccumuloServerUser
public ClusterUser getAccumuloServerUser()
AClusterUser
for Accumulo server processes to use
-
getRootUser
public ClusterUser getRootUser()
AClusterUser
which is the Accumulo "root" user
-
getClientPrincipal
public ClusterUser getClientPrincipal(int offset)
TheClusterUser
corresponding to the given offset. Represents an unprivileged user.- Parameters:
offset
- The offset to fetch credentials for, valid throughNUM_USERS
-
createPrincipal
public void createPrincipal(File keytabFile, String... principals) throws Exception
- Throws:
Exception
- See Also:
MiniKdc.createPrincipal(File, String...)
-
getOrgName
public String getOrgName()
- Returns:
- the name for the realm
-
getOrgDomain
public String getOrgDomain()
- Returns:
- the domain for the realm
-
-