You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by dl...@apache.org on 2005/09/06 01:57:52 UTC
svn commit: r278889 - in
/portals/jetspeed-2/trunk/app-servers/security/jboss: ./
src/java/META-INF/jboss-secsvc/
src/java/org/apache/jetspeed/appservers/security/jboss/
Author: dlestrat
Date: Mon Sep 5 16:57:47 2005
New Revision: 278889
URL: http://svn.apache.org/viewcvs?rev=278889&view=rev
Log:
http://issues.apache.org/jira/browse/JS2-297#action_12322695
Added:
portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/security-providers.xml
portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/security-spi.xml
portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/transaction.xml
Removed:
portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/org/apache/jetspeed/appservers/security/jboss/JdbcMetadataUtils.java
Modified:
portals/jetspeed-2/trunk/app-servers/security/jboss/maven.xml
portals/jetspeed-2/trunk/app-servers/security/jboss/project.xml
portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/org/apache/jetspeed/appservers/security/jboss/JetspeedSecurityService.java
Modified: portals/jetspeed-2/trunk/app-servers/security/jboss/maven.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/app-servers/security/jboss/maven.xml?rev=278889&r1=278888&r2=278889&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/app-servers/security/jboss/maven.xml (original)
+++ portals/jetspeed-2/trunk/app-servers/security/jboss/maven.xml Mon Sep 5 16:57:47 2005
@@ -18,11 +18,10 @@
<goal name="sar:sar" description="Create the deliverable jar file." prereqs="test:test">
- <copy todir="${maven.build.dest}/classes/META-INF/jboss-secsvc" overwrite="true">
+ <copy todir="${maven.build.dest}/META-INF/jboss-secsvc" overwrite="true">
<fileset dir="../../../src/webapp/WEB-INF/assembly">
- <include name="security-providers.xml" />
- <include name="security-spi.xml" />
- <include name="transaction.xml" />
+ <include name="security-spi-atn.xml" />
+ <include name="security-spi-atz.xml" />
</fileset>
</copy>
Modified: portals/jetspeed-2/trunk/app-servers/security/jboss/project.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/app-servers/security/jboss/project.xml?rev=278889&r1=278888&r2=278889&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/app-servers/security/jboss/project.xml (original)
+++ portals/jetspeed-2/trunk/app-servers/security/jboss/project.xml Mon Sep 5 16:57:47 2005
@@ -56,7 +56,7 @@
<dependency>
<id>ojb:db-ojb</id>
- <version>1.0.1</version>
+ <version>1.0.3</version>
<properties>
<sar.bundle>true</sar.bundle>
</properties>
@@ -153,5 +153,28 @@
<version>1.2.1</version>
</dependency>
</dependencies>
+
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/java</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>${basedir}/../../../etc/db-ojb</directory>
+ <includes>
+ <include>repository.xml</include>
+ <include>repository_database.xml</include>
+ <include>repository_internal.xml</include>
+ <include>*.dtd</include>
+ <include>*.properties</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </build>
</project>
Added: portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/security-providers.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/security-providers.xml?rev=278889&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/security-providers.xml (added)
+++ portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/security-providers.xml Mon Sep 5 16:57:47 2005
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<!--
+Copyright 2004 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.
+-->
+<beans>
+
+ <!-- ************** Security Providers ************** -->
+ <!-- Security: Default Authentication Provider -->
+ <bean id="org.apache.jetspeed.security.AuthenticationProvider"
+ class="org.apache.jetspeed.security.impl.AuthenticationProviderImpl"
+ >
+ <constructor-arg index="0"><value>DefaultAuthenticator</value></constructor-arg>
+ <constructor-arg index="1"><value>The default authenticator</value></constructor-arg>
+ <constructor-arg index="2"><value>login.conf</value></constructor-arg>
+ <constructor-arg index="3"><ref bean="org.apache.jetspeed.security.spi.CredentialHandler"/></constructor-arg>
+ <constructor-arg index="4"><ref bean="org.apache.jetspeed.security.spi.UserSecurityHandler"/></constructor-arg>
+ </bean>
+
+ <!-- Security: Authentication Provider Proxy -->
+ <bean id="org.apache.jetspeed.security.AuthenticationProviderProxy"
+ class="org.apache.jetspeed.security.impl.AuthenticationProviderProxyImpl"
+ >
+ <constructor-arg >
+ <list>
+ <ref bean="org.apache.jetspeed.security.AuthenticationProvider"/>
+ </list>
+ </constructor-arg>
+ <constructor-arg ><value>DefaultAuthenticator</value></constructor-arg>
+ </bean>
+
+ <!-- Security: Security Provider -->
+ <bean id="org.apache.jetspeed.security.SecurityProvider"
+ class="org.apache.jetspeed.security.impl.SecurityProviderImpl"
+ >
+ <constructor-arg ><ref bean="org.apache.jetspeed.security.AuthenticationProviderProxy"/></constructor-arg>
+ <constructor-arg ><ref bean="org.apache.jetspeed.security.spi.RoleSecurityHandler"/></constructor-arg>
+ <constructor-arg ><ref bean="org.apache.jetspeed.security.spi.GroupSecurityHandler"/></constructor-arg>
+ <constructor-arg ><ref bean="org.apache.jetspeed.security.spi.SecurityMappingHandler"/></constructor-arg>
+ </bean>
+
+</beans>
Added: portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/security-spi.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/security-spi.xml?rev=278889&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/security-spi.xml (added)
+++ portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/security-spi.xml Mon Sep 5 16:57:47 2005
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<!--
+Copyright 2004 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.
+-->
+<beans>
+
+ <!-- ************** Security SPI Handlers ************** -->
+ <!-- Security SPI: CommonQueries -->
+ <bean id="org.apache.jetspeed.security.spi.impl.SecurityAccessImpl"
+ class="org.apache.jetspeed.security.spi.impl.SecurityAccessImpl"
+ init-method="init"
+ >
+ <constructor-arg ><value>JETSPEED-INF/ojb/security_repository.xml</value></constructor-arg>
+ <property name="jcdAlias"><value>JetspeedSecurityServiceDS</value></property>
+ </bean>
+
+ <bean id="org.apache.jetspeed.security.spi.SecurityAccess" parent="baseTransactionProxy"
+ name="SecurityCommonQueries" >
+ <property name="proxyInterfaces">
+ <value>org.apache.jetspeed.security.spi.SecurityAccess</value>
+ </property>
+ <property name="target">
+ <ref bean="org.apache.jetspeed.security.spi.impl.SecurityAccessImpl"/>
+ </property>
+ <property name="transactionAttributes">
+ <props>
+ <prop key="remove*">PROPAGATION_REQUIRED</prop>
+ <prop key="set*">PROPAGATION_REQUIRED</prop>
+ <prop key="*">PROPAGATION_SUPPORTS</prop>
+ </props>
+ </property>
+ </bean>
+
+</beans>
Added: portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/transaction.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/transaction.xml?rev=278889&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/transaction.xml (added)
+++ portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/META-INF/jboss-secsvc/transaction.xml Mon Sep 5 16:57:47 2005
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<!--
+ - Application context definition for PortletRegistry using Apache OJB.
+ -->
+<beans>
+
+ <!-- Transaction manager for a single OJB PersistenceBroker (alternative to JTA) -->
+ <bean id="transactionManager" class="org.springframework.orm.ojb.PersistenceBrokerTransactionManager">
+ <property name="jcdAlias"><value>JetspeedSecurityServiceDS</value></property>
+ </bean>
+
+ <!-- Transaction manager that delegates to JTA (for a transactional JNDI DataSource) -->
+ <!--
+ <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>
+ -->
+
+
+
+ <!--
+ - A parent bean definition which is a base definition for transaction proxies.
+ - It is markes as abstract, since it is never supposed to be instantiated itself.
+ - We set shared transaction attributes here, following our naming patterns.
+ - The attributes can still be overridden in child bean definitions.
+ -->
+ <bean id="baseTransactionProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
+ abstract="true">
+ <property name="transactionManager"><ref bean="transactionManager"/></property>
+ <property name="transactionAttributes">
+ <props>
+ <prop key="*">PROPAGATION_REQUIRED</prop>
+ </props>
+ </property>
+ </bean>
+
+</beans>
Modified: portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/org/apache/jetspeed/appservers/security/jboss/JetspeedSecurityService.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/org/apache/jetspeed/appservers/security/jboss/JetspeedSecurityService.java?rev=278889&r1=278888&r2=278889&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/org/apache/jetspeed/appservers/security/jboss/JetspeedSecurityService.java (original)
+++ portals/jetspeed-2/trunk/app-servers/security/jboss/src/java/org/apache/jetspeed/appservers/security/jboss/JetspeedSecurityService.java Mon Sep 5 16:57:47 2005
@@ -1,126 +1,120 @@
-/* Copyright 2004 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.jetspeed.appservers.security.jboss;
-
-import java.util.Iterator;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-
-import org.apache.jetspeed.security.UserManager;
-import org.apache.ojb.broker.PBKey;
-import org.apache.ojb.broker.PersistenceBroker;
-import org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl;
-import org.apache.ojb.broker.accesslayer.ConnectionManagerFactory;
-import org.apache.ojb.broker.metadata.ConnectionPoolDescriptor;
-import org.apache.ojb.broker.metadata.ConnectionRepository;
-import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
-import org.apache.ojb.broker.metadata.MetadataManager;
-import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.orm.ojb.OjbFactoryUtils;
-
-public class JetspeedSecurityService implements JetspeedSecurityServiceMBean
-{
-
- private final String JCD_ALIAS = "jetspeed-security-service";
-
- private GenericApplicationContext ctx;
-
- /**
- * Create a new security service. The service's implementation is based on a <a
- * href="www.springframework.org">Spring</a> application that is assembled from the configuration files in
- * <code>META-INF/jboss-secsvc</code>.
- */
- public JetspeedSecurityService()
- {
- // Prepare JCD so that it can be resolved
- JdbcConnectionDescriptor jcd = findJcd();
- if (jcd == null)
- {
- // JCD not found, initialize
- jcd = new JdbcConnectionDescriptor();
- jcd.setJcdAlias(JCD_ALIAS);
- ConnectionPoolDescriptor cpd = new ConnectionPoolDescriptor();
- cpd.setConnectionFactory(ConnectionFactoryManagedImpl.class);
- jcd.setConnectionPoolDescriptor(cpd);
- ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
- cr.addDescriptor(jcd);
- }
- // Instatiate application
- ctx = new GenericApplicationContext();
- XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
- xmlReader.loadBeanDefinitions(new ClassPathResource("META-INF/jboss-secsvc/jboss-security-service.xml"));
- ctx.refresh();
- }
-
- private JdbcConnectionDescriptor findJcd()
- {
- // Try to find JCD
- ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
- return cr.getDescriptor(new PBKey(JCD_ALIAS));
- }
-
- /**
- * Set the JNDI name of the <code>DataSource</code> to be used to access the database.
- *
- * @param jndiName
- */
- public void setDataSourceJndiName(String jndiName)
- {
- boolean newJcd = false;
- JdbcConnectionDescriptor jcd = findJcd();
- try
- {
- Context initialContext = new InitialContext();
- DataSource ds = (DataSource) initialContext.lookup(jndiName);
- (new JdbcMetadataUtils()).fillJCDFromDataSource(jcd, ds, null, null);
- }
- catch (NamingException e)
- {
- throw (IllegalArgumentException) (new IllegalArgumentException("Data source \"" + jndiName
- + "\" not found in JNDI: " + e.getMessage())).initCause(e);
- }
- jcd.setDatasourceName(jndiName);
- }
-
- /**
- * Get the JNDI name of the <code>DataSource</code> used to access the database.
- *
- * @return jndiName
- */
- public String getDataSourceJndiName()
- {
- JdbcConnectionDescriptor jcd = findJcd();
- if (jcd == null)
- {
- return null;
- }
- return jcd.getDatasourceName();
- }
-
- /**
- * @see JetspeedSecurityServiceMBean#getUserManager()
- */
- public UserManager getUserManager()
- {
- // TODO Auto-generated method stub
- UserManager um = (UserManager) ctx.getBean("org.apache.jetspeed.security.UserManager");
- return um;
- }
-}
+/* Copyright 2004 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.jetspeed.appservers.security.jboss;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.apache.jetspeed.security.UserManager;
+import org.apache.ojb.broker.PBKey;
+import org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl;
+import org.apache.ojb.broker.metadata.ConnectionPoolDescriptor;
+import org.apache.ojb.broker.metadata.ConnectionRepository;
+import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
+import org.apache.ojb.broker.metadata.JdbcMetadataUtils;
+import org.apache.ojb.broker.metadata.MetadataManager;
+import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.core.io.ClassPathResource;
+
+public class JetspeedSecurityService implements JetspeedSecurityServiceMBean
+{
+
+ private final String JCD_ALIAS = "JetspeedSecurityServiceDS";
+
+ private GenericApplicationContext ctx;
+
+ /**
+ * Create a new security service. The service's implementation is based on a <a
+ * href="www.springframework.org">Spring</a> application that is assembled from the configuration files in
+ * <code>META-INF/jboss-secsvc</code>.
+ */
+ public JetspeedSecurityService()
+ {
+ // Prepare JCD so that it can be resolved
+ JdbcConnectionDescriptor jcd = findJcd();
+ if (jcd == null)
+ {
+ // JCD not found, initialize
+ jcd = new JdbcConnectionDescriptor();
+ jcd.setJcdAlias(JCD_ALIAS);
+ ConnectionPoolDescriptor cpd = new ConnectionPoolDescriptor();
+ cpd.setConnectionFactory(ConnectionFactoryManagedImpl.class);
+ jcd.setConnectionPoolDescriptor(cpd);
+ ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
+ cr.addDescriptor(jcd);
+ }
+ // Instatiating application
+ ctx = new GenericApplicationContext();
+ XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
+ xmlReader.loadBeanDefinitions(new ClassPathResource("META-INF/jboss-secsvc/jboss-security-service.xml"));
+ ctx.refresh();
+ }
+
+ private JdbcConnectionDescriptor findJcd()
+ {
+ // Try to find JCD
+ ConnectionRepository cr = MetadataManager.getInstance().connectionRepository();
+ return cr.getDescriptor(new PBKey(JCD_ALIAS));
+ }
+
+ /**
+ * Set the JNDI name of the <code>DataSource</code> to be used to access the database.
+ *
+ * @param jndiName
+ */
+ public void setDataSourceJndiName(String jndiName)
+ {
+ JdbcConnectionDescriptor jcd = findJcd();
+ try
+ {
+ Context initialContext = new InitialContext();
+ DataSource ds = (DataSource) initialContext.lookup(jndiName);
+ (new JdbcMetadataUtils()).fillJCDFromDataSource(jcd, ds, null, null);
+ }
+ catch (NamingException e)
+ {
+ throw (IllegalArgumentException) (new IllegalArgumentException("Data source \"" + jndiName
+ + "\" not found in JNDI: " + e.getMessage())).initCause(e);
+ }
+ jcd.setDatasourceName(jndiName);
+ }
+
+ /**
+ * Get the JNDI name of the <code>DataSource</code> used to access the database.
+ *
+ * @return jndiName
+ */
+ public String getDataSourceJndiName()
+ {
+ JdbcConnectionDescriptor jcd = findJcd();
+ if (jcd == null)
+ {
+ return null;
+ }
+ return jcd.getDatasourceName();
+ }
+
+ /**
+ * @see JetspeedSecurityServiceMBean#getUserManager()
+ */
+ public UserManager getUserManager()
+ {
+ UserManager um = (UserManager) ctx.getBean("org.apache.jetspeed.security.UserManager");
+ return um;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org