[jboss-cvs] Picketlink SVN: r436 - in trust/trunk: jbossws-native and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 6 19:20:18 EDT 2010


Author: mmoyses
Date: 2010-10-06 19:20:18 -0400 (Wed, 06 Oct 2010)
New Revision: 436

Added:
   trust/trunk/jbossws-native/
   trust/trunk/jbossws-native/.classpath
   trust/trunk/jbossws-native/.project
   trust/trunk/jbossws-native/pom.xml
   trust/trunk/jbossws-native/src/
   trust/trunk/jbossws-native/src/main/
   trust/trunk/jbossws-native/src/main/java/
   trust/trunk/jbossws-native/src/main/java/org/
   trust/trunk/jbossws-native/src/main/java/org/picketlink/
   trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/
   trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/
   trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/
   trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2Constants.java
   trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2HandlerClient.java
   trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2HandlerServer.java
   trust/trunk/parent/
   trust/trunk/parent/pom.xml
   trust/trunk/pom.xml
Log:
SAML handler

Added: trust/trunk/jbossws-native/.classpath
===================================================================
--- trust/trunk/jbossws-native/.classpath	                        (rev 0)
+++ trust/trunk/jbossws-native/.classpath	2010-10-06 23:20:18 UTC (rev 436)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Added: trust/trunk/jbossws-native/.project
===================================================================
--- trust/trunk/jbossws-native/.project	                        (rev 0)
+++ trust/trunk/jbossws-native/.project	2010-10-06 23:20:18 UTC (rev 436)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>jbossws-native</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: trust/trunk/jbossws-native/pom.xml
===================================================================
--- trust/trunk/jbossws-native/pom.xml	                        (rev 0)
+++ trust/trunk/jbossws-native/pom.xml	2010-10-06 23:20:18 UTC (rev 436)
@@ -0,0 +1,92 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <parent>
+      <groupId>org.picketlink</groupId>
+      <artifactId>picketlink-trust-parent</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+      <relativePath>../parent</relativePath>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <artifactId>picketlink-trust-jbossws-native</artifactId>
+   <packaging>jar</packaging>
+   <name>PicketLink Trust for JBossWS Native stack</name>
+   <url>http://labs.jboss.org/portal/picketlink/</url>
+   <description>Integration with JBossWS Native stack</description>
+   <licenses>
+      <license>
+         <name>lgpl</name>
+         <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+      </license>
+   </licenses>
+   <organization>
+      <name>JBoss Inc.</name>
+      <url>http://www.jboss.org</url>
+   </organization>
+   <build>
+     <plugins>
+       <plugin>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.4.3</version>
+          <configuration>
+            <printSummary>true</printSummary>
+            <disableXmlReport>false</disableXmlReport>
+            <testFailureIgnore>false</testFailureIgnore>
+            <includes>
+              <include>**/**TestCase.java</include>
+            </includes>
+            <forkMode>pertest</forkMode>
+            <argLine>-Djava.endorsed.dirs=${basedir}/src/test/resources/endorsed</argLine>
+            <useFile>false</useFile>
+            <trimStackTrace>false</trimStackTrace>
+           </configuration>
+        </plugin>
+     </plugins>
+  </build>
+
+   <dependencies>
+   	<dependency>
+   		<groupId>org.jboss.ws.native</groupId>
+   		<artifactId>jbossws-native-core</artifactId>
+   		<version>3.4.0-SNAPSHOT</version>
+   	</dependency>
+   	<dependency>
+   		<groupId>org.picketlink</groupId>
+   		<artifactId>picketlink-fed</artifactId>
+   		<version>2.0.0-SNAPSHOT</version>
+   	</dependency>
+   	<dependency>
+   		<groupId>org.picketlink</groupId>
+   		<artifactId>picketlink-bindings-jboss</artifactId>
+   		<version>2.0.0-SNAPSHOT</version>
+   	</dependency>
+   </dependencies>
+   
+   <reporting>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <doclet>org.jboss.apiviz.APIviz</doclet>
+          <docletArtifact>
+            <groupId>org.jboss.apiviz</groupId>
+            <artifactId>apiviz</artifactId>
+            <version>1.2.5.GA</version>
+          </docletArtifact>
+          <additionalparam>
+            -charset UTF-8
+            -docencoding UTF-8
+            -version
+            -author
+            -breakiterator
+            -windowtitle "${project.name} ${project.version} API Reference"
+            -doctitle "${project.name} ${project.version} API Reference"
+            -bottom "Copyright © ${project.inceptionYear}-Present ${project.organization.name}. All Rights Reserved."
+            -link http://java.sun.com/javase/6/docs/api/
+            -sourceclasspath ${project.build.outputDirectory}
+          </additionalparam>
+          <encoding>UTF-8</encoding>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
+</project>

Added: trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2Constants.java
===================================================================
--- trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2Constants.java	                        (rev 0)
+++ trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2Constants.java	2010-10-06 23:20:18 UTC (rev 436)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.picketlink.trust.jbossws.handler;
+
+public interface SAML2Constants
+{
+
+   public static String SAML2_ASSERTION_PROPERTY = "org.picketlink.trust.saml.assertion";
+   
+   public static String SAML2_ASSERTION_URI = "urn:oasis:names:tc:SAML:2.0:assertion";
+}

Added: trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2HandlerClient.java
===================================================================
--- trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2HandlerClient.java	                        (rev 0)
+++ trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2HandlerClient.java	2010-10-06 23:20:18 UTC (rev 436)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.picketlink.trust.jbossws.handler;
+
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.extensions.security.Util;
+import org.jboss.ws.extensions.security.element.SecurityHeader;
+import org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerServer;
+import org.picketlink.identity.federation.core.wstrust.SamlCredential;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class SAML2HandlerClient extends WSSecurityHandlerServer
+{
+
+   protected boolean handleInbound(MessageContext msgContext)
+   {
+      // FIXME handleInbound
+      return super.handleInbound(msgContext);
+   }
+
+   protected boolean handleOutbound(MessageContext msgContext)
+   {
+      CommonMessageContext ctx = (CommonMessageContext) msgContext;
+      SOAPMessageImpl soapMessage = (SOAPMessageImpl) ctx.getSOAPMessage();
+      
+      // retrieve assertion
+      SamlCredential credential = (SamlCredential) ctx.get(SAML2Constants.SAML2_ASSERTION_PROPERTY);
+      
+      // add wsse header
+      Document document = soapMessage.getSOAPPart();
+      Element soapHeader = Util.findOrCreateSoapHeader(document.getDocumentElement());
+      SecurityHeader secHeader = new SecurityHeader(document);
+      try
+      {
+         Element assertion = credential.getAssertionAsElement();
+         Element wsse = secHeader.getElement();
+         wsse.setAttributeNS(soapHeader.getNamespaceURI(), soapHeader.getPrefix() + ":mustUnderstand", "1");
+         // add the assertion as a child of the wsse header
+         wsse.appendChild(assertion);
+         soapHeader.insertBefore(wsse, soapHeader.getFirstChild());
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+         return false;
+      }
+      
+      return true;
+   }
+
+}

Added: trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2HandlerServer.java
===================================================================
--- trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2HandlerServer.java	                        (rev 0)
+++ trust/trunk/jbossws-native/src/main/java/org/picketlink/trust/jbossws/handler/SAML2HandlerServer.java	2010-10-06 23:20:18 UTC (rev 436)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.picketlink.trust.jbossws.handler;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.SOAPMessageImpl;
+import org.jboss.ws.extensions.security.Util;
+import org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerServer;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.invocation.SecurityAdaptor;
+import org.jboss.wsf.spi.invocation.SecurityAdaptorFactory;
+import org.picketlink.identity.federation.bindings.jboss.subject.PicketLinkPrincipal;
+import org.picketlink.identity.federation.core.wstrust.SamlCredential;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class SAML2HandlerServer extends WSSecurityHandlerServer
+{
+
+   protected boolean handleInbound(MessageContext msgContext)
+   {
+      CommonMessageContext ctx = (CommonMessageContext) msgContext;
+      SOAPMessageImpl soapMessage = (SOAPMessageImpl) ctx.getSOAPMessage();
+      
+      // retrieve the assertion
+      Document document = soapMessage.getSOAPPart();
+      Element soapHeader = Util.findOrCreateSoapHeader(document.getDocumentElement());
+      Element assertion = Util.findElement(soapHeader, new QName(SAML2Constants.SAML2_ASSERTION_URI, "Assertion"));
+      if (assertion != null)
+      {
+         SamlCredential credential = new SamlCredential(assertion);
+         Element subject = Util.findElement(assertion, new QName(SAML2Constants.SAML2_ASSERTION_URI, "Subject"));
+         Element nameID = Util.findElement(subject, new QName(SAML2Constants.SAML2_ASSERTION_URI, "NameID"));
+         String username = nameID.getNodeValue();
+         SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+         SecurityAdaptor securityAdaptor = spiProvider.getSPI(SecurityAdaptorFactory.class).newSecurityAdapter();
+         securityAdaptor.setPrincipal(new PicketLinkPrincipal(username));
+         securityAdaptor.setCredential(credential);
+      }
+      
+      return true;
+   }
+
+   protected boolean handleOutbound(MessageContext msgContext)
+   {
+      // FIXME handleOutbound
+      return super.handleOutbound(msgContext);
+   }
+   
+   
+
+}

Added: trust/trunk/parent/pom.xml
===================================================================
--- trust/trunk/parent/pom.xml	                        (rev 0)
+++ trust/trunk/parent/pom.xml	2010-10-06 23:20:18 UTC (rev 436)
@@ -0,0 +1,103 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <parent>
+      <groupId>org.jboss</groupId>
+      <artifactId>jboss-parent</artifactId>
+      <version>5</version>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <groupId>org.picketlink</groupId>
+   <artifactId>picketlink-trust-parent</artifactId>
+   <packaging>pom</packaging>
+   <version>1.0.0-SNAPSHOT</version>
+   <name>PicketLink Trust - Parent</name>
+   <url>http://labs.jboss.org/portal/picketlink/</url>
+   <description>PicketLink Trust integrates PicketLink with external projects</description>
+   <licenses>
+      <license>
+         <name>lgpl</name>
+         <url>http://repository.jboss.com/licenses/lgpl.txt</url>
+      </license>
+   </licenses>
+   <organization>
+      <name>JBoss Inc.</name>
+      <url>http://www.jboss.org</url>
+   </organization>
+   <scm>
+      <connection>scm:svn:http://anonsvn.jboss.org/repos/picketlink/trust/tags/1.0.0.alpha1</connection>
+      <developerConnection>scm:svn:https://svn.jboss.org/repos/picketlink/trust/tags/1.0.0.alpha1</developerConnection>
+   </scm>
+  
+   <build>
+     <plugins>
+        <plugin>
+          <artifactId>maven-release-plugin</artifactId>
+          <configuration>
+            <tagBase>https://svn.jboss.org/repos/jbossidentity/migration/picketlink/trust/tags</tagBase>
+          </configuration>
+        </plugin>
+     </plugins>
+     <pluginManagement>
+       <plugins>
+          <plugin>
+             <artifactId>maven-surefire-plugin</artifactId>
+             <configuration>
+               <printSummary>true</printSummary>
+               <disableXmlReport>false</disableXmlReport>
+               <testFailureIgnore>true</testFailureIgnore>
+               <includes>
+                 <include>**/**TestCase.java</include>
+               </includes>
+               <forkMode>pertest</forkMode>
+               <argLine>${surefire.jvm.args}</argLine>
+               <useFile>false</useFile>
+               <trimStackTrace>false</trimStackTrace>
+             </configuration>
+          </plugin>
+          <plugin>
+             <groupId>org.apache.maven.plugins</groupId>
+             <artifactId>maven-antrun-plugin</artifactId>
+             <version>1.4</version>
+          </plugin>
+       </plugins>
+     </pluginManagement>
+   </build>
+  
+   <repositories>
+     <repository>
+       <id>jboss-public-repository-group</id>
+       <name>JBoss Public Maven Repository Group</name>
+       <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+       <layout>default</layout>
+       <releases>
+         <enabled>true</enabled>
+         <updatePolicy>never</updatePolicy>
+       </releases>
+       <snapshots>
+         <enabled>true</enabled>
+         <updatePolicy>never</updatePolicy>
+       </snapshots>
+     </repository>
+    <repository>
+      <id>repository.jboss.org</id>
+      <name>JBoss Repository</name>
+      <layout>default</layout>
+      <url>http://repository.jboss.org/maven2/</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>snapshots.jboss.org</id>
+      <name>JBoss Snapshots Repository</name>
+      <layout>default</layout>
+      <url>http://snapshots.jboss.org/maven2/</url>
+      <snapshots>
+         <enabled>true</enabled>
+      </snapshots>
+      <releases>
+         <enabled>false</enabled>
+      </releases>
+    </repository>
+  </repositories>
+  
+</project>

