Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/javax/security/auth/login/JAASConfigSyntaxCheck/SampleLoginModule.java
51695 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
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
*
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.
22
*/
23
24
import static java.lang.System.out;
25
import java.util.Map;
26
import javax.security.auth.Subject;
27
import javax.security.auth.callback.CallbackHandler;
28
import javax.security.auth.login.LoginException;
29
import javax.security.auth.spi.LoginModule;
30
31
/**
32
* Login module which passes all the time
33
*/
34
35
public class SampleLoginModule implements LoginModule {
36
37
private final String name;
38
39
public SampleLoginModule() {
40
name = this.getClass().getName();
41
}
42
43
@Override
44
public void initialize(Subject subject, CallbackHandler callbackHandler,
45
Map<String, ?> sharedState, Map<String, ?> options) {
46
}
47
48
@Override
49
public boolean login() throws LoginException {
50
out.println(name + " Login method of AbstractLoginModule is called ");
51
out.println(name + ":login:PASS");
52
return true;
53
}
54
55
@Override
56
public boolean commit() throws LoginException {
57
out.println("Commit of AbstractLoginModule is called");
58
out.println(name + ":commit:PASS");
59
return true;
60
61
}
62
63
@Override
64
public boolean abort() throws LoginException {
65
out.println("Abourt is called in AbstractLoginModule");
66
out.println(name + ":abort:PASS");
67
return true;
68
}
69
70
@Override
71
public boolean logout() throws LoginException {
72
out.println("logout is called in AbstractLoginModule");
73
out.println(name + ":logout:PASS");
74
return true;
75
}
76
}
77
78