| 1 package net.sf.jguard.ext.authentication.loginmodules; 2 3 import java.util.ArrayList ; 4 import java.util.HashMap ; 5 import java.util.List ; 6 import java.util.Map ; 7 8 import javax.security.auth.Subject ; 9 import javax.security.auth.login.AppConfigurationEntry ; 10 11 import net.sf.jguard.core.authentication.configuration.JGuardConfiguration; 12 import net.sf.jguard.core.authentication.configuration.LocalLoginContext; 13 import net.sf.jguard.ext.SecurityConstants; 14 15 16 public class CRLLoginModuleTest extends CertificateBasedTestCase { 17 18 public void setUp()throws Exception { 19 super.setUp(); 20 } 21 22 public void testCRLAuthentication()throws Exception { 23 if (!"false".equals(System.getProperty(SKIP_CERTIFICATE_TESTS))) { 24 return; 25 } 26 setConfiguration(new JGuardConfiguration()); 27 28 Map entry1Options = new HashMap (); 29 entry1Options.put("debug", "true"); 30 entry1Options.put(SecurityConstants.OCSP_SERVER_URL, "http://127.0.0.1:8080/ejbca/publicweb/status/ocsp"); 31 entry1Options.put(SecurityConstants.ISSUER_CA_CERT_LOCATION, "/home/charles/worspace_eclipse_3.2/jguard-jee/src/test/resources/AdminCA1.der"); 32 entry1Options.put(SecurityConstants.OCSP_SIGNER_CERT_LOCATION, "/home/charles/worspace_eclipse_3.2/jguard-jee/src/test/resources/AdminCA1.der"); 34 AppConfigurationEntry entry1 = new AppConfigurationEntry (OCSPLoginModule.class.getName(),AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,entry1Options); 35 36 List appEntries = new ArrayList (); 37 appEntries.add(entry1); 38 Map entry2Options = new HashMap (); 39 entry2Options.put("debug", "true"); 40 AppConfigurationEntry entry2 = new AppConfigurationEntry (XmlLoginModule.class.getName(),AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,entry2Options); 41 appEntries.add(entry2); 42 configuration.addConfigEntriesForApplication(myApp, appEntries); 43 LocalLoginContext localLoginContext = new LocalLoginContext(myApp,cbh,configuration); 44 localLoginContext.login(); 45 Subject subject = localLoginContext.getSubject(); 46 System.out.println(subject); 47 } 48 } 49 | Popular Tags |