-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathServer.java
More file actions
99 lines (78 loc) · 2.54 KB
/
Server.java
File metadata and controls
99 lines (78 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package krbserver;
import java.io.File;
import java.security.PrivilegedActionException;
import java.util.Scanner;
import javax.security.auth.login.LoginException;
import org.infinispan.arquillian.core.InfinispanResource;
import org.infinispan.arquillian.core.RemoteInfinispanServer;
import org.infinispan.server.test.client.hotrod.security.HotRodSaslAuthTestBase;
import org.infinispan.test.integration.security.utils.ApacheDsKrbLdap;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
interface Killable extends Remote {
void kill() throws RemoteException;
}
public class Server extends HotRodSaslAuthTestBase implements Killable {
private static final String KRB_REALM = "INFINISPAN.ORG";
private static final int rmiPort = 51099;
private static ApacheDsKrbLdap krbLdapServer;
@InfinispanResource("hotrodAuthKrb")
RemoteInfinispanServer server;
public static void main(String[] args) {
if (args.length < 1 || !args[0].equals("stop")) {
try {
LocateRegistry.createRegistry(rmiPort);
Server obj = new Server();
Killable stub = (Killable) UnicastRemoteObject.exportObject(obj, 0);
// Bind the remote object's stub in the registry
Registry registry = LocateRegistry.getRegistry(rmiPort);
registry.bind("krbServer", stub);
krbLdapServer = new ApacheDsKrbLdap("localhost");
krbLdapServer.start();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
try {
Registry registry = LocateRegistry.getRegistry(rmiPort);
Killable stub = (Killable) registry.lookup("krbServer");
stub.kill();
} catch (Exception e) {
}
}
}
@Override
public RemoteInfinispanServer getRemoteServer() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getTestedMech() {
// TODO Auto-generated method stub
return null;
}
@Override
public void initAsAdmin() throws PrivilegedActionException, LoginException {
// TODO Auto-generated method stub
}
@Override
public void initAsReader() throws PrivilegedActionException, LoginException {
// TODO Auto-generated method stub
}
@Override
public void initAsSupervisor() throws PrivilegedActionException, LoginException {
// TODO Auto-generated method stub
}
@Override
public void initAsWriter() throws PrivilegedActionException, LoginException {
// TODO Auto-generated method stub
}
@Override
public void kill() throws RemoteException {
System.exit(0);
}
}