Author: anil.saldhana(a)jboss.com
Date: 2011-07-06 10:44:27 -0400 (Wed, 06 Jul 2011)
New Revision: 1066
Added:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/SAML11ProtocolContext.java
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/SAML11Constants.java
federation/trunk/picketlink-fed-core/src/main/resources/core-sts.xml
federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/saml/v1/protocol/SAML11StatusType.java
Log:
PLFED-189:
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/SAML11Constants.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/SAML11Constants.java 2011-07-06
14:43:18 UTC (rev 1065)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/SAML11Constants.java 2011-07-06
14:44:27 UTC (rev 1066)
@@ -118,5 +118,7 @@
String STATUS_MSG = "StatusMessage";
+ String TARGET = "TARGET";
+
String VALUE = "Value";
}
\ No newline at end of file
Added:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/SAML11ProtocolContext.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/SAML11ProtocolContext.java
(rev 0)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/SAML11ProtocolContext.java 2011-07-06
14:44:27 UTC (rev 1066)
@@ -0,0 +1,193 @@
+/*
+ * 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.picketlink.identity.federation.core.saml.v1;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.picketlink.identity.federation.core.interfaces.ProtocolContext;
+import org.picketlink.identity.federation.core.interfaces.SecurityTokenProvider;
+import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
+import org.picketlink.identity.federation.core.sts.PicketLinkCoreSTS;
+import org.picketlink.identity.federation.saml.v1.assertion.SAML11AssertionType;
+import org.picketlink.identity.federation.saml.v1.assertion.SAML11ConditionsType;
+import org.picketlink.identity.federation.saml.v1.assertion.SAML11NameIdentifierType;
+import org.picketlink.identity.federation.saml.v1.assertion.SAML11StatementAbstractType;
+import org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectType;
+
+/**
+ * <p>
+ * A SAML2 specification based instance of {@code ProtocolContext}
+ * </p>
+ * <p>
+ * This instance is used to pass information from the IDP to the Core STS.
+ * </p>
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Dec 30, 2010
+ */
+public class SAML11ProtocolContext implements ProtocolContext
+{
+ protected SAML11NameIdentifierType issuerID;
+
+ protected SAML11SubjectType subjectType;
+
+ protected SAML11ConditionsType conditions;
+
+ protected List<SAML11StatementAbstractType> statements = new
ArrayList<SAML11StatementAbstractType>();
+
+ protected SAML11AssertionType issuedAssertion;
+
+ /**
+ * Get the Issuer ID
+ * @return instance of {@link SAML11NameIdentifierType}
+ */
+ public SAML11NameIdentifierType getIssuerID()
+ {
+ return issuerID;
+ }
+
+ /**
+ * Set the Issuer ID
+ * @param issuerID {@link SAML11NameIdentifierType}
+ */
+ public void setIssuerID(SAML11NameIdentifierType issuerID)
+ {
+ this.issuerID = issuerID;
+ }
+
+ /**
+ * Get the subject
+ * @return {@link SAML11SubjectType}
+ */
+ public SAML11SubjectType getSubjectType()
+ {
+ return subjectType;
+ }
+
+ /**
+ * Set the subject
+ * @param subjectType {@link SAML11SubjectType}
+ */
+ public void setSubjectType(SAML11SubjectType subjectType)
+ {
+ this.subjectType = subjectType;
+ }
+
+ /**
+ * Get the conditions
+ * @return {@link SAML11ConditionsType}
+ */
+ public SAML11ConditionsType getConditions()
+ {
+ return conditions;
+ }
+
+ /**
+ * Set the conditions
+ * @param conditions {@link SAML11ConditionsType}
+ */
+ public void setConditions(SAML11ConditionsType conditions)
+ {
+ this.conditions = conditions;
+ }
+
+ /**
+ * Get the statements as a read-only list
+ * @return {@link SAML11StatementAbstractType}
+ */
+ public List<SAML11StatementAbstractType> getStatements()
+ {
+ return Collections.unmodifiableList(statements);
+ }
+
+ /**
+ * Add a list of statements
+ * @param statements {@link SAML11StatementAbstractType}
+ */
+ public void setStatements(List<SAML11StatementAbstractType> statements)
+ {
+ this.statements = statements;
+ }
+
+ /**
+ * Get the previously issued assertion by the STS
+ * @return {@link SAML11AssertionType}
+ */
+ public SAML11AssertionType getIssuedAssertion()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(PicketLinkCoreSTS.rte);
+
+ return issuedAssertion;
+ }
+
+ /**
+ * Set the assertion issued by the STS
+ * @param issuedAssertion {@link SAML11AssertionType}
+ */
+ public void setIssuedAssertion(SAML11AssertionType issuedAssertion)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(PicketLinkCoreSTS.rte);
+
+ this.issuedAssertion = issuedAssertion;
+ }
+
+ /**
+ * @see
org.picketlink.identity.federation.core.interfaces.ProtocolContext#serviceName()
+ */
+ public String serviceName()
+ {
+ return null;
+ }
+
+ /**
+ * @see
org.picketlink.identity.federation.core.interfaces.ProtocolContext#tokenType()
+ */
+ public String tokenType()
+ {
+ return SAML11Constants.ASSERTION_11_NSURI;
+ }
+
+ /**
+ * @see org.picketlink.identity.federation.core.interfaces.ProtocolContext#getQName()
+ */
+ public QName getQName()
+ {
+ String localPart = JBossSAMLConstants.ASSERTION.get();
+ String ns = tokenType();
+ return new QName(ns, localPart);
+ }
+
+ /**
+ * @see org.picketlink.identity.federation.core.interfaces.ProtocolContext#family()
+ */
+ public String family()
+ {
+ return SecurityTokenProvider.FAMILY_TYPE.SAML11.toString();
+ }
+}
\ No newline at end of file
Property changes on:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/SAML11ProtocolContext.java
___________________________________________________________________
Added: svn:executable
+ *
Modified: federation/trunk/picketlink-fed-core/src/main/resources/core-sts.xml
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/resources/core-sts.xml 2011-07-06
14:43:18 UTC (rev 1065)
+++ federation/trunk/picketlink-fed-core/src/main/resources/core-sts.xml 2011-07-06
14:44:27 UTC (rev 1066)
@@ -5,6 +5,10 @@
TokenType="urn:oasis:names:tc:SAML:2.0:assertion"
TokenElement="Assertion"
TokenElementNS="urn:oasis:names:tc:SAML:2.0:assertion"/>
+ <TokenProvider
ProviderClass="org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML11TokenProvider"
+ TokenType="urn:oasis:names:tc:SAML:1.0:assertion"
+ TokenElement="Assertion"
+ TokenElementNS="urn:oasis:names:tc:SAML:1.0:assertion"/>
<!--<TokenProvider
ProviderClass="org.picketlink.identity.federation.core.openid.providers.OpenIDTokenProvider"
TokenType="urn:openid:1:0"
TokenElementNS="urn:openid:1:0"/>
Modified:
federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/saml/v1/protocol/SAML11StatusType.java
===================================================================
---
federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/saml/v1/protocol/SAML11StatusType.java 2011-07-06
14:43:18 UTC (rev 1065)
+++
federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/saml/v1/protocol/SAML11StatusType.java 2011-07-06
14:44:27 UTC (rev 1066)
@@ -77,4 +77,11 @@
{
this.statusDetail = statusDetail;
}
+
+ public static SAML11StatusType successType()
+ {
+ SAML11StatusType success = new SAML11StatusType();
+ success.setStatusCode(SAML11StatusCodeType.SUCCESS);
+ return success;
+ }
}
\ No newline at end of file