You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/06/15 18:20:42 UTC

svn commit: r414629 - in /incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi: security/auth/impl/JAASAuthenticationService.java util/SystemProperties.java

Author: gnodet
Date: Thu Jun 15 09:20:40 2006
New Revision: 414629

URL: http://svn.apache.org/viewvc?rev=414629&view=rev
Log:
Add a simple factory bean to set system properties from the configuration file

Added:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/SystemProperties.java
Modified:
    incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/auth/impl/JAASAuthenticationService.java

Modified: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/auth/impl/JAASAuthenticationService.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/auth/impl/JAASAuthenticationService.java?rev=414629&r1=414628&r2=414629&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/auth/impl/JAASAuthenticationService.java (original)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/auth/impl/JAASAuthenticationService.java Thu Jun 15 09:20:40 2006
@@ -27,6 +27,8 @@
 import javax.security.auth.callback.UnsupportedCallbackException;
 import javax.security.auth.login.LoginContext;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.servicemix.jbi.security.auth.AuthenticationService;
 import org.apache.servicemix.jbi.security.login.CertificateCallback;
 
@@ -38,10 +40,15 @@
  */
 public class JAASAuthenticationService implements AuthenticationService {
 
+    private static final Log log = LogFactory.getLog(JAASAuthenticationService.class);
+    
     public void authenticate(Subject subject,
                              String domain,
                              final String user, 
                              final Object credentials) throws GeneralSecurityException {
+        if (log.isDebugEnabled()) {
+            log.debug("Authenticating '" + user + "' with '" + credentials + "'");
+        }
         LoginContext loginContext = new LoginContext(domain, subject, new CallbackHandler() {
             public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
                 for (int i = 0; i < callbacks.length; i++) {

Added: incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/SystemProperties.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/SystemProperties.java?rev=414629&view=auto
==============================================================================
--- incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/SystemProperties.java (added)
+++ incubator/servicemix/trunk/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/SystemProperties.java Thu Jun 15 09:20:40 2006
@@ -0,0 +1,50 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.jbi.util;
+
+import java.util.Iterator;
+import java.util.Map;
+import org.springframework.beans.factory.InitializingBean;
+
+/**
+ * Spring bean for initializing system properties.
+ * 
+ * @version $Revision: 67 $
+ * @org.apache.xbean.XBean 
+ */ 
+public class SystemProperties implements InitializingBean {
+
+    private Map properties;
+    
+    public Map getProperties() {
+        return this.properties;
+    }
+    
+    public void setProperties(Map properties) {
+        this.properties = properties;
+    }
+    
+    public void afterPropertiesSet() {
+        if (this.properties != null) {
+            for (Iterator it = this.properties.entrySet().iterator(); it.hasNext();) {
+                Map.Entry entry = (Map.Entry) it.next();
+                System.setProperty(entry.getKey().toString(), entry.getValue().toString());
+            }
+        }
+    }
+
+}