public class MiniKdc extends Object
From within testcases:
MiniKdc sets 2 System properties when started and un-sets them when stopped:
MiniKdc default configuration values are:
| Modifier and Type | Field and Description |
|---|---|
static String |
DEBUG |
static String |
INSTANCE |
static String |
JAVA_SECURITY_KRB5_CONF |
static String |
KDC_BIND_ADDRESS |
static String |
KDC_PORT |
static String |
MAX_RENEWABLE_LIFETIME |
static String |
MAX_TICKET_LIFETIME |
static String |
ORG_DOMAIN |
static String |
ORG_NAME |
static String |
SUN_SECURITY_KRB5_DEBUG |
static String |
TRANSPORT |
| Constructor and Description |
|---|
MiniKdc(Properties conf,
File workDir)
Creates a MiniKdc.
|
| Modifier and Type | Method and Description |
|---|---|
static Properties |
createConf()
Convenience method that returns MiniKdc default configuration.
|
void |
createPrincipal(File keytabFile,
String... principals)
Creates multiple principals in the KDC and adds them to a keytab file.
|
void |
createPrincipal(String principal,
String password)
Creates a principal in the KDC with the specified user and password.
|
String |
getHost()
Returns the host of the MiniKdc.
|
File |
getKrb5conf() |
int |
getPort()
Returns the port of the MiniKdc.
|
String |
getRealm()
Returns the realm of the MiniKdc.
|
static void |
main(String[] args) |
void |
start()
Starts the MiniKdc.
|
void |
stop()
Stops the MiniKdc
|
public static final String JAVA_SECURITY_KRB5_CONF
public static final String SUN_SECURITY_KRB5_DEBUG
public static final String ORG_NAME
public static final String ORG_DOMAIN
public static final String KDC_BIND_ADDRESS
public static final String KDC_PORT
public static final String INSTANCE
public static final String MAX_TICKET_LIFETIME
public static final String MAX_RENEWABLE_LIFETIME
public static final String TRANSPORT
public static final String DEBUG
public MiniKdc(Properties conf, File workDir) throws Exception
conf - MiniKdc configuration.workDir - working directory, it should be the build directory. Under
this directory an ApacheDS working directory will be created, this
directory will be deleted when the MiniKdc stops.Exception - thrown if the MiniKdc could not be created.public static Properties createConf()
The returned configuration is a copy, it can be customized before using it to create a MiniKdc.
public int getPort()
public String getHost()
public String getRealm()
public File getKrb5conf()
public void start()
throws Exception
Exception - thrown if the MiniKdc could not be started.public void stop()
public void createPrincipal(String principal, String password) throws Exception
principal - principal name, do not include the domain.password - password.Exception - thrown if the principal could not be created.public void createPrincipal(File keytabFile, String... principals) throws Exception
keytabFile - keytab file to add the created principal.sprincipals - principals to add to the KDC, do not include the domain.Exception - thrown if the principals or the keytab file could not be
created.Copyright © 2018 CERN. All Rights Reserved.