JBoss Identity SVN: r322 - identity-federation/trunk/assembly.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-02-13 18:31:25 -0500 (Fri, 13 Feb 2009)
New Revision: 322
Modified:
identity-federation/trunk/assembly/bin.xml
identity-federation/trunk/assembly/sources.xml
Log:
remove bindings out of assembly
Modified: identity-federation/trunk/assembly/bin.xml
===================================================================
--- identity-federation/trunk/assembly/bin.xml 2009-02-13 23:31:10 UTC (rev 321)
+++ identity-federation/trunk/assembly/bin.xml 2009-02-13 23:31:25 UTC (rev 322)
@@ -20,9 +20,5 @@
<directory>${basedir}/../identity-fed-api/target/classes/</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
- <fileSet>
- <directory>${basedir}/../identity-bindings/target/classes/</directory>
- <outputDirectory>/</outputDirectory>
- </fileSet>
</fileSets>
</assembly>
Modified: identity-federation/trunk/assembly/sources.xml
===================================================================
--- identity-federation/trunk/assembly/sources.xml 2009-02-13 23:31:10 UTC (rev 321)
+++ identity-federation/trunk/assembly/sources.xml 2009-02-13 23:31:25 UTC (rev 322)
@@ -21,10 +21,6 @@
<directory>${basedir}/../identity-fed-api/src/main/java</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
- <fileSet>
- <directory>${basedir}/../identity-bindings/src/main/java</directory>
- <outputDirectory>/</outputDirectory>
- </fileSet>
</fileSets>
</assembly>
15 years, 2 months
JBoss Identity SVN: r321 - identity-federation/trunk.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-02-13 18:31:10 -0500 (Fri, 13 Feb 2009)
New Revision: 321
Modified:
identity-federation/trunk/pom.xml
Log:
jboss integration code
Modified: identity-federation/trunk/pom.xml
===================================================================
--- identity-federation/trunk/pom.xml 2009-02-13 23:30:49 UTC (rev 320)
+++ identity-federation/trunk/pom.xml 2009-02-13 23:31:10 UTC (rev 321)
@@ -20,6 +20,7 @@
<module>identity-fed-core</module>
<module>identity-fed-api</module>
<module>identity-bindings</module>
+ <module>identity-bindings-jboss</module>
<module>assembly</module>
</modules>
15 years, 2 months
JBoss Identity SVN: r320 - in identity-federation/trunk: identity-bindings-jboss and 11 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-02-13 18:30:49 -0500 (Fri, 13 Feb 2009)
New Revision: 320
Added:
identity-federation/trunk/identity-bindings-jboss/
identity-federation/trunk/identity-bindings-jboss/.classpath
identity-federation/trunk/identity-bindings-jboss/.project
identity-federation/trunk/identity-bindings-jboss/pom.xml
identity-federation/trunk/identity-bindings-jboss/src/
identity-federation/trunk/identity-bindings-jboss/src/main/
identity-federation/trunk/identity-bindings-jboss/src/main/java/
identity-federation/trunk/identity-bindings-jboss/src/main/java/org/
identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/
identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/identity/
identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/identity/federation/
identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/
identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/
identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/auth/
identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/auth/SAML2LoginModule.java
identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/reg/
identity-federation/trunk/identity-bindings-jboss/src/main/resources/
identity-federation/trunk/identity-bindings-jboss/src/test/
identity-federation/trunk/identity-bindings-jboss/src/test/java/
identity-federation/trunk/identity-bindings-jboss/src/test/resources/
Log:
jboss integration code
Added: identity-federation/trunk/identity-bindings-jboss/.classpath
===================================================================
--- identity-federation/trunk/identity-bindings-jboss/.classpath (rev 0)
+++ identity-federation/trunk/identity-bindings-jboss/.classpath 2009-02-13 23:30:49 UTC (rev 320)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaf/activation/1.1/activation-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/annotations-api/6.0.18/annotations-api-6.0.18.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/catalina/6.0.18/catalina-6.0.18.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-logging/commons-logging-api/1.0.3/commons-logging-api-1.0.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-modeler/commons-modeler/1.1patch/commons-modeler-1.1patch.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/coyote/6.0.18/coyote-6.0.18.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.1.9/jaxb-api-2.1.9.jar" sourcepath="M2_REPO/sun-jaxb/jaxb-api/2.1.9/jaxb-api-2.1.9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-impl/2.1.9/jaxb-impl-2.1.9.jar" sourcepath="M2_REPO/sun-jaxb/jaxb-impl/2.1.9/jaxb-impl-2.1.9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/jbossxacml/2.0.3.CR1/jbossxacml-2.0.3.CR1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/juli/6.0.18/juli-6.0.18.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar" sourcepath="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-tomcat/naming-resources/5.5.12/naming-resources-5.5.12.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/servlet-api/6.0.18/servlet-api-6.0.18.jar"/>
+ <classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0/stax-api-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-tomcat/tomcat-http/5.5.12/tomcat-http-5.5.12.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-tomcat/tomcat-util/5.5.12/tomcat-util-5.5.12.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/xmlsec/1.4.1/xmlsec-1.4.1.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-fed-api"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-fed-core"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-fed-model"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-xmlsecmodel"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxws/jaxws-api/2.1.1/jaxws-api-2.1.1.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/identity-bindings"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/security/jbosssx/2.0.2.SP6/jbosssx-2.0.2.SP6.jar"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: identity-federation/trunk/identity-bindings-jboss/.project
===================================================================
--- identity-federation/trunk/identity-bindings-jboss/.project (rev 0)
+++ identity-federation/trunk/identity-bindings-jboss/.project 2009-02-13 23:30:49 UTC (rev 320)
@@ -0,0 +1,18 @@
+<projectDescription>
+ <name>jboss-identity-bindings-jboss</name>
+ <comment>JBoss Identity Bindings for JBoss.</comment>
+ <projects>
+ <project>jboss-identity-fed-api</project>
+ <project>jboss-identity-fed-core</project>
+ <project>jboss-identity-fed-model</project>
+ <project>jboss-identity-xmlsec-model</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: identity-federation/trunk/identity-bindings-jboss/pom.xml
===================================================================
--- identity-federation/trunk/identity-bindings-jboss/pom.xml (rev 0)
+++ identity-federation/trunk/identity-bindings-jboss/pom.xml 2009-02-13 23:30:49 UTC (rev 320)
@@ -0,0 +1,113 @@
+<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.identity</groupId>
+ <artifactId>jboss-identity-fed-parent</artifactId>
+ <version>1.0.0.alpha1-SNAPSHOT</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-identity-bindings-jboss</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Identity Federation Server Bindings for JBoss</name>
+ <url>http://labs.jboss.org/portal/jbosssecurity/</url>
+ <description>JBoss Identity OpenSAML contains the foundation for Federated Identity Needs.</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.identity</groupId>
+ <artifactId>jboss-identity-fed-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>jboss-identity-fed-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.identity</groupId>
+ <artifactId>jboss-identity-bindings</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.18</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.security</groupId>
+ <artifactId>jbosssx</artifactId>
+ <version>2.0.2.SP6</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </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: identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/auth/SAML2LoginModule.java
===================================================================
--- identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/auth/SAML2LoginModule.java (rev 0)
+++ identity-federation/trunk/identity-bindings-jboss/src/main/java/org/jboss/identity/federation/bindings/jboss/auth/SAML2LoginModule.java 2009-02-13 23:30:49 UTC (rev 320)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.identity.federation.bindings.jboss.auth;
+
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.List;
+
+import javax.security.auth.login.LoginException;
+
+import org.jboss.identity.federation.bindings.tomcat.sp.holder.ServiceProviderSAMLContext;
+import org.jboss.security.SimpleGroup;
+import org.jboss.security.SimplePrincipal;
+import org.jboss.security.auth.spi.UsernamePasswordLoginModule;
+
+/**
+ * Login Module that is capable of dealing with SAML2 cases
+ * <p>
+ * The password sent to this module should be
+ * {@link ServiceProviderSAMLContext#EMPTY_PASSWORD}
+ * </p>
+ * <p>
+ * The username is available from {@link ServiceProviderSAMLContext#getUserName()}
+ * and roles is available from {@link ServiceProviderSAMLContext#getRoles()}.
+ * If the roles is null, then plugged in login modules in the stack have to provide
+ * the roles.
+ * </p>
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Feb 13, 2009
+ */
+public class SAML2LoginModule extends UsernamePasswordLoginModule
+{
+ @Override
+ protected Principal getIdentity()
+ {
+ return new SimplePrincipal(ServiceProviderSAMLContext.getUserName());
+ }
+
+ @Override
+ protected Group[] getRoleSets() throws LoginException
+ {
+ Group group = new SimpleGroup("Roles");
+
+ List<String> roles = ServiceProviderSAMLContext.getRoles();
+ if(roles != null)
+ {
+ for(String role: roles)
+ {
+ group.addMember(new SimplePrincipal(role));
+ }
+ }
+ return new Group[] {group};
+ }
+
+ @Override
+ protected String getUsersPassword() throws LoginException
+ {
+ return ServiceProviderSAMLContext.EMPTY_PASSWORD;
+ }
+}
\ No newline at end of file
15 years, 2 months
JBoss Identity SVN: r319 - in identity-federation/trunk/identity-bindings: src/main/java/org/jboss/identity/federation/bindings/tomcat/sp and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-02-13 18:29:27 -0500 (Fri, 13 Feb 2009)
New Revision: 319
Added:
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/holder/
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/holder/ServiceProviderSAMLContext.java
Modified:
identity-federation/trunk/identity-bindings/.project
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPUtil.java
Log:
handle jboss registration
Modified: identity-federation/trunk/identity-bindings/.project
===================================================================
--- identity-federation/trunk/identity-bindings/.project 2009-02-13 23:28:53 UTC (rev 318)
+++ identity-federation/trunk/identity-bindings/.project 2009-02-13 23:29:27 UTC (rev 319)
@@ -1,6 +1,6 @@
<projectDescription>
<name>jboss-identity-bindings</name>
- <comment>JBoss Identity OpenSAML contains the foundation for Federated Identity Needs.</comment>
+ <comment>JBoss Identity Bindings</comment>
<projects>
<project>jboss-identity-fed-api</project>
<project>jboss-identity-fed-core</project>
@@ -15,4 +15,4 @@
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
-</projectDescription>
\ No newline at end of file
+</projectDescription>
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java 2009-02-13 23:28:53 UTC (rev 318)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPRedirectFormAuthenticator.java 2009-02-13 23:29:27 UTC (rev 319)
@@ -25,6 +25,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.security.Principal;
+import java.util.Arrays;
import java.util.List;
import javax.servlet.ServletException;
@@ -44,8 +45,7 @@
import org.jboss.identity.federation.api.util.DeflateUtil;
import org.jboss.identity.federation.bindings.config.SPType;
import org.jboss.identity.federation.bindings.config.TrustType;
-import org.jboss.identity.federation.bindings.jboss.DefaultJBossSubjectRegistration;
-import org.jboss.identity.federation.bindings.jboss.JBossSubjectRegistration;
+import org.jboss.identity.federation.bindings.tomcat.sp.holder.ServiceProviderSAMLContext;
import org.jboss.identity.federation.bindings.util.HTTPRedirectUtil;
import org.jboss.identity.federation.bindings.util.RedirectBindingUtil;
import org.jboss.identity.federation.bindings.util.ValveUtil;
@@ -64,35 +64,18 @@
* @since Dec 12, 2008
*/
public class SPRedirectFormAuthenticator extends FormAuthenticator
-{
-
+{
private static Logger log = Logger.getLogger(SPRedirectFormAuthenticator.class);
protected SPType spConfiguration = null;
private String serviceURL = null;
private String identityURL = null;
-
- //Only important if you are deploying in JBoss environment
- private JBossSubjectRegistration jbossRegistration = new DefaultJBossSubjectRegistration();
public SPRedirectFormAuthenticator()
{
super();
}
-
- /**
- * For JBoss Deployment, you can change the value of
- * the {@code}JBossSubjectRegistration class
- * @param fqn
- * @throws Exception
- */
- public void setJBossSubjectRegistration(String fqn) throws Exception
- {
- ClassLoader tcl = SecurityActions.getContextClassLoader();
- Class<?> clazz = tcl.loadClass(fqn);
- this.jbossRegistration = (JBossSubjectRegistration) clazz.newInstance();
- }
@Override
public void start() throws LifecycleException
@@ -131,24 +114,34 @@
//Try to get the username
try
{
- Principal p = process(request,response);
- if(p == null)
+ principal = (GenericPrincipal) process(request,response);
+
+ if(principal == null)
{
String destination = createSAMLRequestMessage( relayState, response);
HTTPRedirectUtil.sendRedirectForRequestor(destination, response);
return false;
}
- String username = p.getName();
- String password = "FED_IDENTITY";
+
+ String username = principal.getName();
+ String password = ServiceProviderSAMLContext.EMPTY_PASSWORD;
+
+ //Map to JBoss specific principal
+ if(spConfiguration.getServerEnvironment().equalsIgnoreCase("JBOSS"))
+ {
+ GenericPrincipal gp = (GenericPrincipal) principal;
+ //Push a context
+ ServiceProviderSAMLContext.push(username, Arrays.asList(gp.getRoles()));
+ principal = context.getRealm().authenticate(username, password);
+ ServiceProviderSAMLContext.clear();
+ }
+
session.setNote(Constants.SESS_USERNAME_NOTE, username);
session.setNote(Constants.SESS_PASSWORD_NOTE, password);
- request.setUserPrincipal(p);
- register(request, response, p, Constants.FORM_METHOD, username, password);
+ request.setUserPrincipal(principal);
+ register(request, response, principal, Constants.FORM_METHOD, username, password);
- //Also register in JBoss SecurityAssociation
- this.jbossRegistration.register((GenericPrincipal) principal);
-
return true;
}
catch(AssertionExpiredException aie)
@@ -161,14 +154,12 @@
}
catch (Exception e)
{
- //TODO: send a saml response message
log.trace("Exception:",e);
}
return false;
}
catch(Exception e)
{
- //TODO: send a saml response message
log.debug("Exception :",e);
}
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPUtil.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPUtil.java 2009-02-13 23:28:53 UTC (rev 318)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/SPUtil.java 2009-02-13 23:29:27 UTC (rev 319)
@@ -75,6 +75,7 @@
* Handle the SAMLResponse from the IDP
* @param request entire request from IDP
* @param responseType ResponseType that has been generated
+ * @param serverEnvironment tomcat,jboss etc
* @return
* @throws Exception
*/
Added: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/holder/ServiceProviderSAMLContext.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/holder/ServiceProviderSAMLContext.java (rev 0)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/sp/holder/ServiceProviderSAMLContext.java 2009-02-13 23:29:27 UTC (rev 319)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.identity.federation.bindings.tomcat.sp.holder;
+
+import java.util.List;
+
+/**
+ * A context of username/roles to be used by login modules
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Feb 13, 2009
+ */
+public class ServiceProviderSAMLContext
+{
+ public static final String EMPTY_PASSWORD = "EMPTY_STR";
+
+ private static ThreadLocal<String> username = new ThreadLocal<String>();
+ private static ThreadLocal<List<String>> userRoles = new ThreadLocal<List<String>>();
+
+ public static void push(String user, List<String> roles)
+ {
+ username.set(user);
+ userRoles.set(roles);
+ }
+
+ public static void clear()
+ {
+ username.remove();
+ userRoles.remove();
+ }
+
+ public static String getUserName()
+ {
+ return username.get();
+ }
+
+ public static List<String> getRoles()
+ {
+ return userRoles.get();
+ }
+}
\ No newline at end of file
15 years, 2 months
JBoss Identity SVN: r318 - in identity-federation/trunk/identity-bindings/src/main: resources/schema/config and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-02-13 18:28:53 -0500 (Fri, 13 Feb 2009)
New Revision: 318
Modified:
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/AuthPropertyType.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncAlgoType.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncryptionType.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/IDPType.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyProviderType.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyValueType.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ObjectFactory.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ProviderType.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/SPType.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TrustType.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/package-info.java
identity-federation/trunk/identity-bindings/src/main/resources/schema/config/jboss-identity-fed.xsd
Log:
updated config
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/AuthPropertyType.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/AuthPropertyType.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/AuthPropertyType.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncAlgoType.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncAlgoType.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncAlgoType.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncryptionType.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncryptionType.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/EncryptionType.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/IDPType.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/IDPType.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/IDPType.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyProviderType.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyProviderType.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyProviderType.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyValueType.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyValueType.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/KeyValueType.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ObjectFactory.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ObjectFactory.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ObjectFactory.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
@@ -42,27 +42,27 @@
}
/**
- * Create an instance of {@link EncryptionType }
+ * Create an instance of {@link AuthPropertyType }
*
*/
- public EncryptionType createEncryptionType() {
- return new EncryptionType();
+ public AuthPropertyType createAuthPropertyType() {
+ return new AuthPropertyType();
}
/**
- * Create an instance of {@link TrustType }
+ * Create an instance of {@link KeyProviderType }
*
*/
- public TrustType createTrustType() {
- return new TrustType();
+ public KeyProviderType createKeyProviderType() {
+ return new KeyProviderType();
}
/**
- * Create an instance of {@link SPType }
+ * Create an instance of {@link EncryptionType }
*
*/
- public SPType createSPType() {
- return new SPType();
+ public EncryptionType createEncryptionType() {
+ return new EncryptionType();
}
/**
@@ -74,35 +74,35 @@
}
/**
- * Create an instance of {@link AuthPropertyType }
+ * Create an instance of {@link IDPType }
*
*/
- public AuthPropertyType createAuthPropertyType() {
- return new AuthPropertyType();
+ public IDPType createIDPType() {
+ return new IDPType();
}
/**
- * Create an instance of {@link ProviderType }
+ * Create an instance of {@link SPType }
*
*/
- public ProviderType createProviderType() {
- return new ProviderType();
+ public SPType createSPType() {
+ return new SPType();
}
/**
- * Create an instance of {@link KeyProviderType }
+ * Create an instance of {@link TrustType }
*
*/
- public KeyProviderType createKeyProviderType() {
- return new KeyProviderType();
+ public TrustType createTrustType() {
+ return new TrustType();
}
/**
- * Create an instance of {@link IDPType }
+ * Create an instance of {@link ProviderType }
*
*/
- public IDPType createIDPType() {
- return new IDPType();
+ public ProviderType createProviderType() {
+ return new ProviderType();
}
/**
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ProviderType.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ProviderType.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/ProviderType.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
@@ -10,6 +10,7 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
@@ -31,6 +32,14 @@
* <element name="Trust" type="{urn:jboss:identity-federation:config:1.0}TrustType" minOccurs="0"/>
* <element name="KeyProvider" type="{urn:jboss:identity-federation:config:1.0}KeyProviderType" minOccurs="0"/>
* </sequence>
+ * <attribute name="ServerEnvironment" default="JBOSS">
+ * <simpleType>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * <enumeration value="JBOSS"/>
+ * <enumeration value="TOMCAT"/>
+ * </restriction>
+ * </simpleType>
+ * </attribute>
* </restriction>
* </complexContent>
* </complexType>
@@ -56,6 +65,8 @@
protected TrustType trust;
@XmlElement(name = "KeyProvider")
protected KeyProviderType keyProvider;
+ @XmlAttribute(name = "ServerEnvironment")
+ protected String serverEnvironment;
/**
* Gets the value of the identityURL property.
@@ -129,4 +140,32 @@
this.keyProvider = value;
}
+ /**
+ * Gets the value of the serverEnvironment property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServerEnvironment() {
+ if (serverEnvironment == null) {
+ return "JBOSS";
+ } else {
+ return serverEnvironment;
+ }
+ }
+
+ /**
+ * Sets the value of the serverEnvironment property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServerEnvironment(String value) {
+ this.serverEnvironment = value;
+ }
+
}
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/SPType.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/SPType.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/SPType.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TrustType.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TrustType.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/TrustType.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/package-info.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/package-info.java 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/config/package-info.java 2009-02-13 23:28:53 UTC (rev 318)
@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-661
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.02.04 at 09:20:44 PM CST
+// Generated on: 2009.02.12 at 11:14:14 AM CST
//
@javax.xml.bind.annotation.XmlSchema(namespace = "urn:jboss:identity-federation:config:1.0", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
Modified: identity-federation/trunk/identity-bindings/src/main/resources/schema/config/jboss-identity-fed.xsd
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/resources/schema/config/jboss-identity-fed.xsd 2009-02-13 23:28:06 UTC (rev 317)
+++ identity-federation/trunk/identity-bindings/src/main/resources/schema/config/jboss-identity-fed.xsd 2009-02-13 23:28:53 UTC (rev 318)
@@ -106,7 +106,16 @@
<element name="KeyProvider" type="tns:KeyProviderType"
maxOccurs="1" minOccurs="0">
</element>
- </sequence>
+ </sequence>
+ <!-- Specify what is the server environment where the IDP or SP exists -->
+ <attribute name="ServerEnvironment" use="optional" default="JBOSS">
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="JBOSS"></enumeration>
+ <enumeration value="TOMCAT"></enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
</complexType>
<complexType name="SPType">
15 years, 2 months
JBoss Identity SVN: r317 - identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-02-13 18:28:06 -0500 (Fri, 13 Feb 2009)
New Revision: 317
Removed:
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/DefaultJBossSubjectRegistration.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/JBossSubjectRegistration.java
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/SecurityActions.java
Log:
delete jboss specific code as integration code for jboss is in a new module
Deleted: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/DefaultJBossSubjectRegistration.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/DefaultJBossSubjectRegistration.java 2009-02-13 21:07:24 UTC (rev 316)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/DefaultJBossSubjectRegistration.java 2009-02-13 23:28:06 UTC (rev 317)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.identity.federation.bindings.jboss;
-
-import java.lang.reflect.Method;
-import java.security.acl.Group;
-
-import javax.security.auth.Subject;
-
-import org.apache.catalina.realm.GenericPrincipal;
-import org.apache.log4j.Logger;
-import org.jboss.identity.federation.bindings.jboss.subject.JBossIdentityGroup;
-import org.jboss.identity.federation.bindings.jboss.subject.JBossIdentityPrincipal;
-
-/**
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 16, 2009
- */
-public class DefaultJBossSubjectRegistration implements JBossSubjectRegistration
-{
- protected Logger log = Logger.getLogger(DefaultJBossSubjectRegistration.class);
-
- public void register(GenericPrincipal principal)
- {
- String sa = "org.jboss.security.SecurityAssociation";
- try
- {
- Class<?> securityAssociationClass = SecurityActions.getContextClassLoader().loadClass(sa);
- Method m = securityAssociationClass.getDeclaredMethod("setSubject", new Class[] {Subject.class});
- Subject subject = this.getJBossSubjectFromTomcatPrincipal(principal);
- m.invoke(null, subject);
- }
- catch(Exception e)
- {
- log.trace("Not a JBoss environment. So not registering in SecurityAssociation");
- }
- }
-
- private Subject getJBossSubjectFromTomcatPrincipal(GenericPrincipal principal)
- {
- Subject subject = new Subject();
- String[] roles = principal.getRoles();
-
- subject.getPrincipals().add(new JBossIdentityPrincipal(principal.getName()));
-
- Group roleGroup = new JBossIdentityGroup("Roles");
- for(String role: roles)
- {
- roleGroup.addMember(new JBossIdentityPrincipal(role));
- }
-
- return subject;
- }
-}
\ No newline at end of file
Deleted: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/JBossSubjectRegistration.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/JBossSubjectRegistration.java 2009-02-13 21:07:24 UTC (rev 316)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/JBossSubjectRegistration.java 2009-02-13 23:28:06 UTC (rev 317)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.identity.federation.bindings.jboss;
-
-import org.apache.catalina.realm.GenericPrincipal;
-
-/**
- * Register Tomcat Principal/Roles with the JBoss Setup.
- * Mainly for propagation of identity to other containers.
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 16, 2009
- */
-public interface JBossSubjectRegistration
-{
- /**
- * Register the Tomcat Principal
- * @param principal
- */
- void register(GenericPrincipal principal);
-}
\ No newline at end of file
Deleted: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/SecurityActions.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/SecurityActions.java 2009-02-13 21:07:24 UTC (rev 316)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/SecurityActions.java 2009-02-13 23:28:06 UTC (rev 317)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.identity.federation.bindings.jboss;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * Privileged Blocks
- * @author Anil.Saldhana(a)redhat.com
- * @since Dec 9, 2008
- */
-class SecurityActions
-{
- /**
- * Get the Thread Context ClassLoader
- * @return
- */
- static ClassLoader getContextClassLoader()
- {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- }
-}
15 years, 2 months
JBoss Identity SVN: r316 - /.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-02-13 16:07:24 -0500 (Fri, 13 Feb 2009)
New Revision: 316
Added:
platform-build/
Log:
workspace for building community platform
15 years, 2 months
JBoss Identity SVN: r315 - in identity-federation/trunk: identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: sguilhen(a)redhat.com
Date: 2009-02-12 12:50:18 -0500 (Thu, 12 Feb 2009)
New Revision: 315
Modified:
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossRequestHandler.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/STSConfiguration.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustUtil.java
Log:
Added lifetime handling to the generated tokens.
Modified: identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossRequestHandler.java
===================================================================
--- identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossRequestHandler.java 2009-02-12 15:58:49 UTC (rev 314)
+++ identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossRequestHandler.java 2009-02-12 17:50:18 UTC (rev 315)
@@ -32,6 +32,7 @@
import org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityToken;
import org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityTokenResponse;
import org.jboss.identity.federation.ws.policy.AppliesTo;
+import org.jboss.identity.federation.ws.trust.LifetimeType;
import org.jboss.identity.federation.ws.trust.RequestedSecurityTokenType;
/**
@@ -78,19 +79,23 @@
provider = this.configuration.getProviderForService(serviceName);
}
// if applies-to is not available or if no provider was found for the service, use the token type.
- else if(request.getTokenType() != null && provider == null)
+ if(provider == null && request.getTokenType() != null)
{
provider = this.configuration.getProviderForTokenType(request.getTokenType().toString());
}
- else if(request.getTokenType() == null)
+ else if(appliesTo == null && request.getTokenType() == null)
throw new WSTrustException("Either AppliesTo or TokenType must be present in a security token request");
if(provider != null)
{
// create the request context and delegate token generation to the provider.
WSTrustRequestContext requestContext = new WSTrustRequestContext(request);
-
- // TODO: add a lifetime to the request when one hasn't been specified.
+ if(request.getLifetime() == null && this.configuration.getIssuedTokenTimeout() != 0)
+ {
+ // if no lifetime has been specified, use the configured timeout value.
+ LifetimeType lifetime = WSTrustUtil.createDefaultLifetime(this.configuration.getIssuedTokenTimeout());
+ request.setLifetime(lifetime);
+ }
provider.issueToken(requestContext);
// construct the ws-trust security token response.
@@ -103,8 +108,8 @@
if(request.getContext() != null)
response.setContext(request.getContext());
- // TODO: obtain the token type even when the request doesn't have one.
response.setTokenType(request.getTokenType());
+ response.setLifetime(request.getLifetime());
response.setAppliesTo(appliesTo);
response.setRequestedSecurityToken(requestedSecurityToken);
return response;
Modified: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/STSConfiguration.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/STSConfiguration.java 2009-02-12 15:58:49 UTC (rev 314)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/STSConfiguration.java 2009-02-12 17:50:18 UTC (rev 315)
@@ -59,6 +59,17 @@
* @return the token timeout value.
*/
public long getIssuedTokenTimeout();
+
+ /**
+ * <p>
+ * Given the name of a service provider, obtains the type of the token that should be used when issuing tokens to
+ * clients of that service.
+ * </p>
+ *
+ * @param serviceName the name of the service provider that requires a token from its clients.
+ * @return a {@code String} representing the type of the token that suits the specified service.
+ */
+ public String getTokenTypeForService(String serviceName);
/**
* <p>
Modified: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustUtil.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustUtil.java 2009-02-12 15:58:49 UTC (rev 314)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustUtil.java 2009-02-12 17:50:18 UTC (rev 315)
@@ -21,10 +21,17 @@
*/
package org.jboss.identity.federation.api.wstrust;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
import javax.xml.bind.JAXBElement;
import org.jboss.identity.federation.ws.addressing.EndpointReferenceType;
import org.jboss.identity.federation.ws.policy.AppliesTo;
+import org.jboss.identity.federation.ws.trust.LifetimeType;
+import org.jboss.identity.federation.ws.wss.utility.AttributedDateTime;
/**
* <p>
@@ -64,4 +71,55 @@
}
return null;
}
+
+ /**
+ * <p>
+ * Creates a {@code LifetimeType} instance that specifies a range of time that starts at the current GMT time and has
+ * the specified duration in milliseconds.
+ * </p>
+ *
+ * @param tokenTimeout the token timeout value (in milliseconds).
+ * @return the constructed {@code LifetimeType} instance.
+ */
+ public static LifetimeType createDefaultLifetime(long tokenTimeout)
+ {
+ long createdTime = getCurrentGMTTime();
+ final SimpleDateFormat calendarFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.'SSS'Z'", Locale
+ .getDefault());
+ Calendar calendar = new GregorianCalendar();
+ calendarFormatter.setTimeZone(calendar.getTimeZone());
+
+ // instantiate the "created" time.
+ calendar.setTimeInMillis(createdTime);
+ AttributedDateTime created = new AttributedDateTime();
+ created.setValue(calendarFormatter.format(calendar.getTime()));
+
+ // instantiate the "expires" time.
+ calendar.setTimeInMillis(createdTime + tokenTimeout);
+ AttributedDateTime expires = new AttributedDateTime();
+ expires.setValue(calendarFormatter.format(calendar.getTime()));
+
+ LifetimeType type = new LifetimeType();
+ type.setCreated(created);
+ type.setExpires(expires);
+ return type;
+ }
+
+ /**
+ * <p>
+ * Obtains the current GMT time in milliseconds.
+ * </p>
+ *
+ * @return a long representing the current GMT time in milliseconds.
+ */
+ public static long getCurrentGMTTime()
+ {
+ Calendar cal = new GregorianCalendar();
+ int offset = cal.get(Calendar.ZONE_OFFSET);
+ if (cal.getTimeZone().inDaylightTime(cal.getTime()))
+ offset += cal.getTimeZone().getDSTSavings();
+
+ // return the UTC/GMT time.
+ return cal.getTimeInMillis() - offset;
+ }
}
15 years, 2 months