Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/javax/security/auth/login/LoginContext/MyConfiguration.java
38861 views
/*1* Copyright (c) 2004, 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 it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223import java.util.HashMap;24import javax.security.auth.login.AppConfigurationEntry;25import static javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag.OPTIONAL;26import static javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag.REQUIRED;27import static javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag.SUFFICIENT;28import javax.security.auth.login.Configuration;2930/**31* This class is used to test LoginContext constructor API. It simply contains32* one configuration entry: PT.33*/34public class MyConfiguration extends Configuration {3536private static final AppConfigurationEntry[] ptAE37= new AppConfigurationEntry[2];38private static final HashMap<String, String> map = new HashMap<>();39private boolean optionOrder = false;4041public MyConfiguration() {42setupConfiguration();43}4445public MyConfiguration(boolean optionOrder) {46this.optionOrder = optionOrder;47setupConfiguration();48}4950private void setupConfiguration() {51ptAE[0] = new AppConfigurationEntry("SmartLoginModule",52optionOrder ? OPTIONAL : REQUIRED,53map);54ptAE[1] = new AppConfigurationEntry("DummyLoginModule",55optionOrder ? SUFFICIENT : REQUIRED,56map);57}5859@Override60public AppConfigurationEntry[]61getAppConfigurationEntry(String applicationName) {62if (applicationName.equals("PT")) {63return ptAE;64} else {65return null;66}67}6869}707172