Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/SampleLoginModule.java
38859 views
1
/**
2
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
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 under
6
* the terms of the GNU General Public License version 2 only, as published by
7
* the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT ANY
10
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11
* A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
12
* details (a copy is included in the LICENSE file that accompanied this code).
13
*
14
* You should have received a copy of the GNU General Public License version 2
15
* along with this work; if not, write to the Free Software Foundation, Inc., 51
16
* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17
*
18
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or
19
* visit www.oracle.com if you need additional information or have any
20
* questions.
21
*/
22
23
import static java.lang.System.out;
24
import java.util.Map;
25
import javax.security.auth.Subject;
26
import javax.security.auth.callback.CallbackHandler;
27
import javax.security.auth.login.LoginException;
28
import javax.security.auth.spi.LoginModule;
29
30
/**
31
* Login module which passes all the time
32
*/
33
34
public class SampleLoginModule implements LoginModule {
35
36
private final String name;
37
38
public SampleLoginModule() {
39
name = this.getClass().getName();
40
}
41
42
@Override
43
public void initialize(Subject subject, CallbackHandler callbackHandler,
44
Map<String, ?> sharedState, Map<String, ?> options) {
45
}
46
47
@Override
48
public boolean login() throws LoginException {
49
out.println(name + " Login method of AbstractLoginModule is called ");
50
out.println(name + ":login:PASS");
51
return true;
52
}
53
54
@Override
55
public boolean commit() throws LoginException {
56
out.println("Commit of AbstractLoginModule is called");
57
out.println(name + ":commit:PASS");
58
return true;
59
60
}
61
62
@Override
63
public boolean abort() throws LoginException {
64
out.println("Abourt is called in AbstractLoginModule");
65
out.println(name + ":abort:PASS");
66
return true;
67
}
68
69
@Override
70
public boolean logout() throws LoginException {
71
out.println("logout is called in AbstractLoginModule");
72
out.println(name + ":logout:PASS");
73
return true;
74
}
75
}
76
77