author | stefank |
Mon, 25 Aug 2014 09:10:13 +0200 | |
changeset 26314 | f8bc1966fb30 |
parent 23010 | 6dadb192ad81 |
child 30820 | 0d4717a011d3 |
permissions | -rw-r--r-- |
1454 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
15006
diff
changeset
|
2 |
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. |
1454 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5506 | 19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
1454 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @bug 6716534 |
|
15006 | 27 |
* @compile -XDignore.symbol.file CleanState.java |
8396
587947f96036
7018928: test failure: sun/security/krb5/auto/SSL.java
weijun
parents:
7977
diff
changeset
|
28 |
* @run main/othervm CleanState |
1454 | 29 |
* @summary Krb5LoginModule has not cleaned temp info between authentication attempts |
30 |
*/ |
|
31 |
import com.sun.security.auth.module.Krb5LoginModule; |
|
32 |
import java.util.HashMap; |
|
33 |
import java.util.Map; |
|
34 |
import javax.security.auth.Subject; |
|
35 |
import javax.security.auth.callback.Callback; |
|
36 |
import javax.security.auth.callback.CallbackHandler; |
|
37 |
import javax.security.auth.callback.NameCallback; |
|
38 |
import javax.security.auth.callback.PasswordCallback; |
|
39 |
||
40 |
public class CleanState { |
|
41 |
public static void main(String[] args) throws Exception { |
|
42 |
CleanState x = new CleanState(); |
|
43 |
new OneKDC(null); |
|
44 |
x.go(); |
|
45 |
} |
|
46 |
||
47 |
void go() throws Exception { |
|
48 |
Krb5LoginModule krb5 = new Krb5LoginModule(); |
|
49 |
||
50 |
final String name = OneKDC.USER; |
|
51 |
final char[] password = OneKDC.PASS; |
|
52 |
char[] badpassword = "hellokitty".toCharArray(); |
|
53 |
||
7977
f47f211cd627
7008713: diamond conversion of kerberos5 and security tools
smarks
parents:
5506
diff
changeset
|
54 |
Map<String,String> map = new HashMap<>(); |
1454 | 55 |
map.put("useTicketCache", "false"); |
56 |
map.put("doNotPrompt", "false"); |
|
57 |
map.put("tryFirstPass", "true"); |
|
7977
f47f211cd627
7008713: diamond conversion of kerberos5 and security tools
smarks
parents:
5506
diff
changeset
|
58 |
Map<String,Object> shared = new HashMap<>(); |
1454 | 59 |
shared.put("javax.security.auth.login.name", name); |
60 |
shared.put("javax.security.auth.login.password", badpassword); |
|
61 |
||
62 |
krb5.initialize(new Subject(), new CallbackHandler() { |
|
63 |
@Override |
|
64 |
public void handle(Callback[] callbacks) { |
|
65 |
for(Callback callback: callbacks) { |
|
66 |
if (callback instanceof NameCallback) { |
|
67 |
((NameCallback)callback).setName(name); |
|
68 |
} |
|
69 |
if (callback instanceof PasswordCallback) { |
|
70 |
((PasswordCallback)callback).setPassword(password); |
|
71 |
} |
|
72 |
} |
|
73 |
} |
|
74 |
}, shared, map); |
|
75 |
krb5.login(); |
|
76 |
} |
|
77 |
} |