1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.ldap.client.api; 21 22 23 import java.util.HashMap; 24 25 import javax.security.auth.login.AppConfigurationEntry; 26 import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag; 27 import javax.security.auth.login.Configuration; 28 29 30 /** 31 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 32 */ 33 public class Krb5LoginConfiguration extends Configuration 34 { 35 36 /** The list with configuration entries. */ 37 private static AppConfigurationEntry[] configList = new AppConfigurationEntry[1]; 38 39 40 /** 41 * Creates a new instance of Krb5LoginConfiguration. 42 */ 43 public Krb5LoginConfiguration() 44 { 45 String loginModule = "com.sun.security.auth.module.Krb5LoginModule"; 46 47 HashMap<String, Object> options = new HashMap<>(); 48 49 // TODO: this only works for Sun JVM 50 options.put( "refreshKrb5Config", "true" ); 51 52 LoginModuleControlFlag flag = LoginModuleControlFlag.REQUIRED; 53 configList[0] = new AppConfigurationEntry( loginModule, flag, options ); 54 } 55 56 57 /** 58 * Interface method requiring us to return all the LoginModules we know about. 59 * 60 * @param applicationName the application name 61 * @return the configuration entry 62 */ 63 @Override 64 public AppConfigurationEntry[] getAppConfigurationEntry( String applicationName ) 65 { 66 // We will ignore the applicationName, since we want all apps to use Kerberos V5 67 return configList; 68 } 69 70 71 /** 72 * Interface method for reloading the configuration. We don't need this. 73 */ 74 @Override 75 public void refresh() 76 { 77 // Right now this is a load once scheme and we will not implement the refresh method 78 } 79 }