Search in sources :

Example 16 with SimpleKdcServer

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.");
}
Also used : SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer)

Example 17 with SimpleKdcServer

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));
}
Also used : File(java.io.File) SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer) BeforeClass(org.junit.BeforeClass)

Example 18 with SimpleKdcServer

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));
}
Also used : StaxSTSServer(org.apache.cxf.systest.kerberos.wssec.sts.StaxSTSServer) StaxSTSServer(org.apache.cxf.systest.kerberos.wssec.sts.StaxSTSServer) SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer) STSServer(org.apache.cxf.systest.kerberos.wssec.sts.STSServer) StaxSTSServer(org.apache.cxf.systest.kerberos.wssec.sts.StaxSTSServer) STSServer(org.apache.cxf.systest.kerberos.wssec.sts.STSServer) File(java.io.File) SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer) BeforeClass(org.junit.BeforeClass)

Example 19 with SimpleKdcServer

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));
}
Also used : SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer) File(java.io.File) SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer) BeforeClass(org.junit.BeforeClass)

Example 20 with SimpleKdcServer

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();
}
Also used : NettyKdcServerImpl(org.apache.kerby.kerberos.kdc.impl.NettyKdcServerImpl) SimpleKdcServer(org.apache.kerby.kerberos.kerb.server.SimpleKdcServer)

Aggregations

SimpleKdcServer (org.apache.kerby.kerberos.kerb.server.SimpleKdcServer)25 File (java.io.File)22 BeforeClass (org.junit.BeforeClass)14 NettyKdcServerImpl (org.apache.kerby.kerberos.kdc.impl.NettyKdcServerImpl)6 KrbConfig (org.apache.kerby.kerberos.kerb.client.KrbConfig)3 IOException (java.io.IOException)2 URL (java.net.URL)2 SpnegoTestUtil (org.apache.calcite.avatica.SpnegoTestUtil)2 KrbException (org.apache.kerby.kerberos.kerb.KrbException)2 JwtTokenProvider (org.apache.kerby.kerberos.provider.token.JwtTokenProvider)2 Provider (java.security.Provider)1 STSServer (org.apache.cxf.systest.kerberos.wssec.sts.STSServer)1 StaxSTSServer (org.apache.cxf.systest.kerberos.wssec.sts.StaxSTSServer)1 KerbyGssProvider (org.apache.kerby.kerberos.kerb.gss.KerbyGssProvider)1