150 System.out.println(" java " + KDC.class + " " + |
150 System.out.println(" java " + KDC.class + " " + |
151 "Start KDC on port 8888"); |
151 "Start KDC on port 8888"); |
152 return; |
152 return; |
153 } |
153 } |
154 } |
154 } |
|
155 String localhost = "localhost"; |
|
156 try { |
|
157 localhost = InetAddress.getByName(localhost) |
|
158 .getCanonicalHostName(); |
|
159 } catch (UnknownHostException uhe) { |
|
160 ; // Ignore, localhost is still "localhost" |
|
161 } |
155 KDC kdc = create("RABBIT.HOLE", 8888, false); |
162 KDC kdc = create("RABBIT.HOLE", 8888, false); |
156 kdc.addPrincipal("dummy", "bogus".toCharArray()); |
163 kdc.addPrincipal("dummy", "bogus".toCharArray()); |
157 kdc.addPrincipal("foo", "bar".toCharArray()); |
164 kdc.addPrincipal("foo", "bar".toCharArray()); |
158 kdc.addPrincipalRandKey("krbtgt/" + kdc.realm); |
165 kdc.addPrincipalRandKey("krbtgt/" + kdc.realm); |
159 kdc.addPrincipalRandKey("server/localhost"); |
166 kdc.addPrincipalRandKey("server/" + localhost); |
160 kdc.addPrincipalRandKey("backend/localhost"); |
167 kdc.addPrincipalRandKey("backend/" + localhost); |
161 } |
168 } |
162 |
169 |
163 /** |
170 /** |
164 * Creates and starts a KDC running as a daemon on a random port. |
171 * Creates and starts a KDC running as a daemon on a random port. |
165 * @param realm the realm name |
172 * @param realm the realm name |