Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/security/auth/login/JAASConfigSyntaxCheck/SampleLoginModule.java
38859 views
/**1* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it under5* the terms of the GNU General Public License version 2 only, as published by6* the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT ANY9* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR10* A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more11* details (a copy is included in the LICENSE file that accompanied this code).12*13* You should have received a copy of the GNU General Public License version 214* along with this work; if not, write to the Free Software Foundation, Inc., 5115* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16*17* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or18* visit www.oracle.com if you need additional information or have any19* questions.20*/2122import static java.lang.System.out;23import java.util.Map;24import javax.security.auth.Subject;25import javax.security.auth.callback.CallbackHandler;26import javax.security.auth.login.LoginException;27import javax.security.auth.spi.LoginModule;2829/**30* Login module which passes all the time31*/3233public class SampleLoginModule implements LoginModule {3435private final String name;3637public SampleLoginModule() {38name = this.getClass().getName();39}4041@Override42public void initialize(Subject subject, CallbackHandler callbackHandler,43Map<String, ?> sharedState, Map<String, ?> options) {44}4546@Override47public boolean login() throws LoginException {48out.println(name + " Login method of AbstractLoginModule is called ");49out.println(name + ":login:PASS");50return true;51}5253@Override54public boolean commit() throws LoginException {55out.println("Commit of AbstractLoginModule is called");56out.println(name + ":commit:PASS");57return true;5859}6061@Override62public boolean abort() throws LoginException {63out.println("Abourt is called in AbstractLoginModule");64out.println(name + ":abort:PASS");65return true;66}6768@Override69public boolean logout() throws LoginException {70out.println("logout is called in AbstractLoginModule");71out.println(name + ":logout:PASS");72return true;73}74}757677