use of org.apache.kerby.kerberos.kerb.server.SimpleKdcServer in project zookeeper by apache.
the class MiniKdc method start.
/**
* Starts the MiniKdc.
*
* @throws Exception thrown if the MiniKdc could not be started.
*/
public synchronized void start() throws Exception {
if (simpleKdc != null) {
throw new RuntimeException("Already started");
}
simpleKdc = new SimpleKdcServer();
prepareKdcServer();
simpleKdc.init();
resetDefaultRealm();
simpleKdc.start();
LOG.info("MiniKdc stated.");
}
use of org.apache.kerby.kerberos.kerb.server.SimpleKdcServer in project cxf by apache.
the class JAXRSKerberosBookTest method startServers.
@BeforeClass
public static void startServers() throws Exception {
//
if (!"IBM Corporation".equals(System.getProperty("java.vendor"))) {
runTests = true;
}
String basedir = System.getProperty("basedir");
if (basedir == null) {
basedir = new File(".").getCanonicalPath();
}
// System.setProperty("sun.security.krb5.debug", "true");
System.setProperty("java.security.auth.login.config", basedir + "/target/test-classes/kerberos.jaas");
System.setProperty("java.security.krb5.conf", basedir + "/target/krb5.conf");
kerbyServer = new SimpleKdcServer();
kerbyServer.setKdcRealm("service.ws.apache.org");
kerbyServer.setAllowUdp(false);
kerbyServer.setWorkDir(new File(basedir + "/target"));
// kerbyServer.setInnerKdcImpl(new NettyKdcServerImpl(kerbyServer.getKdcSetting()));
kerbyServer.init();
// Create principals
String alice = "alice@service.ws.apache.org";
String bob = "bob/service.ws.apache.org@service.ws.apache.org";
kerbyServer.createPrincipal(alice, "alice");
kerbyServer.createPrincipal(bob, "bob");
kerbyServer.start();
// Launch servers
org.junit.Assert.assertTrue("Server failed to launch", // set this to false to fork
AbstractClientServerTestBase.launchServer(BookKerberosServer.class, true));
}
use of org.apache.kerby.kerberos.kerb.server.SimpleKdcServer in project cxf by apache.
the class KerberosTokenTest method startServers.
@BeforeClass
public static void startServers() throws Exception {
WSSConfig.init();
//
if (!"IBM Corporation".equals(System.getProperty("java.vendor"))) {
runTests = true;
}
String basedir = System.getProperty("basedir");
if (basedir == null) {
basedir = new File(".").getCanonicalPath();
}
// System.setProperty("sun.security.krb5.debug", "true");
System.setProperty("java.security.auth.login.config", basedir + "/target/test-classes/kerberos.jaas");
System.setProperty("java.security.krb5.conf", basedir + "/target/krb5.conf");
kerbyServer = new SimpleKdcServer();
kerbyServer.setKdcRealm("service.ws.apache.org");
kerbyServer.setAllowUdp(false);
kerbyServer.setWorkDir(new File(basedir + "/target"));
// kerbyServer.setInnerKdcImpl(new NettyKdcServerImpl(kerbyServer.getKdcSetting()));
kerbyServer.init();
// Create principals
String alice = "alice@service.ws.apache.org";
String bob = "bob/service.ws.apache.org@service.ws.apache.org";
kerbyServer.createPrincipal(alice, "alice");
kerbyServer.createPrincipal(bob, "bob");
kerbyServer.start();
// Launch servers
org.junit.Assert.assertTrue("Server failed to launch", // set this to false to fork
AbstractClientServerTestBase.launchServer(Server.class, true));
org.junit.Assert.assertTrue("Server failed to launch", // set this to false to fork
AbstractClientServerTestBase.launchServer(StaxServer.class, true));
org.junit.Assert.assertTrue("Server failed to launch", // set this to false to fork
AbstractClientServerTestBase.launchServer(STSServer.class, true));
org.junit.Assert.assertTrue("Server failed to launch", // set this to false to fork
AbstractClientServerTestBase.launchServer(StaxSTSServer.class, true));
}
use of org.apache.kerby.kerberos.kerb.server.SimpleKdcServer in project cxf by apache.
the class SpnegoTokenTest method startServers.
@BeforeClass
public static void startServers() throws Exception {
WSSConfig.init();
//
if (!"IBM Corporation".equals(System.getProperty("java.vendor"))) {
runTests = true;
}
String basedir = System.getProperty("basedir");
if (basedir == null) {
basedir = new File(".").getCanonicalPath();
}
// System.setProperty("sun.security.krb5.debug", "true");
System.setProperty("java.security.auth.login.config", basedir + "/target/test-classes/kerberos.jaas");
System.setProperty("java.security.krb5.conf", basedir + "/target/krb5.conf");
kerbyServer = new SimpleKdcServer();
kerbyServer.setKdcRealm("service.ws.apache.org");
kerbyServer.setAllowUdp(false);
kerbyServer.setWorkDir(new File(basedir + "/target"));
// kerbyServer.setInnerKdcImpl(new NettyKdcServerImpl(kerbyServer.getKdcSetting()));
kerbyServer.init();
// Create principals
String alice = "alice@service.ws.apache.org";
String bob = "bob/service.ws.apache.org@service.ws.apache.org";
kerbyServer.createPrincipal(alice, "alice");
kerbyServer.createPrincipal(bob, "bob");
kerbyServer.start();
// Launch servers
org.junit.Assert.assertTrue("Server failed to launch", // set this to false to fork
AbstractClientServerTestBase.launchServer(Server.class, true));
org.junit.Assert.assertTrue("Server failed to launch", // set this to false to fork
AbstractClientServerTestBase.launchServer(StaxServer.class, true));
}
use of org.apache.kerby.kerberos.kerb.server.SimpleKdcServer in project pac4j by pac4j.
the class KerberosClientsKerbyTests method setupKerbyServer.
private static void setupKerbyServer() throws KrbException, IOException {
kerbyServer = new SimpleKdcServer();
kerbyServer.setKdcHost("localhost");
kerbyServer.setKdcRealm("MYREALM.LT");
kerbyServer.setAllowUdp(true);
// kerbyServer.setWorkDir(new File(basedir + "/target"));
kerbyServer.setInnerKdcImpl(new NettyKdcServerImpl(kerbyServer.getKdcSetting()));
kerbyServer.init();
// Create principals
kerbyServer.createPrincipal(clientPrincipal, clientPassword);
kerbyServer.createPrincipal(servicePrincipal, "servicePrincipal");
kerbyServer.getKadmin().exportKeytab(serviceKeytabFile, servicePrincipal);
// System.out.println(new String(Files.readAllBytes(serviceKeytabFile.toPath())));
kerbyServer.start();
}
Aggregations