1 19 20 package com.sslexplorer.core; 21 22 import java.util.ArrayList ; 23 import java.util.List ; 24 import java.util.TreeMap ; 25 26 import javax.security.auth.login.AppConfigurationEntry ; 27 import javax.security.auth.login.Configuration ; 28 29 import org.apache.commons.logging.Log; 30 import org.apache.commons.logging.LogFactory; 31 32 39 public class CoreJAASConfiguration extends Configuration { 40 41 TreeMap entries; 42 final static Log log = LogFactory.getLog(CoreJAASConfiguration.class); 43 44 47 public CoreJAASConfiguration() { 48 super(); 49 entries = new TreeMap (); 50 Configuration.setConfiguration(this); 51 } 52 53 59 public void addAppConfigurationEntry(String name, AppConfigurationEntry entry) { 60 if (log.isInfoEnabled()) 61 log.info("Adding new entry for '" + name + "' [" + entry.getLoginModuleName() + "' to JAAS configuration "); 62 List l = (List )entries.get(name); 63 if(l == null) { 64 l = new ArrayList (); 65 entries.put(name, l); 66 } 67 l.add(entry); 68 } 69 70 73 public AppConfigurationEntry [] getAppConfigurationEntry(String name) { 74 List en = (List )entries.get(name); 75 if(en == null || en.size() == 0) { 76 return null; 77 } 78 else { 79 AppConfigurationEntry [] ena = new AppConfigurationEntry [en.size()]; 80 en.toArray(ena); 81 return ena; 82 } 83 } 84 85 88 public void refresh() { 89 if (log.isInfoEnabled()) 90 log.info("Refreshing JAAS configuration"); 91 } 92 93 } 94 | Popular Tags |