[jboss-cvs] JBossAS SVN: r109967 - in trunk/webservices: src/main/java/org/jboss/webservices/integration/security and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Dec 16 05:54:13 EST 2010
Author: alessio.soldano at jboss.com
Date: 2010-12-16 05:54:12 -0500 (Thu, 16 Dec 2010)
New Revision: 109967
Added:
trunk/webservices/src/main/java/org/jboss/webservices/integration/security/JaasSecurityDomainAdaptorImpl.java
trunk/webservices/src/main/java/org/jboss/webservices/integration/security/JaasSecurityDomainAdaptorResolverImpl.java
trunk/webservices/src/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.security.JAASSecurityDomainAdaptorResolver
Modified:
trunk/webservices/pom.xml
Log:
[JBWS-3182] Adding implementation of JAASSecurityDomainAdaptor
Modified: trunk/webservices/pom.xml
===================================================================
--- trunk/webservices/pom.xml 2010-12-16 10:53:05 UTC (rev 109966)
+++ trunk/webservices/pom.xml 2010-12-16 10:54:12 UTC (rev 109967)
@@ -150,6 +150,11 @@
</dependency>
<dependency>
<groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-security</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-server</artifactId>
<scope>provided</scope>
</dependency>
Added: trunk/webservices/src/main/java/org/jboss/webservices/integration/security/JaasSecurityDomainAdaptorImpl.java
===================================================================
--- trunk/webservices/src/main/java/org/jboss/webservices/integration/security/JaasSecurityDomainAdaptorImpl.java (rev 0)
+++ trunk/webservices/src/main/java/org/jboss/webservices/integration/security/JaasSecurityDomainAdaptorImpl.java 2010-12-16 10:54:12 UTC (rev 109967)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.webservices.integration.security;
+
+import java.security.Key;
+import java.security.KeyStore;
+import java.util.Properties;
+
+import org.jboss.wsf.spi.security.JAASSecurityDomainAdaptor;
+import org.jboss.security.plugins.JaasSecurityDomain;
+
+/**
+ * Adapt JaasSecurityDomain to jbossws spi
+ *
+ * @author alessio.soldano at jboss.com
+ * @since 14-Dec-2010
+ *
+ */
+public class JaasSecurityDomainAdaptorImpl implements JAASSecurityDomainAdaptor
+{
+ private JaasSecurityDomain delegate;
+
+ public JaasSecurityDomainAdaptorImpl(JaasSecurityDomain delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public KeyStore getKeyStore()
+ {
+ return delegate.getKeyStore();
+ }
+
+ public KeyStore getTrustStore()
+ {
+ return delegate.getTrustStore();
+ }
+
+ public Properties getAdditionalOptions()
+ {
+ return delegate.getAdditionalOptions();
+ }
+
+ public Key getKey(String alias, String serviceAuthToken) throws Exception
+ {
+ return delegate.getKey(alias, serviceAuthToken);
+ }
+
+}
Added: trunk/webservices/src/main/java/org/jboss/webservices/integration/security/JaasSecurityDomainAdaptorResolverImpl.java
===================================================================
--- trunk/webservices/src/main/java/org/jboss/webservices/integration/security/JaasSecurityDomainAdaptorResolverImpl.java (rev 0)
+++ trunk/webservices/src/main/java/org/jboss/webservices/integration/security/JaasSecurityDomainAdaptorResolverImpl.java 2010-12-16 10:54:12 UTC (rev 109967)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.webservices.integration.security;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.security.plugins.JaasSecurityDomain;
+import org.jboss.wsf.spi.security.JAASSecurityDomainAdaptor;
+import org.jboss.wsf.spi.security.JAASSecurityDomainAdaptorResolver;
+
+/**
+ * Lookup JAASSecurityAdaptor from given JNDI location
+ *
+ * @author alessio.soldano at jboss.com
+ * @since 14-Dec-2010
+ */
+public class JaasSecurityDomainAdaptorResolverImpl implements JAASSecurityDomainAdaptorResolver
+{
+ public JAASSecurityDomainAdaptor lookup(String jndi) throws Exception
+ {
+ InitialContext ic = null;
+ try
+ {
+ ic = new InitialContext();
+ Object o = ic.lookup(jndi);
+ if (!(o instanceof JaasSecurityDomain))
+ {
+ throw new Exception(jndi + " not bound to a JaasSecurityDomain but to a " + o.getClass().getName() + " instance");
+ }
+ return new JaasSecurityDomainAdaptorImpl((JaasSecurityDomain)o);
+ }
+ catch (NamingException e)
+ {
+ throw new Exception("JNDI failure handling " + jndi, e);
+ }
+ finally
+ {
+ if (ic != null)
+ {
+ try
+ {
+ ic.close();
+ }
+ catch (NamingException e)
+ {
+ Logger.getLogger(JaasSecurityDomainAdaptorImpl.class).warn(this + " failed to close InitialContext", e);
+ }
+ }
+ }
+ }
+}
Added: trunk/webservices/src/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.security.JAASSecurityDomainAdaptorResolver
===================================================================
--- trunk/webservices/src/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.security.JAASSecurityDomainAdaptorResolver (rev 0)
+++ trunk/webservices/src/resources/jbossws-jboss.jar/META-INF/services/org.jboss.wsf.spi.security.JAASSecurityDomainAdaptorResolver 2010-12-16 10:54:12 UTC (rev 109967)
@@ -0,0 +1 @@
+org.jboss.webservices.integration.security.JaasSecurityDomainAdaptorResolverImpl
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list