Author: sguilhen(a)redhat.com
Date: 2009-02-09 13:47:40 -0500 (Mon, 09 Feb 2009)
New Revision: 311
Added:
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/
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/JBossSTS.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/
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/SecurityToken.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityTokenProvider.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityTokenService.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustConstants.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustException.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustJAXBFactory.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestContext.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestHandler.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustServiceFactory.java
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/protocol/
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/BaseRequestSecurityToken.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/BaseRequestSecurityTokenResponse.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityToken.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenCollection.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenResponse.java
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenResponseCollection.java
Modified:
identity-federation/trunk/identity-bindings/.classpath
identity-federation/trunk/identity-bindings/.project
identity-federation/trunk/identity-fed-api/.classpath
identity-federation/trunk/identity-fed-api/.project
identity-federation/trunk/identity-fed-api/pom.xml
identity-federation/trunk/identity-fed-core/.classpath
identity-federation/trunk/identity-fed-core/.project
identity-federation/trunk/identity-fed-model/.classpath
identity-federation/trunk/identity-fed-model/.project
identity-federation/trunk/identity-fed-model/src/test/java/org/jboss/test/identity/federation/ws/trust/UnmarshallingTestCase.java
identity-federation/trunk/identity-xmlsecmodel/.classpath
identity-federation/trunk/identity-xmlsecmodel/.project
Log:
Adding initial WS-Trust implementation classes.
Modified: identity-federation/trunk/identity-bindings/.classpath
===================================================================
--- identity-federation/trunk/identity-bindings/.classpath 2009-02-09 05:17:32 UTC (rev
310)
+++ identity-federation/trunk/identity-bindings/.classpath 2009-02-09 18:47:40 UTC (rev
311)
@@ -1,27 +1,31 @@
-<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/resources"/>
- <classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var"
path="M2_REPO/org/apache/tomcat/catalina/6.0.18/catalina-6.0.18.jar"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
- <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/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/javax/servlet/servlet-api/2.5/servlet-api-2.5.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/naming-resources/5.5.12/naming-resources-5.5.12.jar"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/identity-fed-api"/>
- <classpathentry kind="var"
path="M2_REPO/sun-jaxb/jaxb-api/2.1.9/jaxb-api-2.1.9.jar"/>
- <classpathentry kind="var"
path="M2_REPO/apache-log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/identity-fed-core"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/identity-fed-model"/>
- <classpathentry kind="var"
path="M2_REPO/org/apache/xmlsec/1.4.1/xmlsec-1.4.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/jboss/identity/jboss-identity-xmlsec-model/1.0.0-SNAPSHOT/jboss-identity-xmlsec-model-1.0.0-SNAPSHOT.jar"/>
- <classpathentry kind="var"
path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/jboss/security/jboss-xacml/2.0.2.SP1/jboss-xacml-2.0.2.SP1.jar"
sourcepath="/M2_REPO/org/jboss/security/jboss-xacml/2.0.2.SP1/jboss-xacml-2.0.2.SP1-sources.jar"/>
- <classpathentry kind="output" path="target-eclipse/"/>
-</classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"
excluding="**/*.java"/>
+ <classpathentry kind="src" path="src/test/java"
output="target/test-classes"/>
+ <classpathentry kind="src" path="src/test/resources"
output="target/test-classes" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <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="src" path="/jboss-identity-fed-api"/>
+ <classpathentry kind="src" path="/jboss-identity-fed-core"/>
+ <classpathentry kind="src"
path="/jboss-identity-fed-model"/>
+ <classpathentry kind="src"
path="/jboss-identity-xmlsec-model"/>
+ <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"/>
+</classpath>
\ No newline at end of file
Modified: identity-federation/trunk/identity-bindings/.project
===================================================================
--- identity-federation/trunk/identity-bindings/.project 2009-02-09 05:17:32 UTC (rev
310)
+++ identity-federation/trunk/identity-bindings/.project 2009-02-09 18:47:40 UTC (rev
311)
@@ -1,17 +1,18 @@
-<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>identity-bindings</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+ <name>jboss-identity-bindings</name>
+ <comment>JBoss Identity OpenSAML contains the foundation for Federated Identity
Needs.</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>
\ No newline at end of file
Added:
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
(rev 0)
+++
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossRequestHandler.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,155 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.trust;
+
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.identity.federation.api.wstrust.STSConfiguration;
+import org.jboss.identity.federation.api.wstrust.SecurityTokenProvider;
+import org.jboss.identity.federation.api.wstrust.WSTrustException;
+import org.jboss.identity.federation.api.wstrust.WSTrustRequestContext;
+import org.jboss.identity.federation.api.wstrust.WSTrustRequestHandler;
+import org.jboss.identity.federation.api.wstrust.WSTrustUtil;
+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.RequestedSecurityTokenType;
+
+/**
+ * <p>
+ * Default implementation of the {@code WSTrustRequestHandler} interface. It creates the
request context containing the
+ * original WS-Trust request as well as any information that may be relevant to the token
processing, and delegates the
+ * actual token handling processing to the appropriate {@code SecurityTokenProvider}.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class JBossRequestHandler implements WSTrustRequestHandler
+{
+
+ private STSConfiguration configuration;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.identity.federation.api.wstrust.WSTrustRequestHandler#initialize(org.jboss.identity.federation.api.wstrust.STSConfiguration)
+ */
+ public void initialize(STSConfiguration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.identity.federation.api.wstrust.WSTrustRequestHandler#issue(org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityToken,
+ * javax.xml.ws.handler.MessageContext)
+ */
+ public RequestSecurityTokenResponse issue(RequestSecurityToken request, MessageContext
context)
+ throws WSTrustException
+ {
+ SecurityTokenProvider provider = null;
+
+ // first try to obtain the security token provider using the applies-to contents.
+ AppliesTo appliesTo = request.getAppliesTo();
+ if(appliesTo != null)
+ {
+ String serviceName = WSTrustUtil.parseAppliesTo(appliesTo);
+ if(serviceName != null)
+ 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)
+ {
+ provider =
this.configuration.getProviderForTokenType(request.getTokenType().toString());
+ }
+ else if(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.
+ provider.issueToken(requestContext);
+
+ // construct the ws-trust security token response.
+ RequestedSecurityTokenType requestedSecurityToken = new
RequestedSecurityTokenType();
+ requestedSecurityToken.setAny(requestContext.getSecurityToken());
+
+ // TODO: create proof token and encrypt the token if needed
+
+ RequestSecurityTokenResponse response = new RequestSecurityTokenResponse();
+ 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.setAppliesTo(appliesTo);
+ response.setRequestedSecurityToken(requestedSecurityToken);
+ return response;
+ }
+ else
+ throw new WSTrustException("Unable to find a token provider for the token
request");
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.identity.federation.api.wstrust.WSTrustRequestHandler#renew(org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityToken,
+ * javax.xml.ws.handler.MessageContext)
+ */
+ public RequestSecurityTokenResponse renew(RequestSecurityToken request, MessageContext
context)
+ throws WSTrustException
+ {
+ // TODO: implement renew logic.
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.identity.federation.api.wstrust.WSTrustRequestHandler#validate(org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityToken,
+ * javax.xml.ws.handler.MessageContext)
+ */
+ public RequestSecurityTokenResponse validate(RequestSecurityToken request,
MessageContext context)
+ throws WSTrustException
+ {
+ // TODO: implement validate logic.
+ throw new UnsupportedOperationException();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.identity.federation.api.wstrust.WSTrustRequestHandler#cancel(org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityToken,
+ * javax.xml.ws.handler.MessageContext)
+ */
+ public RequestSecurityTokenResponse cancel(RequestSecurityToken request,
MessageContext context)
+ throws WSTrustException
+ {
+ // TODO: implement cancel logic.
+ throw new UnsupportedOperationException();
+ }
+
+}
Added:
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossSTS.java
===================================================================
---
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossSTS.java
(rev 0)
+++
identity-federation/trunk/identity-bindings/src/main/java/org/jboss/identity/federation/bindings/jboss/trust/JBossSTS.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,163 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.trust;
+
+import javax.annotation.Resource;
+import javax.xml.transform.Source;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceProvider;
+
+import org.jboss.identity.federation.api.wstrust.STSConfiguration;
+import org.jboss.identity.federation.api.wstrust.SecurityTokenService;
+import org.jboss.identity.federation.api.wstrust.WSTrustConstants;
+import org.jboss.identity.federation.api.wstrust.WSTrustException;
+import org.jboss.identity.federation.api.wstrust.WSTrustJAXBFactory;
+import org.jboss.identity.federation.api.wstrust.WSTrustRequestHandler;
+import org.jboss.identity.federation.api.wstrust.WSTrustServiceFactory;
+import org.jboss.identity.federation.api.wstrust.protocol.BaseRequestSecurityToken;
+import org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityToken;
+import
org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityTokenCollection;
+import org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityTokenResponse;
+import
org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityTokenResponseCollection;
+
+/**
+ * <p>
+ * Default implementation of the {@code SecurityTokenService} interface.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+@WebServiceProvider
+@ServiceMode(value = Service.Mode.PAYLOAD)
+public class JBossSTS implements SecurityTokenService
+{
+
+ @Resource
+ protected WebServiceContext context;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.identity.federation.api.wstrust.SecurityTokenService#invoke(javax.xml.transform.Source)
+ */
+ public Source invoke(Source request)
+ {
+ BaseRequestSecurityToken baseRequest =
WSTrustJAXBFactory.getInstance().parseRequestSecurityToken(request);
+ if (baseRequest instanceof RequestSecurityToken)
+ return this.handleTokenRequest((RequestSecurityToken) baseRequest);
+ else if (baseRequest instanceof RequestSecurityTokenCollection)
+ return this.handleTokenRequestCollection((RequestSecurityTokenCollection)
baseRequest);
+ else
+ throw new WebServiceException("Invalid security token request");
+ }
+
+ /**
+ * <p>
+ * Process a security token request.
+ * </p>
+ *
+ * @param request a {@code RequestSecurityToken} instance that contains the request
information.
+ * @return a {@code Source} instance representing the marshalled response.
+ */
+ protected Source handleTokenRequest(RequestSecurityToken request)
+ {
+ WSTrustRequestHandler handler =
WSTrustServiceFactory.getInstance().createRequestHandler(this.getConfiguration());
+ String requestType = request.getRequestType().toString();
+
+ try
+ {
+ if (requestType.equals(WSTrustConstants.ISSUE_REQUEST))
+ return this.marshallResponse(handler.issue(request,
this.context.getMessageContext()));
+ else if (requestType.equals(WSTrustConstants.RENEW_REQUEST))
+ return this.marshallResponse(handler.renew(request,
this.context.getMessageContext()));
+ else if (requestType.equals(WSTrustConstants.CANCEL_REQUEST))
+ return this.marshallResponse(handler.cancel(request,
this.context.getMessageContext()));
+ else if (requestType.equals(WSTrustConstants.VALIDATE_REQUEST))
+ return this.marshallResponse(handler.validate(request,
this.context.getMessageContext()));
+ else
+ throw new WSTrustException("Invalid request type: " +
requestType);
+ }
+ catch (WSTrustException we)
+ {
+ throw new WebServiceException(we.getMessage(), we);
+ }
+ }
+
+ /**
+ * <p>
+ * Process a collection of security token requests.
+ * </p>
+ *
+ * @param requestCollection a {@code RequestSecurityTokenCollection} containing the
various requests information.
+ * @return a {@code Source} instance representing the marshalled response.
+ */
+ protected Source handleTokenRequestCollection(RequestSecurityTokenCollection
requestCollection)
+ {
+ // TODO: implement multiple token request handling code.
+ return null;
+ }
+
+ /**
+ * <p>
+ * Marshalls the specified {@code RequestSecurityTokenResponse} into a {@code Source}
instance.
+ * </p>
+ *
+ * @param response the {@code RequestSecurityTokenResponse} to be marshalled.
+ * @return the resulting {@code Source} instance.
+ */
+ protected Source marshallResponse(RequestSecurityTokenResponse response)
+ {
+ // add the single response to a RequestSecurityTokenResponse collection, as per the
specification.
+ RequestSecurityTokenResponseCollection responseCollection = new
RequestSecurityTokenResponseCollection();
+ responseCollection.addRequestSecurityTokenResponse(response);
+ return this.marshallResponse(responseCollection);
+ }
+
+ /**
+ * <p>
+ * Marshalls the specified {@code RequestSecurityTokenResponseCollection} into a
{@code Source} instance.
+ * </p>
+ *
+ * @param responseCollection the {@code RequestSecurityTokenResponseCollection} to be
marshalled.
+ * @return the resulting {@code Source} instance.
+ */
+ protected Source marshallResponse(RequestSecurityTokenResponseCollection
responseCollection)
+ {
+ return
WSTrustJAXBFactory.getInstance().marshallRequestSecurityTokenResponse(responseCollection);
+ }
+
+ /**
+ * <p>
+ * Obtains the STS configuration options.
+ * </p>
+ *
+ * @return an instance of {@code STSConfiguration} containing the STS configuration
properties.
+ */
+ protected STSConfiguration getConfiguration()
+ {
+ // TODO: create the configuration instance.
+ return null;
+ }
+}
Modified: identity-federation/trunk/identity-fed-api/.classpath
===================================================================
--- identity-federation/trunk/identity-fed-api/.classpath 2009-02-09 05:17:32 UTC (rev
310)
+++ identity-federation/trunk/identity-fed-api/.classpath 2009-02-09 18:47:40 UTC (rev
311)
@@ -1,17 +1,21 @@
-<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="src" path="src/test/resources"/>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var"
path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/junit/junit/4.4/junit-4.4.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/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.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-core"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/identity-fed-model"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/identity-xmlsecmodel"/>
- <classpathentry kind="output" path="target-eclipse"/>
-</classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"
excluding="**/*.java"/>
+ <classpathentry kind="src" path="src/test/java"
output="target/test-classes"/>
+ <classpathentry kind="src" path="src/test/resources"
output="target/test-classes" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <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/apache-logging/commons-logging-api/1.0.3/commons-logging-api-1.0.3.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="src" path="/jboss-identity-fed-core"/>
+ <classpathentry kind="src"
path="/jboss-identity-fed-model"/>
+ <classpathentry kind="src"
path="/jboss-identity-xmlsec-model"/>
+ <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/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/codehaus-stax/stax/1.1.1/stax-1.1.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/stax/stax-api/1.0/stax-api-1.0.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/org/apache/xmlsec/1.4.1/xmlsec-1.4.1.jar"/>
+</classpath>
\ No newline at end of file
Modified: identity-federation/trunk/identity-fed-api/.project
===================================================================
--- identity-federation/trunk/identity-fed-api/.project 2009-02-09 05:17:32 UTC (rev 310)
+++ identity-federation/trunk/identity-fed-api/.project 2009-02-09 18:47:40 UTC (rev 311)
@@ -1,17 +1,17 @@
-<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>identity-fed-api</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+ <name>jboss-identity-fed-api</name>
+ <comment>JBoss Identity Federation API contains the API to be used by the users
of JBoss Identity Federation.</comment>
+ <projects>
+ <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>
\ No newline at end of file
Modified: identity-federation/trunk/identity-fed-api/pom.xml
===================================================================
--- identity-federation/trunk/identity-fed-api/pom.xml 2009-02-09 05:17:32 UTC (rev 310)
+++ identity-federation/trunk/identity-fed-api/pom.xml 2009-02-09 18:47:40 UTC (rev 311)
@@ -63,6 +63,11 @@
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
+ <groupId>sun-jaxws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <version>2.1.1</version>
+ </dependency>
+ <dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0</version>
Added:
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
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/STSConfiguration.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * The {@code STSConfiguration} interface allows access to the security token service
(STS) configuration attributes.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public interface STSConfiguration
+{
+
+ /**
+ * <p>
+ * Obtains the unique name of the secure token service.
+ * </p>
+ *
+ * @return a {@code String} representing the STS name.
+ */
+ public String getSTSName();
+
+ /**
+ * <p>
+ * Indicates whether the issued token must be encrypted or not.
+ * </p>
+ *
+ * @return {@code true} if the issued token must be encrypted; {@code false}
otherwise.
+ */
+ public boolean getEncryptIssuedToken();
+
+ /**
+ * <p>
+ * Obtains the timeout value (in milliseconds) for issued tokens.
+ * </p>
+ *
+ * @return the token timeout value.
+ */
+ public long getIssuedTokenTimeout();
+
+ /**
+ * <p>
+ * Given the name of a service provider, obtains the provider that must be used when
issuing tokens to clients of
+ * that service. When requesting a token to the STS, a client can specify the service
it needs the token for using
+ * the {@code AppliesTo} element. Based on the service provider name, the STS
identifies the type of the token that
+ * is to be issued and then selects the appropriate token provider to handle the
request.
+ * </p>
+ *
+ * @param serviceName the name of the service provider that requires a token from its
clients.
+ * @return a reference to the {@code SecurityTokenProvider} that must be used in order
to issue tokens to clients of
+ * the specified service.
+ */
+ public SecurityTokenProvider getProviderForService(String serviceName);
+
+ /**
+ * <p>
+ * Given a token type, obtains the token provider that should be used to handle token
requests of that type. When a
+ * client doesn't specify the service provider name through the {@code AppliesTo}
element, it must specify the token
+ * type through the {@code TokenType} element. The STS uses the supplied type to
select the appropriate token
+ * provider.
+ * </p>
+ *
+ * @param tokenType a {@code String} representing the type of the token.
+ * @return a reference to the {@code SecurityTokenProvider} that must be used to
handle token requests of the
+ * specified type.
+ */
+ public SecurityTokenProvider getProviderForTokenType(String tokenType);
+
+ /**
+ * <p>
+ * Obtains a {@code Map} that contains the non-standard configuration options.
+ * </p>
+ *
+ * @return a {@code Map<String, Object>} containing the additional configuration
options.
+ */
+ public Map<String, Object> getOptions();
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityToken.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityToken.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityToken.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+/**
+ * <p>
+ * Interface that represents a security token.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public interface SecurityToken
+{
+
+ /**
+ * <p>
+ * Obtains the type of the security token.
+ * </p>
+ *
+ * @return a {@code String} representing the security token type.
+ */
+ public String getTokenType();
+
+ /**
+ * <p>
+ * Obtains the value of the security token.
+ * </p>
+ *
+ * @return an {@code Object} representing the security token value.
+ */
+ public Object getTokenValue();
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityTokenProvider.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityTokenProvider.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityTokenProvider.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+/**
+ * <p>
+ * This interface defines the methods that must be implemented by security token
providers.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public interface SecurityTokenProvider
+{
+ /**
+ * <p>
+ * Generates a security token using the information contained in the specified request
context and stores the
+ * newly-created token in the context itself.
+ * </p>
+ *
+ * @param context the {@code WSTrustRequestContext} to be used when generating the
token.
+ * @throws WSTrustException if an error occurs while creating the security token.
+ */
+ public void issueToken(WSTrustRequestContext context) throws WSTrustException;
+
+ /**
+ * <p>
+ * Renews the security token contained in the specified request context. This method
is used when a previously
+ * generated token has expired, generating a new version of the same token with
different expiration semantics.
+ * </p>
+ *
+ * @param context the {@code WSTrustRequestContext} that contains the token to be
renewed.
+ * @throws WSTrustException if an error occurs while renewing the security token.
+ */
+ public void renewToken(WSTrustRequestContext context) throws WSTrustException;
+
+ /**
+ * <p>
+ * Cancels the token contained in the specified request context. A security token is
usually canceled when one wants
+ * to make sure that the token will not be used anymore. A security token can't be
renewed once it has been canceled.
+ * </p>
+ *
+ * @param context the {@code WSTrustRequestContext} that contains the token to be
canceled.
+ * @throws WSTrustException if an error occurs while canceling the security token.
+ */
+ public void cancelToken(WSTrustRequestContext context) throws WSTrustException;
+
+ /**
+ * <p>
+ * Evaluates the validity of the token contained in the specified request context and
sets the result in the context
+ * itself. The result can be a status, a new token, or both.
+ * </p>
+ *
+ * @param context the {@code WSTrustRequestContext} that contains the token to be
validated.
+ * @throws WSTrustException if an error occurs while validating the security token.
+ */
+ public void validateToken(WSTrustRequestContext context) throws WSTrustException;
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityTokenService.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityTokenService.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/SecurityTokenService.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+import javax.xml.transform.Source;
+import javax.xml.ws.Provider;
+
+/**
+ * <p>
+ * The {@code SecurityTokenService} (STS) interface. It extends the {@code Provider}
interface so that it can be
+ * dynamically invoked (as opposed to having a service endpoint interface).
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public interface SecurityTokenService extends Provider<Source>
+{
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.xml.ws.Provider#invoke(java.lang.Object)
+ */
+ public Source invoke(Source request);
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustConstants.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustConstants.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustConstants.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+/**
+ * <p>
+ * This class defines the constants used throughout the WS-Trust implementation code.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class WSTrustConstants
+{
+ public final static String BASE_NAMESPACE =
"http://docs.oasis-open.org/ws-sx/ws-trust/200512";
+
+ public final static String ISSUE_REQUEST = BASE_NAMESPACE + "/Issue";
+
+ public final static String RENEW_REQUEST = BASE_NAMESPACE + "/Renew";
+
+ public final static String CANCEL_REQUEST = BASE_NAMESPACE + "/Cancel";
+
+ public final static String VALIDATE_REQUEST = BASE_NAMESPACE + "/Validate";
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustException.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustException.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustException.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+/**
+ * <p>
+ * Exception used to convey that an error has happened when handling a WS-Trust request
message.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class WSTrustException extends Exception
+{
+
+ private static final long serialVersionUID = -232066282004315310L;
+
+ /**
+ * <p>
+ * Creates an instance of {@code WSTrustException} using the specified error message.
+ * </p>
+ *
+ * @param message the error message.
+ */
+ public WSTrustException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * <p>
+ * Creates an instance of {@code WSTrustException} using the specified error message
and cause.
+ * </p>
+ *
+ * @param message the error message.
+ * @param cause a {@code Throwable} representing the cause of the error.
+ */
+ public WSTrustException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustJAXBFactory.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustJAXBFactory.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustJAXBFactory.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,227 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.util.JAXBSource;
+import javax.xml.transform.Source;
+
+import org.jboss.identity.federation.api.wstrust.protocol.BaseRequestSecurityToken;
+import
org.jboss.identity.federation.api.wstrust.protocol.BaseRequestSecurityTokenResponse;
+import org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityToken;
+import
org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityTokenCollection;
+import org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityTokenResponse;
+import
org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityTokenResponseCollection;
+import org.jboss.identity.federation.ws.trust.ObjectFactory;
+import org.jboss.identity.federation.ws.trust.RequestSecurityTokenCollectionType;
+import
org.jboss.identity.federation.ws.trust.RequestSecurityTokenResponseCollectionType;
+import org.jboss.identity.federation.ws.trust.RequestSecurityTokenResponseType;
+import org.jboss.identity.federation.ws.trust.RequestSecurityTokenType;
+
+/**
+ * <p>
+ * This factory implements utility methods for converting between JAXB model objects and
XML source.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class WSTrustJAXBFactory
+{
+ private static final WSTrustJAXBFactory instance = new WSTrustJAXBFactory();
+
+ private final JAXBContext context;
+
+ private final ObjectFactory factory;
+
+ /**
+ * <p>
+ * Creates the {@code WSTrustJAXBFactory} singleton instance.
+ * </p>
+ */
+ private WSTrustJAXBFactory()
+ {
+ StringBuffer packages = new StringBuffer();
+ packages.append("org.jboss.identity.federation.ws.addressing");
+ packages.append(":org.jboss.identity.federation.ws.policy");
+ packages.append(":org.jboss.identity.federation.ws.trust");
+ packages.append(":org.jboss.identity.federation.ws.wss.secext");
+ packages.append(":org.jboss.identity.federation.ws.wss.utility");
+ try
+ {
+ this.context = JAXBContext.newInstance(packages.toString());
+ this.factory = new ObjectFactory();
+ }
+ catch (JAXBException e)
+ {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * <p>
+ * Gets a reference to the singleton instance.
+ * </p>
+ *
+ * @return a reference to the {@code WSTrustJAXBFactory} instance.
+ */
+ public static WSTrustJAXBFactory getInstance()
+ {
+ return instance;
+ }
+
+ /**
+ * <p>
+ * Creates a {@code BaseRequestSecurityToken} from the specified XML source.
+ * </p>
+ *
+ * @param request the XML source containing the security token request message.
+ * @return the constructed {@code BaseRequestSecurityToken} instance. It will be an
instance of
+ * {@code RequestSecurityToken} the message contains a single token request,
and an instance of
+ * {@code RequestSecurityTokenCollection} if multiples requests are being made
in the same message.
+ */
+ public BaseRequestSecurityToken parseRequestSecurityToken(Source request)
+ {
+ try
+ {
+ Unmarshaller unmarshaller = this.context.createUnmarshaller();
+ JAXBElement<?> element = (JAXBElement<?>)
unmarshaller.unmarshal(request);
+ // is this a single token request or a collection of token requests
+ if (element.getDeclaredType().equals(RequestSecurityTokenType.class))
+ return new RequestSecurityToken((RequestSecurityTokenType)
element.getValue());
+ else if
(element.getDeclaredType().equals(RequestSecurityTokenCollectionType.class))
+ return new
RequestSecurityTokenCollection((RequestSecurityTokenCollectionType) element.getValue());
+ else
+ throw new RuntimeException("Invalid request type: " +
element.getDeclaredType());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to unmarshall security token
request", e);
+ }
+ }
+
+ /**
+ * <p>
+ * Creates a {@code BaseRequestSecurityTokenResponse} from the specified XML source.
+ * </p>
+ *
+ * @param response the XML source containing the security token response message.
+ * @return the constructed {@code BaseRequestSecurityTokenResponse} instance. It
should return an instance of
+ * {@code RequestSecurityTokenResponseCollection} according to the
specification, but we allow a single
+ * response to be returned in the form of a {@code
RequestSecurityTokenResponse} instance.
+ */
+ public BaseRequestSecurityTokenResponse parseRequestSecurityTokenResponse(Source
response)
+ {
+ try
+ {
+ Unmarshaller unmarshaller = this.context.createUnmarshaller();
+ JAXBElement<?> element = (JAXBElement<?>)
unmarshaller.unmarshal(response);
+ // is this a single token response or a collection of token responses
+ if (element.getDeclaredType().equals(RequestSecurityTokenResponseType.class))
+ return new RequestSecurityTokenResponse((RequestSecurityTokenResponseType)
element.getValue());
+ else if
(element.getDeclaredType().equals(RequestSecurityTokenResponseCollectionType.class))
+ return new
RequestSecurityTokenResponseCollection((RequestSecurityTokenResponseCollectionType)
element
+ .getValue());
+ else
+ throw new RuntimeException("Invalid response type: " +
element.getDeclaredType());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Failed to unmarshall security token
response", e);
+ }
+ }
+
+ /**
+ * <p>
+ * Creates a {@code javax.xml.transform.Source} from the specified request object.
+ * </p>
+ *
+ * @param request a {@code BaseRequestSecurityToken} representing the object model of
the security token request.
+ * @return the constructed {@code Source} instance.
+ */
+ public Source marshallRequestSecurityToken(BaseRequestSecurityToken request)
+ {
+ JAXBElement<?> element = null;
+ if (request instanceof RequestSecurityToken)
+ {
+ RequestSecurityToken requestSecurityToken = (RequestSecurityToken) request;
+ element =
this.factory.createRequestSecurityToken(requestSecurityToken.getDelegate());
+ }
+ else if (request instanceof RequestSecurityTokenCollection)
+ {
+ RequestSecurityTokenCollection collection = (RequestSecurityTokenCollection)
request;
+ element =
this.factory.createRequestSecurityTokenCollection(collection.getDelegate());
+ }
+ else
+ throw new RuntimeException("Failed to determine the type of the security
token request");
+
+ try
+ {
+ Marshaller marshaller = this.context.createMarshaller();
+ return new JAXBSource(marshaller, element);
+ }
+ catch (JAXBException je)
+ {
+ throw new RuntimeException("Failed to marshall security token
request", je);
+ }
+ }
+
+ /**
+ * <p>
+ * Creates a {@code javax.xml.transform.Source} from the specified response object.
+ * </p>
+ *
+ * @param response a {@code BaseRequestSecurityTokenResponse} representing the object
model of the security token
+ * response.
+ * @return the constructed {@code Source} instance.
+ */
+ public Source marshallRequestSecurityTokenResponse(BaseRequestSecurityTokenResponse
response)
+ {
+ JAXBElement<?> element = null;
+ if (response instanceof RequestSecurityTokenResponse)
+ {
+ RequestSecurityTokenResponse requestSecurityTokenResponse =
(RequestSecurityTokenResponse) response;
+ element =
this.factory.createRequestSecurityTokenResponse(requestSecurityTokenResponse.getDelegate());
+ }
+ else if (response instanceof RequestSecurityTokenResponseCollection)
+ {
+ RequestSecurityTokenResponseCollection collection =
(RequestSecurityTokenResponseCollection) response;
+ element =
this.factory.createRequestSecurityTokenResponseCollection(collection.getDelegate());
+ }
+ else
+ throw new RuntimeException("Failed to determine the type of the security
token response");
+
+ try
+ {
+ Marshaller marshaller = this.context.createMarshaller();
+ return new JAXBSource(marshaller, element);
+ }
+ catch (JAXBException je)
+ {
+ throw new RuntimeException("Failed to marshall security token
request", je);
+ }
+ }
+
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestContext.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestContext.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestContext.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+import org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityToken;
+
+/**
+ * <p>
+ * The {@code WSTrustRequestContext} contains all the information that is relevant for
the security token request
+ * processing.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class WSTrustRequestContext
+{
+
+ private final RequestSecurityToken request;
+
+ private SecurityToken securityToken;
+
+ /**
+ * <p>
+ * Creates an instance of {@code WSTrustRequestContext} using the specified request.
+ * </p>
+ *
+ * @param request a {@code RequestSecurityToken} object that contains the information
about the security token
+ * request.
+ */
+ public WSTrustRequestContext(RequestSecurityToken request)
+ {
+ this.request = request;
+ }
+
+ /**
+ * <p>
+ * Obtains the object the contains the information about the security token request.
+ * </p>
+ *
+ * @return a reference to the {@code RequestSecurityToken} instance.
+ */
+ public RequestSecurityToken getRequestSecurityToken()
+ {
+ return this.request;
+ }
+
+ /**
+ * <p>
+ * Obtains the security token contained in this context.
+ * </p>
+ *
+ * @return a reference to the {@code SecurityToken} instance.
+ */
+ public SecurityToken getSecurityToken()
+ {
+ return this.securityToken;
+ }
+
+ /**
+ * <p>
+ * Sets the security token in the context.
+ * </p>
+ *
+ * @param token the {@code SecurityToken} instance to be set.
+ */
+ public void setSecurityToken(SecurityToken token)
+ {
+ this.securityToken = token;
+ }
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestHandler.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestHandler.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustRequestHandler.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityToken;
+import org.jboss.identity.federation.api.wstrust.protocol.RequestSecurityTokenResponse;
+
+/**
+ * <p>
+ * The {@code WSTrustRequestHandler} interface defines the methods that will be
responsible for handling the different
+ * types of WS-Trust request messages.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public interface WSTrustRequestHandler
+{
+
+ /**
+ * <p>
+ * Initializes the concrete {@code WSTrustRequestHandler} instance.
+ * </p>
+ *
+ * @param configuration a reference to object that contains the STS configuration.
+ */
+ public void initialize(STSConfiguration configuration);
+
+ /**
+ * <p>
+ * Generates a security token according to the information specified in the request
message and returns the created
+ * token in the response.
+ * </p>
+ *
+ * @param request the security token request message.
+ * @param context the context of the token request message. The context provides
information that may be relevant to
+ * the request processing, such as the subject of the caller.
+ * @return a {@code RequestSecurityTokenResponse} containing the generated token.
+ * @throws WSTrustException if an error occurs while handling the request message.
+ */
+ public RequestSecurityTokenResponse issue(RequestSecurityToken request, MessageContext
context)
+ throws WSTrustException;
+
+ /**
+ * <p>
+ * Renews the security token as specified in the request message, returning the
renewed token in the response.
+ * </p>
+ *
+ * @param request the request message that contains the token to be renewed.
+ * @param context the context of the token request message. The context provides
information that may be relevant to
+ * the request processing, such as the subject of the caller.
+ * @return a {@code RequestSecurityTokenResponse} containing the renewed token.
+ * @throws WSTrustException if an error occurs while handling the renewal process.
+ */
+ public RequestSecurityTokenResponse renew(RequestSecurityToken request, MessageContext
context)
+ throws WSTrustException;
+
+ /**
+ * <p>
+ * Cancels the security token as specified in the request message.
+ * </p>
+ *
+ * @param request the request message that contains the token to be canceled.
+ * @param context the context of the token request message. The context provides
information that may be relevant to
+ * the request processing, such as the subject of the caller.
+ * @return a {@code RequestSecurityTokenResponse} indicating whether the token has
been canceled or not.
+ * @throws WSTrustException if an error occurs while handling the cancellation
process.
+ */
+ public RequestSecurityTokenResponse cancel(RequestSecurityToken request,
MessageContext context)
+ throws WSTrustException;
+
+ /**
+ * <p>
+ * Validates the security token as specified in the request message.
+ * </p>
+ *
+ * @param request the request message that contains the token to be validated.
+ * @param context the context of the token request message. The context provides
information that may be relevant to
+ * the request processing, such as the subject of the caller.
+ * @return a {@code RequestSecurityTokenResponse} containing the validation status or
a new token.
+ * @throws WSTrustException if an error occurs while handling the validation process.
+ */
+ public RequestSecurityTokenResponse validate(RequestSecurityToken request,
MessageContext context)
+ throws WSTrustException;
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustServiceFactory.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustServiceFactory.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustServiceFactory.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+/**
+ * <p>
+ * Factory class used for instantiating pluggable services, such as the {@code
WSTrustRequestHandler} and
+ * {@code SecurityTokenProvider} implementations.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class WSTrustServiceFactory
+{
+
+ private static final WSTrustServiceFactory factory = new WSTrustServiceFactory();
+
+ /**
+ * <p>
+ * Creates the {@code WSTrustConfigurationFactory} singleton instance.
+ * </p>
+ */
+ private WSTrustServiceFactory()
+ {
+ }
+
+ /**
+ * <p>
+ * Obtains a reference to the singleton instance.
+ * </p>
+ *
+ * @return the {@code WSTrustConfigurationFactory} singleton.
+ */
+ public static WSTrustServiceFactory getInstance()
+ {
+ return factory;
+ }
+
+ public WSTrustRequestHandler createRequestHandler(STSConfiguration configuration)
+ {
+ // TODO: obtain the actual WSTrustRequestHandler implementation class from the
configuration.
+ String handlerClassName =
"org.jboss.identity.federation.api.wstrust.JBossWSTrustRequestHandler";
+ try
+ {
+ Class<?> handlerClass = null;
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ if (loader == null)
+ handlerClass = Class.forName(handlerClassName);
+ else
+ handlerClass = loader.loadClass(handlerClassName);
+
+ // TODO: instantiate the class using a privileged block.
+ WSTrustRequestHandler handler = (WSTrustRequestHandler)
handlerClass.newInstance();
+ handler.initialize(configuration);
+ return handler;
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+}
Added:
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
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/WSTrustUtil.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust;
+
+import javax.xml.bind.JAXBElement;
+
+import org.jboss.identity.federation.ws.addressing.EndpointReferenceType;
+import org.jboss.identity.federation.ws.policy.AppliesTo;
+
+/**
+ * <p>
+ * Utility class that provides methods for parsing/creating WS-Trust elements.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class WSTrustUtil
+{
+
+ /**
+ * <p>
+ * Parses the contents of the {@code AppliesTo} element and returns the address the
uniquely identify the service
+ * provider.
+ * </p>
+ *
+ * @param appliesTo the {@code AppliesTo} instance to be parsed.
+ * @return the address of the service provider.
+ */
+ public static String parseAppliesTo(AppliesTo appliesTo)
+ {
+ EndpointReferenceType reference = null;
+ for (Object obj : appliesTo.getAny())
+ {
+ if (obj instanceof EndpointReferenceType)
+ reference = (EndpointReferenceType) obj;
+ else if (obj instanceof JAXBElement)
+ {
+ JAXBElement<?> element = (JAXBElement<?>) obj;
+ if
(element.getName().getLocalPart().equalsIgnoreCase("EndpointReference"))
+ reference = (EndpointReferenceType) element.getValue();
+ }
+
+ if (reference != null && reference.getAddress() != null)
+ return reference.getAddress().toString();
+ }
+ return null;
+ }
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/BaseRequestSecurityToken.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/BaseRequestSecurityToken.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/BaseRequestSecurityToken.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust.protocol;
+
+/**
+ * <p>
+ * Marker interface for the request security token types.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public interface BaseRequestSecurityToken
+{
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/BaseRequestSecurityTokenResponse.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/BaseRequestSecurityTokenResponse.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/BaseRequestSecurityTokenResponse.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust.protocol;
+
+/**
+ * <p>
+ * Marker interface for the security token response types.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public interface BaseRequestSecurityTokenResponse
+{
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityToken.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityToken.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityToken.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,1001 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust.protocol;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import org.jboss.identity.federation.ws.addressing.EndpointReferenceType;
+import org.jboss.identity.federation.ws.policy.AppliesTo;
+import org.jboss.identity.federation.ws.policy.Policy;
+import org.jboss.identity.federation.ws.policy.PolicyReference;
+import org.jboss.identity.federation.ws.trust.AllowPostdatingType;
+import org.jboss.identity.federation.ws.trust.ClaimsType;
+import org.jboss.identity.federation.ws.trust.DelegateToType;
+import org.jboss.identity.federation.ws.trust.EncryptionType;
+import org.jboss.identity.federation.ws.trust.EntropyType;
+import org.jboss.identity.federation.ws.trust.LifetimeType;
+import org.jboss.identity.federation.ws.trust.ObjectFactory;
+import org.jboss.identity.federation.ws.trust.OnBehalfOfType;
+import org.jboss.identity.federation.ws.trust.ProofEncryptionType;
+import org.jboss.identity.federation.ws.trust.RenewingType;
+import org.jboss.identity.federation.ws.trust.RequestSecurityTokenType;
+import org.jboss.identity.federation.ws.trust.UseKeyType;
+
+/**
+ * <p>
+ * This class represents a WS-Trust {@code RequestSecurityToken}. It wraps the JAXB
representation of the security
+ * token request and offers a series of getter/setter methods that make it easy to work
with elements that are
+ * represented by the {@code Any} XML type.
+ * </p>
+ * <p>
+ * The following shows the intended content model of a {@code RequestSecurityToken}:
+ *
+ * <pre>
+ * <xs:element ref='wst:TokenType' minOccurs='0' />
+ * <xs:element ref='wst:RequestType' />
+ * <xs:element ref='wsp:AppliesTo' minOccurs='0' />
+ * <xs:element ref='wst:Claims' minOccurs='0' />
+ * <xs:element ref='wst:Entropy' minOccurs='0' />
+ * <xs:element ref='wst:Lifetime' minOccurs='0' />
+ * <xs:element ref='wst:AllowPostdating' minOccurs='0'
/>
+ * <xs:element ref='wst:Renewing' minOccurs='0' />
+ * <xs:element ref='wst:OnBehalfOf' minOccurs='0' />
+ * <xs:element ref='wst:Issuer' minOccurs='0' />
+ * <xs:element ref='wst:AuthenticationType' minOccurs='0'
/>
+ * <xs:element ref='wst:KeyType' minOccurs='0' />
+ * <xs:element ref='wst:KeySize' minOccurs='0' />
+ * <xs:element ref='wst:SignatureAlgorithm' minOccurs='0'
/>
+ * <xs:element ref='wst:Encryption' minOccurs='0' />
+ * <xs:element ref='wst:EncryptionAlgorithm' minOccurs='0'
/>
+ * <xs:element ref='wst:CanonicalizationAlgorithm'
minOccurs='0' />
+ * <xs:element ref='wst:ProofEncryption' minOccurs='0'
/>
+ * <xs:element ref='wst:UseKey' minOccurs='0' />
+ * <xs:element ref='wst:SignWith' minOccurs='0' />
+ * <xs:element ref='wst:EncryptWith' minOccurs='0' />
+ * <xs:element ref='wst:DelegateTo' minOccurs='0' />
+ * <xs:element ref='wst:Forwardable' minOccurs='0' />
+ * <xs:element ref='wst:Delegatable' minOccurs='0' />
+ * <xs:element ref='wsp:Policy' minOccurs='0' />
+ * <xs:element ref='wsp:PolicyReference' minOccurs='0'
/>
+ * <xs:any namespace='##other' processContents='lax'
minOccurs='0' maxOccurs='unbounded' />
+ * </pre>
+ *
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class RequestSecurityToken implements BaseRequestSecurityToken
+{
+
+ private final RequestSecurityTokenType delegate;
+
+ private URI tokenType;
+
+ private URI requestType;
+
+ private AppliesTo appliesTo;
+
+ private ClaimsType claims;
+
+ private EntropyType entropy;
+
+ private LifetimeType lifetime;
+
+ private AllowPostdatingType allowPostDating;
+
+ private RenewingType renewing;
+
+ private OnBehalfOfType onBehalfOf;
+
+ private EndpointReferenceType issuer;
+
+ private URI authenticationType;
+
+ private URI keyType;
+
+ private long keySize;
+
+ private URI signatureAlgorithm;
+
+ private EncryptionType encryption;
+
+ private URI encryptionAlgorithm;
+
+ private URI canonicalizationAlgorithm;
+
+ private ProofEncryptionType proofEncryption;
+
+ private UseKeyType useKey;
+
+ private URI signWith;
+
+ private URI encryptWith;
+
+ private DelegateToType delegateTo;
+
+ private boolean forwardable;
+
+ private boolean delegatable;
+
+ private Policy policy;
+
+ private PolicyReference policyReference;
+
+ private final List<Object> extensionElements = new ArrayList<Object>();
+
+ private final ObjectFactory factory = new ObjectFactory();
+
+ /**
+ * <p>
+ * Creates an instance of {@code RequestSecurityToken}.
+ * </p>
+ */
+ public RequestSecurityToken()
+ {
+ this.delegate = new RequestSecurityTokenType();
+ }
+
+ /**
+ * <p>
+ * Creates an instance of {@code RequestSecurityToken} using the specified delegate.
+ * </p>
+ *
+ * @param delegate the JAXB {@code RequestSecurityTokenType} that represents a
WS-Trust token request.
+ */
+ public RequestSecurityToken(RequestSecurityTokenType delegate)
+ {
+ this.delegate = delegate;
+ // parse the delegate's Any contents.
+ try
+ {
+ for (Object obj : this.delegate.getAny())
+ {
+ if (obj instanceof AppliesTo)
+ {
+ this.appliesTo = (AppliesTo) obj;
+ }
+ else if (obj instanceof Policy)
+ {
+ this.policy = (Policy) obj;
+ }
+ else if (obj instanceof PolicyReference)
+ {
+ this.policyReference = (PolicyReference) obj;
+ }
+ else if (obj instanceof JAXBElement)
+ {
+ JAXBElement<?> element = (JAXBElement<?>) obj;
+ String localName = element.getName().getLocalPart();
+ if (localName.equalsIgnoreCase("TokenType"))
+ this.tokenType = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("RequestType"))
+ this.requestType = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("Claims"))
+ this.claims = (ClaimsType) element.getValue();
+ else if (localName.equalsIgnoreCase("Entropy"))
+ this.entropy = (EntropyType) element.getValue();
+ else if (localName.equalsIgnoreCase("Lifetime"))
+ this.lifetime = (LifetimeType) element.getValue();
+ else if (localName.equalsIgnoreCase("AllowPostdating"))
+ this.allowPostDating = (AllowPostdatingType) element.getValue();
+ else if (localName.equalsIgnoreCase("Renewing"))
+ this.renewing = (RenewingType) element.getValue();
+ else if (localName.equalsIgnoreCase("OnBehalfOf"))
+ this.onBehalfOf = (OnBehalfOfType) element.getValue();
+ else if (localName.equalsIgnoreCase("Issuer"))
+ this.issuer = (EndpointReferenceType) element.getValue();
+ else if (localName.equalsIgnoreCase("AuthenticationType"))
+ this.authenticationType = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("KeyType"))
+ this.keyType = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("KeySize"))
+ this.keySize = (Long) element.getValue();
+ else if (localName.equalsIgnoreCase("SignatureAlgorithm"))
+ this.signatureAlgorithm = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("Encryption"))
+ this.encryption = (EncryptionType) element.getValue();
+ else if (localName.equalsIgnoreCase("EntropyAlgorithm"))
+ this.encryptionAlgorithm = new URI((String) element.getValue());
+ else if
(localName.equalsIgnoreCase("CanonicalizationAlgorithm"))
+ this.canonicalizationAlgorithm = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("ProofEncryption"))
+ this.proofEncryption = (ProofEncryptionType) element.getValue();
+ else if (localName.equalsIgnoreCase("UseKey"))
+ this.useKey = (UseKeyType) element.getValue();
+ else if (localName.equalsIgnoreCase("SignWith"))
+ this.signWith = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("EncryptWith"))
+ this.encryptWith = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("DelegateTo"))
+ this.delegateTo = (DelegateToType) element.getValue();
+ else if (localName.equalsIgnoreCase("Forwardable"))
+ this.forwardable = (Boolean) element.getValue();
+ else if (localName.equalsIgnoreCase("Delegatable"))
+ this.delegatable = (Boolean) element.getValue();
+ else
+ this.extensionElements.add(element.getValue());
+ }
+ else
+ {
+ this.extensionElements.add(obj);
+ }
+ }
+ }
+ catch (URISyntaxException e)
+ {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code URI} that identifies the token type.
+ * </p>
+ *
+ * @return a {@code URI} that represents the token type.
+ */
+ public URI getTokenType()
+ {
+ return tokenType;
+ }
+
+ /**
+ * <p>
+ * Sets the token type.
+ * </p>
+ *
+ * @param tokenType a {@code URI} that identifies the token type.
+ */
+ public void setTokenType(URI tokenType)
+ {
+ this.tokenType = tokenType;
+ this.delegate.getAny().add(this.factory.createTokenType(tokenType.toString()));
+
+ }
+
+ /**
+ * <p>
+ * Obtains the request type.
+ * </p>
+ *
+ * @return a {@code URI} that identifies the request type.
+ */
+ public URI getRequestType()
+ {
+ return requestType;
+ }
+
+ /**
+ * <p>
+ * Sets the request type. The type must be one of the request types described in the
WS-Trust specification.
+ * </p>
+ *
+ * @param requestType a {@code URI} that identifies the request type.
+ */
+ public void setRequestType(URI requestType)
+ {
+ this.requestType = requestType;
+
this.delegate.getAny().add(this.factory.createRequestType(requestType.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code AppliesTo} value of this request. The {@code AppliesTo} object
identifies the service provider
+ * (web service) that requires a token to be presented by clients. A STS uses this
object to find the type of the
+ * token that is accepted by the service provider so that it can issue appropriate
tokens to clients.
+ * </p>
+ *
+ * @return the reference to the {@code AppliesTo} object.
+ */
+ public AppliesTo getAppliesTo()
+ {
+ return appliesTo;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code AppliesTo} value of this request. The {@code AppliesTo} object
identifies the service provider
+ * (web service) that requires a token to be presented by clients. A STS uses this
object to find the type of the
+ * token that is accepted by the service provider so that it can issue appropriate
tokens to clients.
+ * </p>
+ *
+ * @param appliesTo a reference to the {@code AppliesTo} object that identifies the
service provider.
+ */
+ public void setAppliesTo(AppliesTo appliesTo)
+ {
+ this.appliesTo = appliesTo;
+ this.delegate.getAny().add(appliesTo);
+ }
+
+ /**
+ * <p>
+ * Obtains the set of claims of this request.
+ * </p>
+ *
+ * @return a reference to the {@code ClaimsType} object that represents the
request's claims.
+ */
+ public ClaimsType getClaims()
+ {
+ return claims;
+ }
+
+ /**
+ * <p>
+ * Sets the claims of this request.
+ * </p>
+ *
+ * @param claims the {@code ClaimsType} object that represents the claims to be set.
+ */
+ public void setClaims(ClaimsType claims)
+ {
+ this.claims = claims;
+ this.delegate.getAny().add(this.factory.createClaims(claims));
+ }
+
+ /**
+ * <p>
+ * Obtains the entropy that will be used in creating the key.
+ * </p>
+ *
+ * @return a reference to the {@code EntropyType} that represents the entropy.
+ */
+ public EntropyType getEntropy()
+ {
+ return entropy;
+ }
+
+ /**
+ * <p>
+ * Sets the entropy that must be used when creating the key.
+ * </p>
+ *
+ * @param entropy the {@code EntropyType} representing the entropy to be set.
+ */
+ public void setEntropy(EntropyType entropy)
+ {
+ this.entropy = entropy;
+ this.delegate.getAny().add(this.factory.createEntropy(entropy));
+ }
+
+ /**
+ * <p>
+ * Obtains the desired lifetime of the requested token.
+ * </p>
+ *
+ * @return a reference to the {@code LifetimeType} that represents the lifetime.
+ */
+ public LifetimeType getLifetime()
+ {
+ return lifetime;
+ }
+
+ /**
+ * <p>
+ * Sets the desired lifetime of the requested token.
+ * </p>
+ *
+ * @param lifetime the {@code LifetimeType} object representing the lifetime to be
set.
+ */
+ public void setLifetime(LifetimeType lifetime)
+ {
+ this.lifetime = lifetime;
+ this.delegate.getAny().add(this.factory.createLifetime(lifetime));
+ }
+
+ /**
+ * <p>
+ * Checks whether a request for a postdated token should be allowed or not.
+ * </p>
+ *
+ * @return {@code null} if the token can't have a future lifetime (e.g. a token to
be used the next day); a
+ * {@code AllowPostdatingType} otherwise.
+ */
+ public AllowPostdatingType getAllowPostDating()
+ {
+ return allowPostDating;
+ }
+
+ /**
+ * <p>
+ * Specifies whether a request for a postdated token should be allowed or not.
+ * </p>
+ *
+ * @param allowPostDating {@code null} if the token can't have a future lifetime
(e.g. a token to be used the next
+ * day); a {@code AllowPostdatingType} otherwise.
+ */
+ public void setAllowPostDating(AllowPostdatingType allowPostDating)
+ {
+ this.allowPostDating = allowPostDating;
+ this.delegate.getAny().add(this.factory.createAllowPostdating(allowPostDating));
+ }
+
+ /**
+ * <p>
+ * Obtains the renew semantics for this request.
+ * </p>
+ *
+ * @return a reference to the {@code RenewingType} that represents the renew semantics
for this request.
+ */
+ public RenewingType getRenewing()
+ {
+ return renewing;
+ }
+
+ /**
+ * <p>
+ * Sets the renew semantics for this request.
+ * </p>
+ *
+ * @param renewing the {@code RenewingType} object representing the semantics to be
set.
+ */
+ public void setRenewing(RenewingType renewing)
+ {
+ this.renewing = renewing;
+ this.delegate.getAny().add(this.factory.createRenewing(renewing));
+ }
+
+ /**
+ * <p>
+ * Obtains the identity on whose behalf this request was made.
+ * </p>
+ *
+ * @return a reference to the {@code OnBehalfOfType} that represents the identity on
whose behalf this request was
+ * made.
+ */
+ public OnBehalfOfType getOnBehalfOf()
+ {
+ return onBehalfOf;
+ }
+
+ /**
+ * <p>
+ * Specifies the identity on whose behalf this request is being made.
+ * </p>
+ *
+ * @param onBehalfOf the {@code OnBehalfOfType} object representing the identity to be
set.
+ */
+ public void setOnBehalfOf(OnBehalfOfType onBehalfOf)
+ {
+ this.onBehalfOf = onBehalfOf;
+ this.delegate.getAny().add(this.factory.createOnBehalfOf(onBehalfOf));
+ }
+
+ /**
+ * <p>
+ * Obtains the issuer of the token included in the request in the scenarios where the
requestor is obtaining a token
+ * on behalf of another party.
+ * </p>
+ *
+ * @return a reference to the {@code EndpointReferenceType} that represents the
issuer.
+ */
+ public EndpointReferenceType getIssuer()
+ {
+ return this.issuer;
+ }
+
+ /**
+ * <p>
+ * Sets the issuer of the token included in the request in scenarios where the
requestor is obtaining a token on
+ * behalf of another party.
+ * </p>
+ *
+ * @param issuer the {@code EndpointReferenceType} object representing the issuer to
be set.
+ */
+ public void setIssuer(EndpointReferenceType issuer)
+ {
+ this.issuer = issuer;
+ this.delegate.getAny().add(this.factory.createIssuer(issuer));
+ }
+
+ /**
+ * <p>
+ * Obtains the type of authentication that has been set as part of the request.
+ * </p>
+ *
+ * @return a {@code URI} that identifies the desired authentication type.
+ */
+ public URI getAuthenticationType()
+ {
+ return authenticationType;
+ }
+
+ /**
+ * <p>
+ * Sets the authentication type in the request.
+ * </p>
+ *
+ * @param authenticationType a {@code URI} that identifies the authentication type to
be set.
+ */
+ public void setAuthenticationType(URI authenticationType)
+ {
+ this.authenticationType = authenticationType;
+
this.delegate.getAny().add(this.factory.createAuthenticationType(authenticationType.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the type of the key that has been set in the request.
+ * </p>
+ *
+ * @return a {@code URI} that identifies the key type.
+ */
+ public URI getKeyType()
+ {
+ return keyType;
+ }
+
+ /**
+ * <p>
+ * Sets the key type in the request.
+ * </p>
+ *
+ * @param keyType a {@code URI} that specifies the key type.
+ */
+ public void setKeyType(URI keyType)
+ {
+ this.keyType = keyType;
+ this.delegate.getAny().add(this.factory.createKeyType(keyType.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the size of they key that has been set in the request.
+ * </p>
+ *
+ * @return a {@code long} representing the key size in bytes.
+ */
+ public long getKeySize()
+ {
+ return keySize;
+ }
+
+ /**
+ * <p>
+ * Sets the size of the key in the request.
+ * </p>
+ *
+ * @param keySize a {@code long} representing the key size in bytes.
+ */
+ public void setKeySize(long keySize)
+ {
+ this.keySize = keySize;
+ this.delegate.getAny().add(this.factory.createKeySize(keySize));
+ }
+
+ /**
+ * <p>
+ * Obtains the signature algorithm that has been set in the request.
+ * </p>
+ *
+ * @return a {@code URI} that represents the signature algorithm.
+ */
+ public URI getSignatureAlgorithm()
+ {
+ return signatureAlgorithm;
+ }
+
+ /**
+ * <p>
+ * Sets the signature algorithm in the request.
+ * </p>
+ *
+ * @param signatureAlgorithm a {@code URI} that represents the algorithm to be set.
+ */
+ public void setSignatureAlgorithm(URI signatureAlgorithm)
+ {
+ this.signatureAlgorithm = signatureAlgorithm;
+
this.delegate.getAny().add(this.factory.createSignatureAlgorithm(signatureAlgorithm.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code Encryption} section of the request. The {@code Encryption}
element indicates that the requestor
+ * desires any returned secrets in issued security tokens to be encrypted.
+ * </p>
+ *
+ * @return a reference to the {@code EncryptionType} object.
+ */
+ public EncryptionType getEncryption()
+ {
+ return encryption;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code Encryption} section of the request. The {@code Encryption} element
indicates that the requestor
+ * desires any returned secrets in issued security tokens to be encrypted.
+ * </p>
+ *
+ * @param encryption the {@code EncryptionType} to be set.
+ */
+ public void setEncryption(EncryptionType encryption)
+ {
+ this.encryption = encryption;
+ this.delegate.getAny().add(this.factory.createEncryption(encryption));
+ }
+
+ /**
+ * <p>
+ * Obtains the encryption algorithm that has been set in the request.
+ * </p>
+ *
+ * @return a {@code URI} that represents the encryption algorithm.
+ */
+ public URI getEncryptionAlgorithm()
+ {
+ return encryptionAlgorithm;
+ }
+
+ /**
+ * <p>
+ * Sets the encryption algorithm in the request.
+ * </p>
+ *
+ * @param encryptionAlgorithm a {@code URI} that represents the encryption algorithm
to be set.
+ */
+ public void setEncryptionAlgorithm(URI encryptionAlgorithm)
+ {
+ this.encryptionAlgorithm = encryptionAlgorithm;
+
this.delegate.getAny().add(this.factory.createEncryptionAlgorithm(encryptionAlgorithm.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the canonicalization algorithm that has been set in the request.
+ * </p>
+ *
+ * @return a {@code URI} that represents the canonicalization algorithm.
+ */
+ public URI getCanonicalizationAlgorithm()
+ {
+ return canonicalizationAlgorithm;
+ }
+
+ /**
+ * <p>
+ * Sets the canonicalization algorithm in the request.
+ * </p>
+ *
+ * @param canonicalizationAlgorithm a {@code URI} that represents the algorithm to be
set.
+ */
+ public void setCanonicalizationAlgorithm(URI canonicalizationAlgorithm)
+ {
+ this.canonicalizationAlgorithm = canonicalizationAlgorithm;
+
this.delegate.getAny().add(this.factory.createCanonicalizationAlgorithm(canonicalizationAlgorithm.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code ProofEncryption} section of the request. The {@code
ProofEncryption} indicates that the
+ * requestor desires any returned secrets in issued security tokens to be encrypted.
+ * </p>
+ *
+ * @return a reference to the {@code ProofEncryptionType} object.
+ */
+ public ProofEncryptionType getProofEncryption()
+ {
+ return proofEncryption;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code ProofEncryption} section of the request. The {@code
ProofEncryption} indicates that the requestor
+ * desires any returned secrets in issued security tokens to be encrypted.
+ * </p>
+ *
+ * @param proofEncryption the {@code ProofEncryptionType} to be set.
+ */
+ public void setProofEncryption(ProofEncryptionType proofEncryption)
+ {
+ this.proofEncryption = proofEncryption;
+ this.delegate.getAny().add(this.factory.createProofEncryption(proofEncryption));
+ }
+
+ /**
+ * <p>
+ * Obtains the key that should be used in the returned token.
+ * </p>
+ *
+ * @return a reference to the {@code UseKeyType} instance that represents the key to
be used.
+ */
+ public UseKeyType getUseKey()
+ {
+ return useKey;
+ }
+
+ /**
+ * <p>
+ * Sets the key that should be used in the returned token.
+ * </p>
+ *
+ * @param useKey the {@code UseKeyType} instance to be set.
+ */
+ public void setUseKey(UseKeyType useKey)
+ {
+ this.useKey = useKey;
+ this.delegate.getAny().add(this.factory.createUseKey(useKey));
+ }
+
+ /**
+ * <p>
+ * Obtains the signature algorithm that should be used with the issued security
token.
+ * </p>
+ *
+ * @return a {@code URI} representing the algorithm that should be used.
+ */
+ public URI getSignWith()
+ {
+ return signWith;
+ }
+
+ /**
+ * <p>
+ * Sets the signature algorithm that should be used with the issued security token.
+ * </p>
+ *
+ * @param signWith a {@code URI} representing the algorithm to be used.
+ */
+ public void setSignWith(URI signWith)
+ {
+ this.signWith = signWith;
+
this.delegate.getAny().add(this.factory.createSignatureAlgorithm(signWith.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the encryption algorithm that should be used with the issued security
token.
+ * </p>
+ *
+ * @return a {@code URI} representing the encryption algorithm that should be used.
+ */
+ public URI getEncryptWith()
+ {
+ return encryptWith;
+ }
+
+ /**
+ * <p>
+ * Sets the encryption algorithm that should be used with the issued security token.
+ * </p>
+ *
+ * @param encryptWith a {@code URI} representing the algorithm to be used.
+ */
+ public void setEncryptWith(URI encryptWith)
+ {
+ this.encryptWith = encryptWith;
+
this.delegate.getAny().add(this.factory.createEncryptWith(encryptWith.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the identity to which the requested token should be delegated.
+ * </p>
+ *
+ * @return a reference to the {@code DelegateToType} instance that represents the
identity.
+ */
+ public DelegateToType getDelegateTo()
+ {
+ return delegateTo;
+ }
+
+ /**
+ * <p>
+ * Sets the identity to which the requested token should be delegated.
+ * </p>
+ *
+ * @param delegateTo the {@code DelegateToType} object representing the identity to be
set.
+ */
+ public void setDelegateTo(DelegateToType delegateTo)
+ {
+ this.delegateTo = delegateTo;
+ this.delegate.getAny().add(this.factory.createDelegateTo(delegateTo));
+ }
+
+ /**
+ * <p>
+ * Indicates whether the requested token should be marked as "forwardable"
or not. In general, this flag is used when
+ * a token is normally bound to the requestor's machine or service. Using this
flag, the returned token MAY be used
+ * from any source machine so long as the key is correctly proven.
+ * </p>
+ *
+ * @return {@code true} if the requested token should be marked as
"forwardable"; {@code false} otherwise.
+ */
+ public boolean isForwardable()
+ {
+ return forwardable;
+ }
+
+ /**
+ * <p>
+ * Specifies whether the requested token should be marked as "forwardable"
or not. In general, this flag is used when
+ * a token is normally bound to the requestor's machine or service. Using this
flag, the returned token MAY be used
+ * from any source machine so long as the key is correctly proven.
+ * </p>
+ *
+ * @param forwardable {@code true} if the requested token should be marked as
"forwardable"; {@code false} otherwise.
+ */
+ public void setForwardable(boolean forwardable)
+ {
+ this.forwardable = forwardable;
+ this.delegate.getAny().add(this.factory.createForwardable(forwardable));
+ }
+
+ /**
+ * <p>
+ * Indicates whether the requested token should be marked as "delegatable"
or not. Using this flag, the returned
+ * token MAY be delegated to another party.
+ * </p>
+ *
+ * @return {@code true} if the requested token should be marked as
"delegatable"; {@code false} otherwise.
+ */
+ public boolean isDelegatable()
+ {
+ return delegatable;
+ }
+
+ /**
+ * <p>
+ * Specifies whether the requested token should be marked as "delegatable"
or not. Using this flag, the returned
+ * token MAY be delegated to another party.
+ * </p>
+ *
+ * @param delegatable {@code true} if the requested token should be marked as
"delegatable"; {@code false} otherwise.
+ */
+ public void setDelegatable(boolean delegatable)
+ {
+ this.delegatable = delegatable;
+ this.delegate.getAny().add(this.factory.createDelegatable(delegatable));
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code Policy} associated with the request. The policy specifies
defaults that can be overridden by
+ * the previous properties.
+ * </p>
+ *
+ * @return a reference to the {@code Policy} that has been set in the request.
+ */
+ public Policy getPolicy()
+ {
+ return policy;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code Policy} in the request. The policy specifies defaults that can be
overridden by
+ * the previous properties.
+ * </p>
+ *
+ * @param policy the {@code Policy} instance to be set.
+ */
+ public void setPolicy(Policy policy)
+ {
+ this.policy = policy;
+ this.delegate.getAny().add(policy);
+ }
+
+ /**
+ * <p>
+ * Obtains the reference to the {@code Policy} that should be used.
+ * </p>
+ *
+ * @return a {@code PolicyReference} that specifies where the {@code Policy} can be
found.
+ */
+ public PolicyReference getPolicyReference()
+ {
+ return policyReference;
+ }
+
+ /**
+ * <p>
+ * Sets the reference to the {@code Policy} that should be used.
+ * </p>
+ *
+ * @param policyReference the {@code PolicyReference} object to be set.
+ */
+ public void setPolicyReference(PolicyReference policyReference)
+ {
+ this.policyReference = policyReference;
+ this.delegate.getAny().add(policyReference);
+ }
+
+ /**
+ * <p>
+ * Obtains the list of request elements that are not part of the standard content
model.
+ * </p>
+ *
+ * @return a {@code List<Object>} containing the extension elements.
+ */
+ public List<Object> getExtensionElements()
+ {
+ return Collections.unmodifiableList(this.extensionElements);
+ }
+
+ /**
+ * <p>
+ * Obtains the request context.
+ * </p>
+ *
+ * @return a {@code String} that identifies the request.
+ */
+ public String getContext()
+ {
+ return this.delegate.getContext();
+ }
+
+ /**
+ * <p>
+ * Sets the request context.
+ * </p>
+ *
+ * @param context a {@code String} that identifies the request.
+ */
+ public void setContext(String context)
+ {
+ this.delegate.setContext(context);
+ }
+
+ /**
+ * <p>
+ * Obtains a map that contains attributes that aren't bound to any typed property
on the request. This is a live
+ * reference, so attributes can be added/changed/removed directly. For this reason,
there is no setter method.
+ * </p>
+ *
+ * @return a {@code Map<QName, String>} that contains the attributes.
+ */
+ public Map<QName, String> getOtherAttributes()
+ {
+ return this.delegate.getOtherAttributes();
+ }
+
+ /**
+ * <p>
+ * Gets a reference to the list that holds all request element values.
+ * </p>
+ *
+ * @return a {@code List<Object>} containing all values specified in the
request.
+ */
+ public List<Object> getAny()
+ {
+ return this.delegate.getAny();
+ }
+
+ /**
+ * <p>
+ * Obtains a reference to the {@code RequestSecurityTokenType} delegate.
+ * </p>
+ *
+ * @return a reference to the delegate instance.
+ */
+ public RequestSecurityTokenType getDelegate()
+ {
+ return this.delegate;
+ }
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenCollection.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenCollection.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenCollection.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,122 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust.protocol;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.identity.federation.ws.trust.RequestSecurityTokenCollectionType;
+import org.jboss.identity.federation.ws.trust.RequestSecurityTokenType;
+
+/**
+ * <p>
+ * This class represents a WS-Trust {@code RequestSecurityTokenCollection}. It wraps the
JAXB representation of the
+ * security token collection request.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class RequestSecurityTokenCollection implements BaseRequestSecurityToken
+{
+
+ private final RequestSecurityTokenCollectionType delegate;
+
+ private final List<RequestSecurityToken> requestSecurityTokens;
+
+ /**
+ * <p>
+ * Creates an instance of {@code RequestSecurityTokenCollection}.
+ * </p>
+ */
+ public RequestSecurityTokenCollection()
+ {
+ this.requestSecurityTokens = new ArrayList<RequestSecurityToken>();
+ this.delegate = new RequestSecurityTokenCollectionType();
+ }
+
+ /**
+ * <p>
+ * Creates an instance of {@code RequestSecurityTokenCollection} using the specified
delegate.
+ * </p>
+ *
+ * @param delegate the JAXB {@code RequestSecurityTokenCollectionType} that represents
a WS-Trust request collection.
+ */
+ public RequestSecurityTokenCollection(RequestSecurityTokenCollectionType delegate)
+ {
+ this.delegate = delegate;
+ this.requestSecurityTokens = new ArrayList<RequestSecurityToken>();
+ for (RequestSecurityTokenType request : delegate.getRequestSecurityToken())
+ this.requestSecurityTokens.add(new RequestSecurityToken(request));
+ }
+
+ /**
+ * <p>
+ * Obtains the collection of {@code RequestSecurityToken} objects. The returned
collection is immutable, so addition
+ * or removal of requests must be carried by the appropriate add/remove methods.
+ * </p>
+ *
+ * @return a {@code List<RequestSecurityToken>} containing the token requests.
+ */
+ public List<RequestSecurityToken> getRequestSecurityTokens()
+ {
+ return Collections.unmodifiableList(this.requestSecurityTokens);
+ }
+
+ /**
+ * <p>
+ * Adds the specified {@code RequestSecurityToken} object to the collection of token
requests.
+ * </p>
+ *
+ * @param request the {@code RequestSecurityToken} to be added.
+ */
+ public void addRequestSecurityToken(RequestSecurityToken request)
+ {
+ this.delegate.getRequestSecurityToken().add(request.getDelegate());
+ this.requestSecurityTokens.add(request);
+ }
+
+ /**
+ * <p>
+ * Removes the specified {@code RequestSecurityToken} object from the collection of
token requests.
+ * </p>
+ *
+ * @param request the {@code RequestSecurityToken} to be removed.
+ */
+ public void removeRequestSecurityToken(RequestSecurityToken request)
+ {
+ this.delegate.getRequestSecurityToken().remove(request.getDelegate());
+ this.requestSecurityTokens.remove(request);
+ }
+
+ /**
+ * <p>
+ * Obtains a reference to the {@code RequestSecurityTokenCollectionType} delegate.
+ * </p>
+ *
+ * @return a reference to the delegate instance.
+ */
+ public RequestSecurityTokenCollectionType getDelegate()
+ {
+ return this.delegate;
+ }
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenResponse.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenResponse.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenResponse.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,1159 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust.protocol;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import org.jboss.identity.federation.ws.addressing.EndpointReferenceType;
+import org.jboss.identity.federation.ws.policy.AppliesTo;
+import org.jboss.identity.federation.ws.policy.Policy;
+import org.jboss.identity.federation.ws.policy.PolicyReference;
+import org.jboss.identity.federation.ws.trust.AllowPostdatingType;
+import org.jboss.identity.federation.ws.trust.AuthenticatorType;
+import org.jboss.identity.federation.ws.trust.DelegateToType;
+import org.jboss.identity.federation.ws.trust.EncryptionType;
+import org.jboss.identity.federation.ws.trust.EntropyType;
+import org.jboss.identity.federation.ws.trust.LifetimeType;
+import org.jboss.identity.federation.ws.trust.ObjectFactory;
+import org.jboss.identity.federation.ws.trust.OnBehalfOfType;
+import org.jboss.identity.federation.ws.trust.ProofEncryptionType;
+import org.jboss.identity.federation.ws.trust.RenewingType;
+import org.jboss.identity.federation.ws.trust.RequestSecurityTokenResponseType;
+import org.jboss.identity.federation.ws.trust.RequestedProofTokenType;
+import org.jboss.identity.federation.ws.trust.RequestedReferenceType;
+import org.jboss.identity.federation.ws.trust.RequestedSecurityTokenType;
+import org.jboss.identity.federation.ws.trust.StatusType;
+import org.jboss.identity.federation.ws.trust.UseKeyType;
+
+/**
+ * <p>
+ * This class represents a WS-Trust {@code RequestSecurityTokenResponse}. It wraps the
JAXB representation of the
+ * security token response and offers a series of getter/setter methods that make it easy
to work with elements that are
+ * represented by the {@code Any} XML type.
+ * </p>
+ * <p>
+ * The following shows the intended content model of a {@code
RequestSecurityTokenResponse}:
+ *
+ * <pre>
+ * <xs:element ref='wst:TokenType' minOccurs='0' />
+ * <xs:element ref='wst:RequestType' />
+ * <xs:element ref='wst:RequestedSecurityToken' minOccurs='0'
/>
+ * <xs:element ref='wsp:AppliesTo' minOccurs='0' />
+ * <xs:element ref='wst:RequestedAttachedReference'
minOccurs='0' />
+ * <xs:element ref='wst:RequestedUnattachedReference'
minOccurs='0' />
+ * <xs:element ref='wst:RequestedProofToken' minOccurs='0'
/>
+ * <xs:element ref='wst:Entropy' minOccurs='0' />
+ * <xs:element ref='wst:Lifetime' minOccurs='0' />
+ * <xs:element ref='wst:Status' minOccurs='0' />
+ * <xs:element ref='wst:AllowPostdating' minOccurs='0'
/>
+ * <xs:element ref='wst:Renewing' minOccurs='0' />
+ * <xs:element ref='wst:OnBehalfOf' minOccurs='0' />
+ * <xs:element ref='wst:Issuer' minOccurs='0' />
+ * <xs:element ref='wst:AuthenticationType' minOccurs='0'
/>
+ * <xs:element ref='wst:Authenticator' minOccurs='0' />
+ * <xs:element ref='wst:KeyType' minOccurs='0' />
+ * <xs:element ref='wst:KeySize' minOccurs='0' />
+ * <xs:element ref='wst:SignatureAlgorithm' minOccurs='0'
/>
+ * <xs:element ref='wst:Encryption' minOccurs='0' />
+ * <xs:element ref='wst:EncryptionAlgorithm' minOccurs='0'
/>
+ * <xs:element ref='wst:CanonicalizationAlgorithm'
minOccurs='0' />
+ * <xs:element ref='wst:ProofEncryption' minOccurs='0'
/>
+ * <xs:element ref='wst:UseKey' minOccurs='0' />
+ * <xs:element ref='wst:SignWith' minOccurs='0' />
+ * <xs:element ref='wst:EncryptWith' minOccurs='0' />
+ * <xs:element ref='wst:DelegateTo' minOccurs='0' />
+ * <xs:element ref='wst:Forwardable' minOccurs='0' />
+ * <xs:element ref='wst:Delegatable' minOccurs='0' />
+ * <xs:element ref='wsp:Policy' minOccurs='0' />
+ * <xs:element ref='wsp:PolicyReference' minOccurs='0'
/>
+ * <xs:any namespace='##other' processContents='lax'
minOccurs='0' maxOccurs='unbounded' />
+ * </pre>
+ *
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class RequestSecurityTokenResponse implements BaseRequestSecurityTokenResponse
+{
+
+ private final RequestSecurityTokenResponseType delegate;
+
+ private URI tokenType;
+
+ private URI requestType;
+
+ private RequestedSecurityTokenType requestedSecurityToken;
+
+ private AppliesTo appliesTo;
+
+ private RequestedReferenceType requestedAttachedReference;
+
+ private RequestedReferenceType requestedUnattachedReference;
+
+ private RequestedProofTokenType requestedProofToken;
+
+ private EntropyType entropy;
+
+ private LifetimeType lifetime;
+
+ private StatusType status;
+
+ private AllowPostdatingType allowPostDating;
+
+ private RenewingType renewing;
+
+ private OnBehalfOfType onBehalfOf;
+
+ private EndpointReferenceType issuer;
+
+ private URI authenticationType;
+
+ private AuthenticatorType authenticator;
+
+ private URI keyType;
+
+ private long keySize;
+
+ private URI signatureAlgorithm;
+
+ private EncryptionType encryption;
+
+ private URI encryptionAlgorithm;
+
+ private URI canonicalizationAlgorithm;
+
+ private ProofEncryptionType proofEncryption;
+
+ private UseKeyType useKey;
+
+ private URI signWith;
+
+ private URI encryptWith;
+
+ private DelegateToType delegateTo;
+
+ private boolean forwardable;
+
+ private boolean delegatable;
+
+ private Policy policy;
+
+ private PolicyReference policyReference;
+
+ private final List<Object> extensionElements = new ArrayList<Object>();
+
+ private final ObjectFactory factory = new ObjectFactory();
+
+ /**
+ * <p>
+ * Creates an instance of {@code RequestSecurityTokenResponse}.
+ * </p>
+ */
+ public RequestSecurityTokenResponse()
+ {
+ this.delegate = new RequestSecurityTokenResponseType();
+ }
+
+ /**
+ * <p>
+ * Creates an instance of {@code RequestSecurityTokenResponse} using the specified
delegate.
+ * </p>
+ *
+ * @param delegate the JAXB {@code RequestSecurityTokenResponseType} that represents a
WS-Trust response.
+ */
+ public RequestSecurityTokenResponse(RequestSecurityTokenResponseType delegate)
+ {
+ this.delegate = delegate;
+ // parse the delegate's Any contents.
+ try
+ {
+ for (Object obj : this.delegate.getAny())
+ {
+ if (obj instanceof AppliesTo)
+ {
+ this.appliesTo = (AppliesTo) obj;
+ }
+ else if (obj instanceof Policy)
+ {
+ this.policy = (Policy) obj;
+ }
+ else if (obj instanceof PolicyReference)
+ {
+ this.policyReference = (PolicyReference) obj;
+ }
+ else if (obj instanceof JAXBElement)
+ {
+ JAXBElement<?> element = (JAXBElement<?>) obj;
+ String localName = element.getName().getLocalPart();
+ if (localName.equalsIgnoreCase("TokenType"))
+ this.tokenType = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("RequestType"))
+ this.requestType = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("RequestedSecurityToken"))
+ this.requestedSecurityToken = (RequestedSecurityTokenType)
element.getValue();
+ else if
(localName.equalsIgnoreCase("RequestedAttachedReference"))
+ this.requestedAttachedReference = (RequestedReferenceType)
element.getValue();
+ else if
(localName.equalsIgnoreCase("RequestedUnattachedReference"))
+ this.requestedUnattachedReference = (RequestedReferenceType)
element.getValue();
+ else if (localName.equalsIgnoreCase("RequestedProofToken"))
+ this.requestedProofToken = (RequestedProofTokenType)
element.getValue();
+ else if (localName.equalsIgnoreCase("Entropy"))
+ this.entropy = (EntropyType) element.getValue();
+ else if (localName.equalsIgnoreCase("Lifetime"))
+ this.lifetime = (LifetimeType) element.getValue();
+ else if (localName.equalsIgnoreCase("Status"))
+ this.status = (StatusType) element.getValue();
+ else if (localName.equalsIgnoreCase("AllowPostdating"))
+ this.allowPostDating = (AllowPostdatingType) element.getValue();
+ else if (localName.equalsIgnoreCase("Renewing"))
+ this.renewing = (RenewingType) element.getValue();
+ else if (localName.equalsIgnoreCase("OnBehalfOf"))
+ this.onBehalfOf = (OnBehalfOfType) element.getValue();
+ else if (localName.equalsIgnoreCase("Issuer"))
+ this.issuer = (EndpointReferenceType) element.getValue();
+ else if (localName.equalsIgnoreCase("AuthenticationType"))
+ this.authenticationType = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("Authenticator"))
+ this.authenticator = (AuthenticatorType) element.getValue();
+ else if (localName.equalsIgnoreCase("KeyType"))
+ this.keyType = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("KeySize"))
+ this.keySize = (Long) element.getValue();
+ else if (localName.equalsIgnoreCase("SignatureAlgorithm"))
+ this.signatureAlgorithm = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("Encryption"))
+ this.encryption = (EncryptionType) element.getValue();
+ else if (localName.equalsIgnoreCase("EntropyAlgorithm"))
+ this.encryptionAlgorithm = new URI((String) element.getValue());
+ else if
(localName.equalsIgnoreCase("CanonicalizationAlgorithm"))
+ this.canonicalizationAlgorithm = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("ProofEncryption"))
+ this.proofEncryption = (ProofEncryptionType) element.getValue();
+ else if (localName.equalsIgnoreCase("UseKey"))
+ this.useKey = (UseKeyType) element.getValue();
+ else if (localName.equalsIgnoreCase("SignWith"))
+ this.signWith = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("EncryptWith"))
+ this.encryptWith = new URI((String) element.getValue());
+ else if (localName.equalsIgnoreCase("DelegateTo"))
+ this.delegateTo = (DelegateToType) element.getValue();
+ else if (localName.equalsIgnoreCase("Forwardable"))
+ this.forwardable = (Boolean) element.getValue();
+ else if (localName.equalsIgnoreCase("Delegatable"))
+ this.delegatable = (Boolean) element.getValue();
+ else
+ this.extensionElements.add(element.getValue());
+ }
+ else
+ {
+ this.extensionElements.add(obj);
+ }
+ }
+ }
+ catch (URISyntaxException e)
+ {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code URI} that identifies the token type.
+ * </p>
+ *
+ * @return a {@code URI} that represents the token type.
+ */
+ public URI getTokenType()
+ {
+ return tokenType;
+ }
+
+ /**
+ * <p>
+ * Sets the token type.
+ * </p>
+ *
+ * @param tokenType a {@code URI} that identifies the token type.
+ */
+ public void setTokenType(URI tokenType)
+ {
+ this.tokenType = tokenType;
+ this.delegate.getAny().add(this.factory.createTokenType(tokenType.toString()));
+
+ }
+
+ /**
+ * <p>
+ * Obtains the request type.
+ * </p>
+ *
+ * @return a {@code URI} that identifies the request type.
+ */
+ public URI getRequestType()
+ {
+ return requestType;
+ }
+
+ /**
+ * <p>
+ * Sets the request type. The type must be one of the request types described in the
WS-Trust specification.
+ * </p>
+ *
+ * @param requestType a {@code URI} that identifies the request type.
+ */
+ public void setRequestType(URI requestType)
+ {
+ this.requestType = requestType;
+
this.delegate.getAny().add(this.factory.createRequestType(requestType.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the requested security token that has been set in the response.
+ * </p>
+ *
+ * @return a reference to the {@code RequestedSecurityTokenType} that contains the
token.
+ */
+ public RequestedSecurityTokenType getRequestedSecurityToken()
+ {
+ return requestedSecurityToken;
+ }
+
+ /**
+ * <p>
+ * Sets the requested security token in the response.
+ * </p>
+ *
+ * @param requestedSecurityToken the {@code RequestedSecurityTokenType} instance to be
set.
+ */
+ public void setRequestedSecurityToken(RequestedSecurityTokenType
requestedSecurityToken)
+ {
+ this.requestedSecurityToken = requestedSecurityToken;
+
this.delegate.getAny().add(this.factory.createRequestedSecurityToken(requestedSecurityToken));
+ }
+
+ /**
+ * <p>
+ * Obtains the scope to which the security token applies.
+ * </p>
+ *
+ * @return a reference to the {@code AppliesTo} instance that represents the token
scope.
+ */
+ public AppliesTo getAppliesTo()
+ {
+ return appliesTo;
+ }
+
+ /**
+ * <p>
+ * Sets the scope to which the security token applies.
+ * </p>
+ *
+ * @param appliesTo a reference to the {@code AppliesTo} object that represents the
scope to be set.
+ */
+ public void setAppliesTo(AppliesTo appliesTo)
+ {
+ this.appliesTo = appliesTo;
+ this.delegate.getAny().add(appliesTo);
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code RequestedAttachedReference} that indicate how to reference the
returned token when that token
+ * doesn't support references using URI fragments (XML ID).
+ * </p>
+ *
+ * @return a {@code RequestedReferenceType} that represents the token reference.
+ */
+ public RequestedReferenceType getRequestedAttachedReference()
+ {
+ return requestedAttachedReference;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code RequestedAttachedReference} that indicate how to reference the
returned token when that token
+ * doesn't support references using URI fragments (XML ID).
+ * </p>
+ *
+ * @param requestedAttachedReference the {@code RequestedReferenceType} instance to be
set.
+ */
+ public void setRequestedAttachedReference(RequestedReferenceType
requestedAttachedReference)
+ {
+ this.requestedAttachedReference = requestedAttachedReference;
+
this.delegate.getAny().add(this.factory.createRequestedAttachedReference(requestedAttachedReference));
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code RequestedUnattachedReference} that specifies to indicate how to
reference the token when it is
+ * not placed inside the message.
+ * </p>
+ *
+ * @return a {@code RequestedReferenceType} that represents the unattached reference.
+ */
+ public RequestedReferenceType getRequestedUnattachedReference()
+ {
+ return requestedUnattachedReference;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code RequestedUnattachedReference} that specifies to indicate how to
reference the token when it is not
+ * placed inside the message.
+ * </p>
+ *
+ * @param requestedUnattachedReference the {@code RequestedReferenceType} instance to
be set.
+ */
+ public void setRequestedUnattachedReference(RequestedReferenceType
requestedUnattachedReference)
+ {
+ this.requestedUnattachedReference = requestedUnattachedReference;
+
this.delegate.getAny().add(this.factory.createRequestedUnattachedReference(requestedUnattachedReference));
+ }
+
+ /**
+ * <p>
+ * Obtains the proof of possession token that has been set in the response.
+ * </p>
+ *
+ * @return a reference to the {@code RequestedProofTokenType} that contains the
token.
+ */
+ public RequestedProofTokenType getRequestedProofToken()
+ {
+ return requestedProofToken;
+ }
+
+ /**
+ * <p>
+ * Sets the proof of possesion token in the response.
+ * </p>
+ *
+ * @param requestedProofToken the {@code RequestedProofTokenType} instance to be set.
+ */
+ public void setRequestedProofToken(RequestedProofTokenType requestedProofToken)
+ {
+ this.requestedProofToken = requestedProofToken;
+
this.delegate.getAny().add(this.factory.createRequestedProofToken(requestedProofToken));
+ }
+
+ /**
+ * <p>
+ * Obtains the entropy that has been used in creating the key.
+ * </p>
+ *
+ * @return a reference to the {@code EntropyType} that represents the entropy.
+ */
+ public EntropyType getEntropy()
+ {
+ return entropy;
+ }
+
+ /**
+ * <p>
+ * Sets the entropy that has been used in creating the key.
+ * </p>
+ *
+ * @param entropy the {@code EntropyType} representing the entropy to be set.
+ */
+ public void setEntropy(EntropyType entropy)
+ {
+ this.entropy = entropy;
+ this.delegate.getAny().add(this.factory.createEntropy(entropy));
+ }
+
+ /**
+ * <p>
+ * Obtains the lifetime of the security token.
+ * </p>
+ *
+ * @return a reference to the {@code LifetimeType} that represents the lifetime of the
security token.
+ */
+ public LifetimeType getLifetime()
+ {
+ return lifetime;
+ }
+
+ /**
+ * <p>
+ * Sets the lifetime of the security token.
+ * </p>
+ *
+ * @param lifetime the {@code LifetimeType} object representing the lifetime to be
set.
+ */
+ public void setLifetime(LifetimeType lifetime)
+ {
+ this.lifetime = lifetime;
+ this.delegate.getAny().add(this.factory.createLifetime(lifetime));
+ }
+
+ /**
+ * <p>
+ * Obtains the result of a security token validation.
+ * </p>
+ *
+ * @return a referece to the {@code StatusType} instance that represents the status of
the validation.
+ */
+ public StatusType getStatus()
+ {
+ return status;
+ }
+
+ /**
+ * <p>
+ * Sets the result of a security token validation.
+ * </p>
+ *
+ * @param status the {@code StatusType} instance to be set.
+ */
+ public void setStatus(StatusType status)
+ {
+ this.status = status;
+ this.delegate.getAny().add(this.factory.createStatus(status));
+ }
+
+ /**
+ * <p>
+ * Checks whether the returned token is a postdated token or not.
+ * </p>
+ *
+ * @return {@code null} if the token is not postdated; a {@code AllowPostdatingType}
otherwise.
+ */
+ public AllowPostdatingType getAllowPostDating()
+ {
+ return allowPostDating;
+ }
+
+ /**
+ * <p>
+ * Specifies whether the returned token is a postdated token or not.
+ * </p>
+ *
+ * @param allowPostDating {@code null} if the token is not postdated; a {@code
AllowPostdatingType} otherwise.
+ */
+ public void setAllowPostDating(AllowPostdatingType allowPostDating)
+ {
+ this.allowPostDating = allowPostDating;
+ this.delegate.getAny().add(this.factory.createAllowPostdating(allowPostDating));
+ }
+
+ /**
+ * <p>
+ * Obtains the renew semantics for the token request.
+ * </p>
+ *
+ * @return a reference to the {@code RenewingType} that represents the renew semantics
for the request.
+ */
+ public RenewingType getRenewing()
+ {
+ return renewing;
+ }
+
+ /**
+ * <p>
+ * Sets the renew semantics for the token request.
+ * </p>
+ *
+ * @param renewing the {@code RenewingType} object representing the semantics to be
set.
+ */
+ public void setRenewing(RenewingType renewing)
+ {
+ this.renewing = renewing;
+ this.delegate.getAny().add(this.factory.createRenewing(renewing));
+ }
+
+ /**
+ * <p>
+ * Obtains the identity on whose behalf the token request was made.
+ * </p>
+ *
+ * @return a reference to the {@code OnBehalfOfType} that represents the identity on
whose behalf the token request
+ * was made.
+ */
+ public OnBehalfOfType getOnBehalfOf()
+ {
+ return onBehalfOf;
+ }
+
+ /**
+ * <p>
+ * Specifies the identity on whose behalf the token request was made.
+ * </p>
+ *
+ * @param onBehalfOf the {@code OnBehalfOfType} object representing the identity to be
set.
+ */
+ public void setOnBehalfOf(OnBehalfOfType onBehalfOf)
+ {
+ this.onBehalfOf = onBehalfOf;
+ this.delegate.getAny().add(this.factory.createOnBehalfOf(onBehalfOf));
+ }
+
+ /**
+ * <p>
+ * Obtains the issuer of the token included in the request in the scenarios where the
requestor is obtaining a token
+ * on behalf of another party.
+ * </p>
+ *
+ * @return a reference to the {@code EndpointReferenceType} that represents the
issuer.
+ */
+ public EndpointReferenceType getIssuer()
+ {
+ return this.issuer;
+ }
+
+ /**
+ * <p>
+ * Sets the issuer of the token included in the request in scenarios where the
requestor is obtaining a token on
+ * behalf of another party.
+ * </p>
+ *
+ * @param issuer the {@code EndpointReferenceType} object representing the issuer to
be set.
+ */
+ public void setIssuer(EndpointReferenceType issuer)
+ {
+ this.issuer = issuer;
+ this.delegate.getAny().add(this.factory.createIssuer(issuer));
+ }
+
+ /**
+ * <p>
+ * Obtains the type of authentication that is to be conducted.
+ * </p>
+ *
+ * @return a {@code URI} that identifies the authentication type.
+ */
+ public URI getAuthenticationType()
+ {
+ return authenticationType;
+ }
+
+ /**
+ * <p>
+ * Sets the authentication type in the response.
+ * </p>
+ *
+ * @param authenticationType a {@code URI} that identifies the authentication type to
be set.
+ */
+ public void setAuthenticationType(URI authenticationType)
+ {
+ this.authenticationType = authenticationType;
+
this.delegate.getAny().add(this.factory.createAuthenticationType(authenticationType.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the authenticator that must be used in authenticating exchanges.
+ * </p>
+ *
+ * @return a reference to the {@code AuthenticatorType} that represents the
authenticator.
+ */
+ public AuthenticatorType getAuthenticator()
+ {
+ return authenticator;
+ }
+
+ /**
+ * <p>
+ * Sets the authenticator that must be used in authenticating exchanges.
+ * </p>
+ *
+ * @param authenticator the {@code AuthenticatorType} instance to be set.
+ */
+ public void setAuthenticator(AuthenticatorType authenticator)
+ {
+ this.authenticator = authenticator;
+ this.delegate.getAny().add(this.factory.createAuthenticator(authenticator));
+ }
+
+ /**
+ * <p>
+ * Obtains the type of the key that has been set in the response.
+ * </p>
+ *
+ * @return a {@code URI} that identifies the key type.
+ */
+ public URI getKeyType()
+ {
+ return keyType;
+ }
+
+ /**
+ * <p>
+ * Sets the key type in the response.
+ * </p>
+ *
+ * @param keyType a {@code URI} that specifies the key type.
+ */
+ public void setKeyType(URI keyType)
+ {
+ this.keyType = keyType;
+ this.delegate.getAny().add(this.factory.createKeyType(keyType.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the size of they key that has been set in the response.
+ * </p>
+ *
+ * @return a {@code long} representing the key size in bytes.
+ */
+ public long getKeySize()
+ {
+ return keySize;
+ }
+
+ /**
+ * <p>
+ * Sets the size of the key in the response.
+ * </p>
+ *
+ * @param keySize a {@code long} representing the key size in bytes.
+ */
+ public void setKeySize(long keySize)
+ {
+ this.keySize = keySize;
+ this.delegate.getAny().add(this.factory.createKeySize(keySize));
+ }
+
+ /**
+ * <p>
+ * Obtains the signature algorithm that has been set in the response.
+ * </p>
+ *
+ * @return a {@code URI} that represents the signature algorithm.
+ */
+ public URI getSignatureAlgorithm()
+ {
+ return signatureAlgorithm;
+ }
+
+ /**
+ * <p>
+ * Sets the signature algorithm in the response.
+ * </p>
+ *
+ * @param signatureAlgorithm a {@code URI} that represents the algorithm to be set.
+ */
+ public void setSignatureAlgorithm(URI signatureAlgorithm)
+ {
+ this.signatureAlgorithm = signatureAlgorithm;
+
this.delegate.getAny().add(this.factory.createSignatureAlgorithm(signatureAlgorithm.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code Encryption} section of the response. The {@code Encryption}
element indicates that the
+ * requestor desires any returned secrets in issued security tokens to be encrypted.
+ * </p>
+ *
+ * @return a reference to the {@code EncryptionType} object.
+ */
+ public EncryptionType getEncryption()
+ {
+ return encryption;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code Encryption} section of the response. The {@code Encryption} element
indicates that the requestor
+ * desires any returned secrets in issued security tokens to be encrypted.
+ * </p>
+ *
+ * @param encryption the {@code EncryptionType} to be set.
+ */
+ public void setEncryption(EncryptionType encryption)
+ {
+ this.encryption = encryption;
+ this.delegate.getAny().add(this.factory.createEncryption(encryption));
+ }
+
+ /**
+ * <p>
+ * Obtains the encryption algorithm that has been set in the response.
+ * </p>
+ *
+ * @return a {@code URI} that represents the encryption algorithm.
+ */
+ public URI getEncryptionAlgorithm()
+ {
+ return encryptionAlgorithm;
+ }
+
+ /**
+ * <p>
+ * Sets the encryption algorithm in the response.
+ * </p>
+ *
+ * @param encryptionAlgorithm a {@code URI} that represents the encryption algorithm
to be set.
+ */
+ public void setEncryptionAlgorithm(URI encryptionAlgorithm)
+ {
+ this.encryptionAlgorithm = encryptionAlgorithm;
+
this.delegate.getAny().add(this.factory.createEncryptionAlgorithm(encryptionAlgorithm.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the canonicalization algorithm that has been set in the response.
+ * </p>
+ *
+ * @return a {@code URI} that represents the canonicalization algorithm.
+ */
+ public URI getCanonicalizationAlgorithm()
+ {
+ return canonicalizationAlgorithm;
+ }
+
+ /**
+ * <p>
+ * Sets the canonicalization algorithm in the response.
+ * </p>
+ *
+ * @param canonicalizationAlgorithm a {@code URI} that represents the algorithm to be
set.
+ */
+ public void setCanonicalizationAlgorithm(URI canonicalizationAlgorithm)
+ {
+ this.canonicalizationAlgorithm = canonicalizationAlgorithm;
+
this.delegate.getAny().add(this.factory.createCanonicalizationAlgorithm(canonicalizationAlgorithm.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code ProofEncryption} section of the response. The {@code
ProofEncryption} indicates that the
+ * requestor desires any returned secrets in issued security tokens to be encrypted.
+ * </p>
+ *
+ * @return a reference to the {@code ProofEncryptionType} object.
+ */
+ public ProofEncryptionType getProofEncryption()
+ {
+ return proofEncryption;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code ProofEncryption} section of the response. The {@code
ProofEncryption} indicates that the requestor
+ * desires any returned secrets in issued security tokens to be encrypted.
+ * </p>
+ *
+ * @param proofEncryption the {@code ProofEncryptionType} to be set.
+ */
+ public void setProofEncryption(ProofEncryptionType proofEncryption)
+ {
+ this.proofEncryption = proofEncryption;
+ this.delegate.getAny().add(this.factory.createProofEncryption(proofEncryption));
+ }
+
+ /**
+ * <p>
+ * Obtains the key that used in the returned token.
+ * </p>
+ *
+ * @return a reference to the {@code UseKeyType} instance that represents the key
used.
+ */
+ public UseKeyType getUseKey()
+ {
+ return useKey;
+ }
+
+ /**
+ * <p>
+ * Sets the key that used in the returned token.
+ * </p>
+ *
+ * @param useKey the {@code UseKeyType} instance to be set.
+ */
+ public void setUseKey(UseKeyType useKey)
+ {
+ this.useKey = useKey;
+ this.delegate.getAny().add(this.factory.createUseKey(useKey));
+ }
+
+ /**
+ * <p>
+ * Obtains the signature algorithm used with the issued security token.
+ * </p>
+ *
+ * @return a {@code URI} representing the algorithm used.
+ */
+ public URI getSignWith()
+ {
+ return signWith;
+ }
+
+ /**
+ * <p>
+ * Sets the signature algorithm used with the issued security token.
+ * </p>
+ *
+ * @param signWith a {@code URI} representing the algorithm used.
+ */
+ public void setSignWith(URI signWith)
+ {
+ this.signWith = signWith;
+
this.delegate.getAny().add(this.factory.createSignatureAlgorithm(signWith.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the encryption algorithm used with the issued security token.
+ * </p>
+ *
+ * @return a {@code URI} representing the encryption algorithm used.
+ */
+ public URI getEncryptWith()
+ {
+ return encryptWith;
+ }
+
+ /**
+ * <p>
+ * Sets the encryption algorithm used with the issued security token.
+ * </p>
+ *
+ * @param encryptWith a {@code URI} representing the algorithm used.
+ */
+ public void setEncryptWith(URI encryptWith)
+ {
+ this.encryptWith = encryptWith;
+
this.delegate.getAny().add(this.factory.createEncryptWith(encryptWith.toString()));
+ }
+
+ /**
+ * <p>
+ * Obtains the identity to which the requested token should be delegated.
+ * </p>
+ *
+ * @return a reference to the {@code DelegateToType} instance that represents the
identity.
+ */
+ public DelegateToType getDelegateTo()
+ {
+ return delegateTo;
+ }
+
+ /**
+ * <p>
+ * Sets the identity to which the requested token should be delegated.
+ * </p>
+ *
+ * @param delegateTo the {@code DelegateToType} object representing the identity to be
set.
+ */
+ public void setDelegateTo(DelegateToType delegateTo)
+ {
+ this.delegateTo = delegateTo;
+ this.delegate.getAny().add(this.factory.createDelegateTo(delegateTo));
+ }
+
+ /**
+ * <p>
+ * Indicates whether the requested token has been marked as "forwardable" or
not. In general, this flag is used when
+ * a token is normally bound to the requestor's machine or service. Using this
flag, the returned token MAY be used
+ * from any source machine so long as the key is correctly proven.
+ * </p>
+ *
+ * @return {@code true} if the requested token has been marked as
"forwardable"; {@code false} otherwise.
+ */
+ public boolean isForwardable()
+ {
+ return forwardable;
+ }
+
+ /**
+ * <p>
+ * Specifies whether the requested token has been marked as "forwardable" or
not. In general, this flag is used when
+ * a token is normally bound to the requestor's machine or service. Using this
flag, the returned token MAY be used
+ * from any source machine so long as the key is correctly proven.
+ * </p>
+ *
+ * @param forwardable {@code true} if the requested token has been marked as
"forwardable"; {@code false} otherwise.
+ */
+ public void setForwardable(boolean forwardable)
+ {
+ this.forwardable = forwardable;
+ this.delegate.getAny().add(this.factory.createForwardable(forwardable));
+ }
+
+ /**
+ * <p>
+ * Indicates whether the requested token has been marked as "delegatable" or
not. Using this flag, the returned token
+ * MAY be delegated to another party.
+ * </p>
+ *
+ * @return {@code true} if the requested token has been marked as
"delegatable"; {@code false} otherwise.
+ */
+ public boolean isDelegatable()
+ {
+ return delegatable;
+ }
+
+ /**
+ * <p>
+ * Specifies whether the requested token has been marked as "delegatable" or
not. Using this flag, the returned token
+ * MAY be delegated to another party.
+ * </p>
+ *
+ * @param delegatable {@code true} if the requested token has been marked as
"delegatable"; {@code false} otherwise.
+ */
+ public void setDelegatable(boolean delegatable)
+ {
+ this.delegatable = delegatable;
+ this.delegate.getAny().add(this.factory.createDelegatable(delegatable));
+ }
+
+ /**
+ * <p>
+ * Obtains the {@code Policy} that was associated with the request. The policy
specifies defaults that can be
+ * overridden by the previous properties.
+ * </p>
+ *
+ * @return a reference to the {@code Policy} that was associated with the request.
+ */
+ public Policy getPolicy()
+ {
+ return policy;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code Policy} in the response. The policy specifies defaults that can be
overridden by the previous
+ * properties.
+ * </p>
+ *
+ * @param policy the {@code Policy} instance to be set.
+ */
+ public void setPolicy(Policy policy)
+ {
+ this.policy = policy;
+ this.delegate.getAny().add(policy);
+ }
+
+ /**
+ * <p>
+ * Obtains the reference to the {@code Policy} that was associated with the request.
+ * </p>
+ *
+ * @return a {@code PolicyReference} that specifies where the {@code Policy} can be
found.
+ */
+ public PolicyReference getPolicyReference()
+ {
+ return policyReference;
+ }
+
+ /**
+ * <p>
+ * Sets the reference to the {@code Policy} that was associated with the request.
+ * </p>
+ *
+ * @param policyReference the {@code PolicyReference} object to be set.
+ */
+ public void setPolicyReference(PolicyReference policyReference)
+ {
+ this.policyReference = policyReference;
+ this.delegate.getAny().add(policyReference);
+ }
+
+ /**
+ * <p>
+ * Obtains the list of request elements that are not part of the standard content
model.
+ * </p>
+ *
+ * @return a {@code List<Object>} containing the extension elements.
+ */
+ public List<Object> getExtensionElements()
+ {
+ return Collections.unmodifiableList(this.extensionElements);
+ }
+
+ /**
+ * <p>
+ * Obtains the response context.
+ * </p>
+ *
+ * @return a {@code String} that identifies the original request.
+ */
+ public String getContext()
+ {
+ return this.delegate.getContext();
+ }
+
+ /**
+ * <p>
+ * Sets the response context.
+ * </p>
+ *
+ * @param context a {@code String} that identifies the original request.
+ */
+ public void setContext(String context)
+ {
+ this.delegate.setContext(context);
+ }
+
+ /**
+ * <p>
+ * Obtains a map that contains attributes that aren't bound to any typed property
on the response. This is a live
+ * reference, so attributes can be added/changed/removed directly. For this reason,
there is no setter method.
+ * </p>
+ *
+ * @return a {@code Map<QName, String>} that contains the attributes.
+ */
+ public Map<QName, String> getOtherAttributes()
+ {
+ return this.delegate.getOtherAttributes();
+ }
+
+ /**
+ * <p>
+ * Gets a reference to the list that holds all response element values.
+ * </p>
+ *
+ * @return a {@code List<Object>} containing all values specified in the
response.
+ */
+ public List<Object> getAny()
+ {
+ return this.delegate.getAny();
+ }
+
+ /**
+ * <p>
+ * Obtains a reference to the {@code RequestSecurityTokenResponseType} delegate.
+ * </p>
+ *
+ * @return a reference to the delegate instance.
+ */
+ public RequestSecurityTokenResponseType getDelegate()
+ {
+ return this.delegate;
+ }
+}
Added:
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenResponseCollection.java
===================================================================
---
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenResponseCollection.java
(rev 0)
+++
identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/wstrust/protocol/RequestSecurityTokenResponseCollection.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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.api.wstrust.protocol;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import
org.jboss.identity.federation.ws.trust.RequestSecurityTokenResponseCollectionType;
+import org.jboss.identity.federation.ws.trust.RequestSecurityTokenResponseType;
+
+/**
+ * <p>
+ * This class represents a WS-Trust {@code RequestSecurityTokenResponseCollection}. It
wraps the JAXB representation of
+ * the security token collection response.
+ * </p>
+ *
+ * @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
+ */
+public class RequestSecurityTokenResponseCollection implements
BaseRequestSecurityTokenResponse
+{
+
+ private final RequestSecurityTokenResponseCollectionType delegate;
+
+ private final List<RequestSecurityTokenResponse> requestSecurityTokenResponses;
+
+ /**
+ * <p>
+ * Creates an instance of {@code RequestSecurityTokenResponseCollection}.
+ * </p>
+ */
+ public RequestSecurityTokenResponseCollection()
+ {
+ this.requestSecurityTokenResponses = new
ArrayList<RequestSecurityTokenResponse>();
+ this.delegate = new RequestSecurityTokenResponseCollectionType();
+ }
+
+ /**
+ * <p>
+ * Creates an instance of {@code RequestSecurityTokenResponseCollection} using the
specified delegate.
+ * </p>
+ *
+ * @param delegate the JAXB {@code RequestSecurityTokenResponseCollectionType} that
represents a WS-Trust request
+ * collection.
+ */
+ public
RequestSecurityTokenResponseCollection(RequestSecurityTokenResponseCollectionType
delegate)
+ {
+ this.delegate = delegate;
+ this.requestSecurityTokenResponses = new
ArrayList<RequestSecurityTokenResponse>();
+ for (RequestSecurityTokenResponseType response :
delegate.getRequestSecurityTokenResponse())
+ this.requestSecurityTokenResponses.add(new
RequestSecurityTokenResponse(response));
+ }
+
+ /**
+ * <p>
+ * Obtains the collection of {@code RequestSecurityTokenResponse} objects. The
returned collection is immutable, so
+ * addition or removal of requests must be carried by the appropriate add/remove
methods.
+ * </p>
+ *
+ * @return a {@code List<RequestSecurityToken>} containing the token requests.
+ */
+ public List<RequestSecurityTokenResponse> getRequestSecurityTokenResponses()
+ {
+ return Collections.unmodifiableList(this.requestSecurityTokenResponses);
+ }
+
+ /**
+ * <p>
+ * Adds the specified {@code RequestSecurityTokenResponse} object to the collection of
token requests.
+ * </p>
+ *
+ * @param request the {@code RequestSecurityTokenResponse} to be added.
+ */
+ public void addRequestSecurityTokenResponse(RequestSecurityTokenResponse response)
+ {
+ this.delegate.getRequestSecurityTokenResponse().add(response.getDelegate());
+ this.requestSecurityTokenResponses.add(response);
+ }
+
+ /**
+ * <p>
+ * Removes the specified {@code RequestSecurityTokenResponse} object from the
collection of token requests.
+ * </p>
+ *
+ * @param request the {@code RequestSecurityTokenResponse} to be removed.
+ */
+ public void removeRequestSecurityTokenResponse(RequestSecurityTokenResponse response)
+ {
+ this.delegate.getRequestSecurityTokenResponse().remove(response.getDelegate());
+ this.requestSecurityTokenResponses.remove(response);
+ }
+
+ /**
+ * <p>
+ * Obtains a reference to the {@code RequestSecurityTokenResponseCollectionType}
delegate.
+ * </p>
+ *
+ * @return a reference to the delegate instance.
+ */
+ public RequestSecurityTokenResponseCollectionType getDelegate()
+ {
+ return this.delegate;
+ }
+
+}
Modified: identity-federation/trunk/identity-fed-core/.classpath
===================================================================
--- identity-federation/trunk/identity-fed-core/.classpath 2009-02-09 05:17:32 UTC (rev
310)
+++ identity-federation/trunk/identity-fed-core/.classpath 2009-02-09 18:47:40 UTC (rev
311)
@@ -1,15 +1,20 @@
-<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/test/resources"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/identity-fed-model"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
- <classpathentry kind="var"
path="M2_REPO/sun-jaxb/jaxb-api/2.1.9/jaxb-api-2.1.9.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/jboss/security/jboss-xacml/2.0.3-SNAPSHOT/jboss-xacml-2.0.3-SNAPSHOT.jar"/>
- <classpathentry kind="var"
path="M2_REPO/stax/stax-api/1.0/stax-api-1.0.jar"/>
- <classpathentry combineaccessrules="false" kind="src"
path="/identity-xmlsecmodel"/>
- <classpathentry kind="output" path="target-eclipse"/>
-</classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"
excluding="**/*.java"/>
+ <classpathentry kind="src" path="src/test/java"
output="target/test-classes"/>
+ <classpathentry kind="src" path="src/test/resources"
output="target/test-classes" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <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/apache-logging/commons-logging-api/1.0.3/commons-logging-api-1.0.3.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="src"
path="/jboss-identity-fed-model"/>
+ <classpathentry kind="src"
path="/jboss-identity-xmlsec-model"/>
+ <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/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/codehaus-stax/stax/1.1.1/stax-1.1.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/stax/stax-api/1.0/stax-api-1.0.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/org/apache/xmlsec/1.4.1/xmlsec-1.4.1.jar"/>
+</classpath>
\ No newline at end of file
Modified: identity-federation/trunk/identity-fed-core/.project
===================================================================
--- identity-federation/trunk/identity-fed-core/.project 2009-02-09 05:17:32 UTC (rev
310)
+++ identity-federation/trunk/identity-fed-core/.project 2009-02-09 18:47:40 UTC (rev
311)
@@ -1,17 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>identity-fed-core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+ <name>jboss-identity-fed-core</name>
+ <comment>JBoss Identity Federation Core contains the core infrastructure
code</comment>
+ <projects>
+ <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>
\ No newline at end of file
Modified: identity-federation/trunk/identity-fed-model/.classpath
===================================================================
--- identity-federation/trunk/identity-fed-model/.classpath 2009-02-09 05:17:32 UTC (rev
310)
+++ identity-federation/trunk/identity-fed-model/.classpath 2009-02-09 18:47:40 UTC (rev
311)
@@ -7,32 +7,14 @@
<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/apache-logging/commons-logging-api/1.0.3/commons-logging-api-1.0.3.jar"/>
- <classpathentry kind="var"
path="M2_REPO/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/javolution/4.1.0/javolution-4.1.0.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.4/jaxb-impl-2.1.4.jar"
sourcepath="M2_REPO/sun-jaxb/jaxb-impl/2.1.4/jaxb-impl-2.1.4-sources.jar"/>
- <classpathentry kind="var"
path="M2_REPO/sun-jaxb/jaxb-xjc/2.1.4/jaxb-xjc-2.1.4.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/jboss/identity/jboss-identity-xmlsec-model/1.0.0-SNAPSHOT/jboss-identity-xmlsec-model-1.0.0-SNAPSHOT.jar"
sourcepath="M2_REPO/org/jboss/identity/jboss-identity-xmlsec-model/1.0.0-SNAPSHOT/jboss-identity-xmlsec-model-1.0.0-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/jboss/security/jboss-sunxacml/2.0.3-SNAPSHOT/jboss-sunxacml-2.0.3-SNAPSHOT.jar"
sourcepath="M2_REPO/org/jboss/security/jboss-sunxacml/2.0.3-SNAPSHOT/jboss-sunxacml-2.0.3-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/jboss/security/jboss-xacml/2.0.3-SNAPSHOT/jboss-xacml-2.0.3-SNAPSHOT.jar"
sourcepath="M2_REPO/org/jboss/security/jboss-xacml/2.0.3-SNAPSHOT/jboss-xacml-2.0.3-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/jboss/security/jboss-xacml-saml/2.0.3-SNAPSHOT/jboss-xacml-saml-2.0.3-SNAPSHOT.jar"
sourcepath="M2_REPO/org/jboss/security/jboss-xacml-saml/2.0.3-SNAPSHOT/jboss-xacml-saml-2.0.3-SNAPSHOT-sources.jar"/>
- <classpathentry kind="var"
path="M2_REPO/net/sf/joda-time/1.4/joda-time-1.4.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="src"
path="/jboss-identity-xmlsec-model"/>
+ <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/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/log4j/log4j/1.2.13/log4j-1.2.13.jar"/>
- <classpathentry kind="var"
path="M2_REPO/opensaml/opensaml/2.2.0/opensaml-2.2.0.jar"/>
- <classpathentry kind="var"
path="M2_REPO/opensaml/openws/1.2.0/openws-1.2.0.jar"/>
<classpathentry kind="var"
path="M2_REPO/apache-xalan/serializer/2.7.0.patch01-brew/serializer-2.7.0.patch01-brew.jar"/>
- <classpathentry kind="var"
path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"
sourcepath="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5-sources.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/slf4j/slf4j-api/1.4.3/slf4j-api-1.4.3.jar"/>
- <classpathentry kind="var"
path="M2_REPO/org/slf4j/slf4j-log4j12/1.4.3/slf4j-log4j12-1.4.3.jar"/>
<classpathentry kind="var"
path="M2_REPO/codehaus-stax/stax/1.1.1/stax-1.1.1.jar"/>
<classpathentry kind="var"
path="M2_REPO/stax/stax-api/1.0/stax-api-1.0.jar"/>
- <classpathentry kind="var"
path="M2_REPO/velocity/velocity-dep/1.5/velocity-dep-1.5.jar"/>
- <classpathentry kind="var"
path="M2_REPO/apache-xalan/xalan/j_2.7.0/xalan-j_2.7.0.jar"/>
- <classpathentry kind="var"
path="M2_REPO/apache-xerces/xercesImpl/2.7.1/xercesImpl-2.7.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/apache-xmlsec/xmlsec/1.3.0/xmlsec-1.3.0.jar"/>
<classpathentry kind="var"
path="M2_REPO/org/apache/xmlsec/1.4.1/xmlsec-1.4.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/opensaml/xmltooling/1.1.0/xmltooling-1.1.0.jar"/>
</classpath>
\ No newline at end of file
Modified: identity-federation/trunk/identity-fed-model/.project
===================================================================
--- identity-federation/trunk/identity-fed-model/.project 2009-02-09 05:17:32 UTC (rev
310)
+++ identity-federation/trunk/identity-fed-model/.project 2009-02-09 18:47:40 UTC (rev
311)
@@ -1,7 +1,9 @@
<projectDescription>
<name>jboss-identity-fed-model</name>
<comment>JBoss Identity Federation Model contains the JAXB2
model.</comment>
- <projects/>
+ <projects>
+ <project>jboss-identity-xmlsec-model</project>
+ </projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
Modified:
identity-federation/trunk/identity-fed-model/src/test/java/org/jboss/test/identity/federation/ws/trust/UnmarshallingTestCase.java
===================================================================
---
identity-federation/trunk/identity-fed-model/src/test/java/org/jboss/test/identity/federation/ws/trust/UnmarshallingTestCase.java 2009-02-09
05:17:32 UTC (rev 310)
+++
identity-federation/trunk/identity-fed-model/src/test/java/org/jboss/test/identity/federation/ws/trust/UnmarshallingTestCase.java 2009-02-09
18:47:40 UTC (rev 311)
@@ -54,7 +54,7 @@
@SuppressWarnings("unchecked")
public void testUnmarshallTokenRequest() throws Exception
{
- JAXBContext context =
JAXBContext.newInstance("org.jboss.identity.federation.ws.trust");
+ JAXBContext context =
JAXBContext.newInstance("org.jboss.identity.federation.ws.policy:org.jboss.identity.federation.ws.trust");
Unmarshaller unmarshaller = context.createUnmarshaller();
// this.setValidatingSchema("/schema/wstrust/v1_3/ws-trust-1.3.xsd",
unmarshaller);
Modified: identity-federation/trunk/identity-xmlsecmodel/.classpath
===================================================================
--- identity-federation/trunk/identity-xmlsecmodel/.classpath 2009-02-09 05:17:32 UTC (rev
310)
+++ identity-federation/trunk/identity-xmlsecmodel/.classpath 2009-02-09 18:47:40 UTC (rev
311)
@@ -1,13 +1,12 @@
-<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var"
path="M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/sun-jaxb/jaxb-impl/2.1.9/jaxb-impl-2.1.9.jar"/>
- <classpathentry kind="var"
path="M2_REPO/sun-jaf/activation/1.1/activation-1.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/codehaus-stax/stax/1.1.1/stax-1.1.1.jar"/>
- <classpathentry kind="var"
path="M2_REPO/stax/stax-api/1.0/stax-api-1.0.jar"/>
-
- <classpathentry kind="output" path="target-eclipse"/>
-</classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"
excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <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/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/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/codehaus-stax/stax/1.1.1/stax-1.1.1.jar"/>
+ <classpathentry kind="var"
path="M2_REPO/stax/stax-api/1.0/stax-api-1.0.jar"/>
+</classpath>
\ No newline at end of file
Modified: identity-federation/trunk/identity-xmlsecmodel/.project
===================================================================
--- identity-federation/trunk/identity-xmlsecmodel/.project 2009-02-09 05:17:32 UTC (rev
310)
+++ identity-federation/trunk/identity-xmlsecmodel/.project 2009-02-09 18:47:40 UTC (rev
311)
@@ -1,17 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>identity-xmlsec-model</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+ <name>jboss-identity-xmlsec-model</name>
+ <comment>JBoss Identity Federation XML Security Model contains the JAXB2 model
for W3C XML Signature and XML Encryption specifications.</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file