[jboss-identity-commits] JBoss Identity SVN: r253 - in identity-federation/trunk/identity-fed-api/src: test/java/org/jboss/test/identity/federation/api/saml/v2 and 1 other directory.

jboss-identity-commits at lists.jboss.org jboss-identity-commits at lists.jboss.org
Tue Jan 27 01:04:08 EST 2009


Author: anil.saldhana at jboss.com
Date: 2009-01-27 01:04:07 -0500 (Tue, 27 Jan 2009)
New Revision: 253

Added:
   identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2RequestUnitTestCase.java
Modified:
   identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SAML2Request.java
Log:
add logout req

Modified: identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SAML2Request.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SAML2Request.java	2009-01-27 04:59:21 UTC (rev 252)
+++ identity-federation/trunk/identity-fed-api/src/main/java/org/jboss/identity/federation/api/saml/v2/request/SAML2Request.java	2009-01-27 06:04:07 UTC (rev 253)
@@ -31,9 +31,13 @@
 import javax.xml.bind.Unmarshaller;
 
 import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLAuthnRequestFactory;
+import org.jboss.identity.federation.core.saml.v2.factories.JBossSAMLBaseFactory;
 import org.jboss.identity.federation.core.saml.v2.util.JAXBElementMappingUtil;
+import org.jboss.identity.federation.core.saml.v2.util.XMLTimeUtil;
+import org.jboss.identity.federation.saml.v2.assertion.NameIDType;
 import org.jboss.identity.federation.saml.v2.profiles.xacml.protocol.XACMLAuthzDecisionQueryType;
 import org.jboss.identity.federation.saml.v2.protocol.AuthnRequestType;
+import org.jboss.identity.federation.saml.v2.protocol.LogoutRequestType;
 import org.jboss.identity.federation.saml.v2.protocol.RequestAbstractType;
 
 /**
@@ -114,6 +118,27 @@
    } 
    
    /**
+    * Create a Logout Request
+    * @param issuer
+    * @return
+    * @throws Exception
+    */
+   public LogoutRequestType createLogoutRequest(String issuer) throws Exception
+   {
+      org.jboss.identity.federation.saml.v2.protocol.ObjectFactory of
+             = new org.jboss.identity.federation.saml.v2.protocol.ObjectFactory();
+      LogoutRequestType lrt = of.createLogoutRequestType();
+      lrt.setIssueInstant(XMLTimeUtil.getIssueInstant());
+      
+      //Create an issuer 
+      NameIDType issuerNameID = JBossSAMLBaseFactory.createNameID();
+      issuerNameID.setValue(issuer);
+      lrt.setIssuer(issuerNameID);
+      
+      return lrt;
+   }
+   
+   /**
     * Parse an XACML Authorization Decision Query from an xml file
     * @param resourceName
     * @return

Added: identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2RequestUnitTestCase.java
===================================================================
--- identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2RequestUnitTestCase.java	                        (rev 0)
+++ identity-federation/trunk/identity-fed-api/src/test/java/org/jboss/test/identity/federation/api/saml/v2/SAML2RequestUnitTestCase.java	2009-01-27 06:04:07 UTC (rev 253)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors. 
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.identity.federation.api.saml.v2;
+
+import org.jboss.identity.federation.api.saml.v2.request.SAML2Request;
+import org.jboss.identity.federation.saml.v2.protocol.LogoutRequestType;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Unit Test the SAMl2Request API
+ * @author Anil.Saldhana at redhat.com
+ * @since Jan 26, 2009
+ */
+public class SAML2RequestUnitTestCase extends TestCase
+{
+   public void testLogOut() throws Exception
+   {
+      SAML2Request saml2Request = new SAML2Request(); 
+      LogoutRequestType lrt = saml2Request.createLogoutRequest("http://idp");
+      assertNotNull("LogoutRequest is not null", lrt);
+   }
+
+}
\ No newline at end of file




More information about the jboss-identity-commits mailing list