[jboss-svn-commits] JBL Code SVN: r21178 - labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Jul 22 15:35:28 EDT 2008


Author: beve
Date: 2008-07-22 15:35:27 -0400 (Tue, 22 Jul 2008)
New Revision: 21178

Modified:
   labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/JaasSecurityService.java
Log:
Added Configuration to the service.


Modified: labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/JaasSecurityService.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/JaasSecurityService.java	2008-07-22 18:01:58 UTC (rev 21177)
+++ labs/jbossesb/workspace/dbevenius/security/product/rosetta/src/org/jboss/soa/esb/services/security/JaasSecurityService.java	2008-07-22 19:35:27 UTC (rev 21178)
@@ -47,6 +47,8 @@
 	
 	private Logger log = Logger.getLogger(JaasSecurityService.class);
 	
+	private javax.security.auth.login.Configuration configuration;
+	
 	/**
 	 * Authenticates a Subject using the information contained in the passed in 
 	 * Security context
@@ -56,33 +58,28 @@
 	 */
 	public void authenticate( final SecurityContext context) throws LoginException
 	{
-		LoginContext loginContext = new LoginContext(context.getConfigInfo().getModuleName(), context.getSubject(), null, new ConfigFile());
+		LoginContext loginContext = new LoginContext(context.getConfigInfo().getModuleName(), context.getSubject(), null, configuration);
 		loginContext.login();
 	}
 	
 	public void configure() throws ConfigurationException
 	{
 		String loginConfigUrl = Configuration.getSecurityServiceConfigUrl();
-		if ( loginConfigUrl == null )
+		if ( loginConfigUrl != null )
 		{
-        	final String missingPropertyMsg = 
-    		"A config url was missing from the properties file. Please make sure" +
-        	" that the configuration has a [" + Environment.SECURITY_SERVICE_CONFIG_URL +
-        	"] property defined. This property should point to a file on the local file system or on the classpath.";
-			throw new ConfigurationException(missingPropertyMsg);
-		}
 		
-		URL loginUrl = ClassUtil.getResource(loginConfigUrl, getClass());
-		log.info("LoginUrl : " + loginUrl);
-		if ( loginUrl == null )
-		{
-        	final String invalidPropertyMsg = 
-        	"The value for property [" + Environment.SECURITY_SERVICE_CONFIG_URL +
-        	"] must be a valid URL. This property should point to a file on the local file system or on the classpath.";
-			throw new ConfigurationException(invalidPropertyMsg);
+    		URL loginUrl = ClassUtil.getResource(loginConfigUrl, getClass());
+    		log.info("LoginUrl : " + loginUrl);
+    		if ( loginUrl == null )
+    		{
+            	final String invalidPropertyMsg = 
+            	"The value for property [" + Environment.SECURITY_SERVICE_CONFIG_URL +
+            	"] must be a valid URL. This property should point to a file on the local file system or on the classpath.";
+    			throw new ConfigurationException(invalidPropertyMsg);
+    		}
+    		addLoginConfig(loginUrl);
 		}
 		
-		addLoginConfig(loginUrl);
 	}
 	
 	public void addLoginConfig(final URL loginConfigUrl) throws ConfigurationException
@@ -112,12 +109,13 @@
         {
     		log.info("Adding file [ " + loginConfigUrl + "] as [" + LOGIN_CONFIG_URL_PREFIX + urlIndex + "]");
         	Security.setProperty(LOGIN_CONFIG_URL_PREFIX + urlIndex, loginConfigUrl.toExternalForm());
+        	configuration =  new ConfigFile();
         }
 	}
 
 	public void logout(SecurityContext context) throws LoginException
 	{
-		LoginContext loginContext = new LoginContext(context.getConfigInfo().getModuleName(), context.getSubject(), null, new ConfigFile());
+		LoginContext loginContext = new LoginContext(context.getConfigInfo().getModuleName(), context.getSubject(), null, configuration);
 		loginContext.logout();
 	}
 




More information about the jboss-svn-commits mailing list