Author: owulff
Date: Tue Apr 30 20:58:32 2013
New Revision: 1477824
URL: http://svn.apache.org/r1477824
Log:
[FEDIZ-54] Provide Maven profile to build STS with LDAP backend
Added:
cxf/fediz/trunk/services/sts/src/main/config/
cxf/fediz/trunk/services/sts/src/main/config/jaas.conf
cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/file.xml
cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/ldap.xml
Modified:
cxf/fediz/trunk/services/sts/pom.xml
cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
Modified: cxf/fediz/trunk/services/sts/pom.xml
URL:
http://svn.apache.org/viewvc/cxf/fediz/trunk/services/sts/pom.xml?rev=1477824&r1=1477823&r2=1477824&view=diff
==============================================================================
--- cxf/fediz/trunk/services/sts/pom.xml (original)
+++ cxf/fediz/trunk/services/sts/pom.xml Tue Apr 30 20:58:32 2013
@@ -30,6 +30,7 @@
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <adapter.resource>file</adapter.resource>
</properties>
<dependencies>
<dependency>
@@ -81,6 +82,12 @@
<version>${slf4j.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.springframework.ldap</groupId>
+ <artifactId>spring-ldap-core</artifactId>
+ <version>1.3.1.RELEASE</version>
+ <scope>compile</scope>
+ </dependency>
<!--
<dependency>
<groupId>org.slf4j</groupId>
@@ -89,10 +96,34 @@
<scope>provided</scope>
</dependency>
-->
+
</dependencies>
<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1.1</version>
+ <configuration>
+ <webResources>
+ <resource>
+
<directory>src/main/webapp</directory>
+
<filtering>true</filtering>
+ <includes>
+
<include>**/cxf-transport.xml</include>
+ </includes>
+ </resource>
+ <resource>
+
<directory>src/main/webapp</directory>
+
<filtering>false</filtering>
+ <excludes>
+
<exclude>**/cxf-transport.xml</exclude>
+ </excludes>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
<!--
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
@@ -120,4 +151,31 @@
<!-- Name of the generated WAR file -->
<finalName>fediz-idp-sts</finalName>
</build>
+
+ <profiles>
+ <profile>
+ <id>ldap</id>
+ <properties>
+ <adapter.resource>ldap</adapter.resource>
+ </properties>
+ <dependencyManagement>
+ <dependencies>
+ <!-- spring-ldap-core uses 3.0.5 -->
+ <dependency>
+
<groupId>org.springframework</groupId>
+
<artifactId>spring-tx</artifactId>
+
<version>${spring.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+
<groupId>org.springframework.ldap</groupId>
+
<artifactId>spring-ldap-core</artifactId>
+ <version>1.3.1.RELEASE</version>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ </profiles>
</project>
Added: cxf/fediz/trunk/services/sts/src/main/config/jaas.conf
URL:
http://svn.apache.org/viewvc/cxf/fediz/trunk/services/sts/src/main/config/jaas.conf?rev=1477824&view=auto
==============================================================================
--- cxf/fediz/trunk/services/sts/src/main/config/jaas.conf (added)
+++ cxf/fediz/trunk/services/sts/src/main/config/jaas.conf Tue Apr 30 20:58:32
2013
@@ -0,0 +1,8 @@
+LDAP {
+ com.sun.security.auth.module.LdapLoginModule REQUIRED
+ userProvider="ldap://localhost:389/ou=users,dc=fediz,dc=org"
+ java.naming.security.principal="uid=admin,ou=system"
+ java.naming.security.credentials="secret"
+ userFilter="(&(uid={USERNAME})(objectClass=person))"
+ useSSL=false;
+};
Modified: cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
URL:
http://svn.apache.org/viewvc/cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml?rev=1477824&r1=1477823&r2=1477824&view=diff
==============================================================================
--- cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml
(original)
+++ cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/cxf-transport.xml Tue
Apr 30 20:58:32 2013
@@ -23,7 +23,13 @@
<cxf:logging />
</cxf:features>
</cxf:bus>
-
+
+ <!--
+ Per default the resource <file.xml> is imported.
+ If built with Maven Profile 'ldap', the resource <ldap.xml> is
imported
+ -->
+ <import resource="${adapter.resource}.xml" />
+
<bean id="transportSTSProviderBean"
class="org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider">
<property name="issueOperation" ref="transportIssueDelegate" />
@@ -79,30 +85,14 @@
<bean id="claimsAttributeProvider"
class="org.apache.cxf.sts.claims.ClaimsAttributeStatementProvider" />
- <import resource="userClaims.xml" />
-
<bean id="claimsManager"
class="org.apache.cxf.sts.claims.ClaimsManager">
<property name="claimHandlers" ref="claimHandlerList" />
</bean>
<util:list id="claimHandlerList">
- <ref bean="fileClaimsHandler" />
+ <ref bean="claimsHandler" />
</util:list>
- <bean id="fileClaimsHandler"
class="org.apache.cxf.fediz.service.sts.FileClaimsHandler">
-
- <property name="userClaims" ref="userClaims" />
- <property name="supportedClaims" ref="supportedClaims" />
- </bean>
-
- <import resource="passwords.xml" />
-
- <bean id="upCallBackHandler"
-
class="org.apache.cxf.fediz.service.sts.UsernamePasswordCallbackHandler">
- <property name="passwords" ref="passwords" />
- </bean>
-
-
<bean id="transportService"
class="org.apache.cxf.sts.service.StaticService">
<property name="endpoints" ref="transportEndpoints" />
</bean>
@@ -121,15 +111,6 @@
<property name="issuer" value="DoubleItSTSIssuer" />
<property name="encryptionUsername" value="myservicekey" />
</bean>
-
- <jaxws:endpoint id="transportSTS1"
implementor="#transportSTSProviderBean"
- address="/STSService"
wsdlLocation="/WEB-INF/wsdl/ws-trust-1.4-service.wsdl"
- xmlns:ns1="http://docs.oasis-open.org/ws-sx/ws-trust/200512/"
- serviceName="ns1:SecurityTokenService"
endpointName="ns1:TransportUT_Port">
- <jaxws:properties>
- <entry key="ws-security.callback-handler"
value-ref="upCallBackHandler" />
- </jaxws:properties>
- </jaxws:endpoint>
<jaxws:endpoint id="transportSTS2"
implementor="#transportSTSProviderBean"
address="/STSServiceTransport"
wsdlLocation="/WEB-INF/wsdl/ws-trust-1.4-service.wsdl"
Added: cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/file.xml
URL:
http://svn.apache.org/viewvc/cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/file.xml?rev=1477824&view=auto
==============================================================================
--- cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/file.xml (added)
+++ cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/file.xml Tue Apr 30
20:58:32 2013
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-2.0.xsd
+ http://cxf.apache.org/jaxws
+ http://cxf.apache.org/schemas/jaxws.xsd">
+
+
+ <import resource="userClaims.xml" />
+ <import resource="passwords.xml" />
+
+ <bean id="claimsHandler"
class="org.apache.cxf.fediz.service.sts.FileClaimsHandler">
+ <property name="userClaims" ref="userClaims" />
+ <property name="supportedClaims" ref="supportedClaims" />
+ </bean>
+
+ <bean id="upCallBackHandler"
+
class="org.apache.cxf.fediz.service.sts.UsernamePasswordCallbackHandler">
+ <property name="passwords" ref="passwords" />
+ </bean>
+
+ <jaxws:endpoint id="transportSTS1"
implementor="#transportSTSProviderBean"
+ address="/STSService"
wsdlLocation="/WEB-INF/wsdl/ws-trust-1.4-service.wsdl"
+ xmlns:ns1="http://docs.oasis-open.org/ws-sx/ws-trust/200512/"
+ serviceName="ns1:SecurityTokenService"
endpointName="ns1:TransportUT_Port">
+ <jaxws:properties>
+ <entry key="ws-security.callback-handler"
value-ref="upCallBackHandler" />
+ </jaxws:properties>
+ </jaxws:endpoint>
+
+</beans>
\ No newline at end of file
Added: cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/ldap.xml
URL:
http://svn.apache.org/viewvc/cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/ldap.xml?rev=1477824&view=auto
==============================================================================
--- cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/ldap.xml (added)
+++ cxf/fediz/trunk/services/sts/src/main/webapp/WEB-INF/ldap.xml Tue Apr 30
20:58:32 2013
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-2.0.xsd
+ http://cxf.apache.org/jaxws
+ http://cxf.apache.org/schemas/jaxws.xsd">
+
+
+ <bean id="contextSource"
class="org.springframework.ldap.core.support.LdapContextSource">
+ <property name="url" value="ldap://localhost:389/" />
+ <property name="userDn" value="uid=admin,ou=system" />
+ <property name="password" value="secret" />
+ </bean>
+
+ <bean id="ldapTemplate"
class="org.springframework.ldap.core.LdapTemplate">
+ <constructor-arg ref="contextSource" />
+ </bean>
+
+ <util:map id="claimsToLdapAttributeMapping">
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname"
+ value="givenName" />
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname"
+ value="sn" />
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
+ value="mail" />
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country"
+ value="c" />
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/postalcode"
+ value="postalCode" />
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/streetaddress"
+ value="postalAddress" />
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/locality"
+ value="town" />
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/stateorprovince"
+ value="st" />
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/gender"
+ value="gender" />
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth"
+ value="dateofbirth" />
+ <entry
key="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/role"
+ value="member" />
+ </util:map>
+
+ <bean id="claimsHandler"
class="org.apache.cxf.sts.claims.LdapClaimsHandler">
+ <property name="ldapTemplate" ref="ldapTemplate" />
+ <property name="claimsLdapAttributeMapping"
ref="claimsToLdapAttributeMapping" />
+ <property name="userBaseDN" value="ou=users,dc=fediz,dc=org" />
+ </bean>
+
+ <jaxws:endpoint id="transportSTS1"
implementor="#transportSTSProviderBean"
+ address="/STSService"
wsdlLocation="/WEB-INF/wsdl/ws-trust-1.4-service.wsdl"
+ xmlns:ns1="http://docs.oasis-open.org/ws-sx/ws-trust/200512/"
+ serviceName="ns1:SecurityTokenService"
endpointName="ns1:TransportUT_Port">
+ <jaxws:properties>
+ <entry key="ws-security.ut.validator">
+ <bean
class="org.apache.ws.security.validate.JAASUsernameTokenValidator">
+ <property name="contextName"
value="LDAP" />
+ </bean>
+ </entry>
+ </jaxws:properties>
+ </jaxws:endpoint>
+
+</beans>
\ No newline at end of file