@AfterClass public static void tearDown() throws KrbException { if (kerbyServer != null) { kerbyServer.stop(); } }
@BeforeClass public static void setUp() throws Exception { WSSConfig.init(); String basedir = System.getProperty("basedir"); if (basedir == null) { basedir = new File(".").getCanonicalPath(); } updatePort(basedir); // System.setProperty("sun.security.krb5.debug", "true"); System.setProperty( "java.security.auth.login.config", basedir + "/src/test/resources/kerberos/kerberos.jaas"); Assert.assertTrue( "Server failed to launch", // run the server in the same process // set this to false to fork AbstractBusClientServerTestBase.launchServer(Server.class, true)); kerbyServer = new KerbyServer(); kerbyServer.setKdcHost("localhost"); kerbyServer.setKdcRealm("service.ws.apache.org"); kerbyServer.setKdcTcpPort(Integer.parseInt(KDC_PORT)); kerbyServer.setAllowUdp(true); kerbyServer.setKdcUdpPort(Integer.parseInt(KDC_UDP_PORT)); kerbyServer.setInnerKdcImpl(new NettyKdcServerImpl(kerbyServer.getKdcSetting())); kerbyServer.init(); // Create principals String alice = "*****@*****.**"; String bob = "bob/[email protected]"; kerbyServer.createPrincipal(alice, "alice"); kerbyServer.createPrincipal(bob, "bob"); kerbyServer.createPrincipal("krbtgt/[email protected]", "krbtgt"); kerbyServer.start(); }