Added: trust/trunk/pom.xml
===================================================================
--- trust/trunk/pom.xml	                        (rev 0)
+++ trust/trunk/pom.xml	2010-10-06 23:20:18 UTC (rev 436)
@@ -0,0 +1,33 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <parent>
+      <groupId>org.picketlink</groupId>
+      <artifactId>picketlink-trust-parent</artifactId>
+      <version>1.0.0-SNAPSHOT</version>
+      <relativePath>parent</relativePath>
+   </parent>
+   <modelVersion>4.0.0</modelVersion>
+   <groupId>org.picketlink</groupId>
+   <artifactId>picketlink-trust-pom</artifactId>
+   <packaging>pom</packaging>
+   <name>PicketLink Trust - Aggregator</name>
+   <url>http://labs.jboss.org/portal/picketlink/</url>
+   <description>PicketLink Trust integrates PicketLink with external projects</description>
+
+   <modules>
+     <module>parent</module>
+     <module>jbossws-native</module>
+   </modules>
+
+   <reporting>
+     <plugins>
+       <plugin>
+         <groupId>org.apache.maven.plugins</groupId>
+         <artifactId>maven-javadoc-plugin</artifactId>
+         <configuration>
+           <aggregate>true</aggregate>
+         </configuration>
+        </plugin>
+     </plugins>
+   </reporting>
+
+</project>



More information about the jboss-cvs-commits mailing list