Author: anil.saldhana(a)jboss.com
Date: 2011-07-06 14:33:55 -0400 (Wed, 06 Jul 2011)
New Revision: 1072
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAML11SubjectParser.java
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/providers/SAML11AssertionTokenProvider.java
federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/saml/v1/assertion/SAML11NameIdentifierType.java
federation/trunk/picketlink-webapps/idp/src/main/webapp/index.jsp
Log:
PLFED-189:
Modified:
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
===================================================================
---
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2011-07-06
16:10:29 UTC (rev 1071)
+++
federation/trunk/picketlink-bindings/src/main/java/org/picketlink/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2011-07-06
18:33:55 UTC (rev 1072)
@@ -40,7 +40,6 @@
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import javax.xml.crypto.dsig.CanonicalizationMethod;
@@ -100,6 +99,9 @@
import org.picketlink.identity.federation.core.util.SystemPropertiesUtil;
import org.picketlink.identity.federation.core.util.XMLSignatureUtil;
import org.picketlink.identity.federation.saml.v1.assertion.SAML11AssertionType;
+import org.picketlink.identity.federation.saml.v1.assertion.SAML11NameIdentifierType;
+import org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectType;
+import
org.picketlink.identity.federation.saml.v1.assertion.SAML11SubjectType.SAML11SubjectTypeChoice;
import org.picketlink.identity.federation.saml.v1.protocol.SAML11ResponseType;
import org.picketlink.identity.federation.saml.v1.protocol.SAML11StatusType;
import org.picketlink.identity.federation.saml.v2.SAML2Object;
@@ -364,9 +366,7 @@
}
else
{
- //Send it to the hosted page
- RequestDispatcher dispatch =
request.getRequestDispatcher("/hosted/");
- dispatch.forward(request, response);
+ getNext().invoke(request, response);
}
/*log.error("No SAML Request or Response Message");
if (trace)
@@ -390,6 +390,8 @@
{
try
{
+ Principal userPrincipal = request.getPrincipal();
+
String target = request.getParameter(SAML11Constants.TARGET);
Session session = request.getSessionInternal();
@@ -397,6 +399,13 @@
if (saml11Assertion == null)
{
SAML11ProtocolContext saml11Protocol = new SAML11ProtocolContext();
+ saml11Protocol.setIssuerID(this.identityURL);
+ SAML11SubjectType subject = new SAML11SubjectType();
+ SAML11SubjectTypeChoice subjectChoice = new SAML11SubjectTypeChoice(new
SAML11NameIdentifierType(
+ userPrincipal.getName()));
+ subject.setChoice(subjectChoice);
+ saml11Protocol.setSubjectType(subject);
+
PicketLinkCoreSTS.instance().issueToken(saml11Protocol);
saml11Assertion = saml11Protocol.getIssuedAssertion();
session.setNote("SAML11", saml11Assertion);
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAML11SubjectParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAML11SubjectParser.java 2011-07-06
16:10:29 UTC (rev 1071)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAML11SubjectParser.java 2011-07-06
18:33:55 UTC (rev 1072)
@@ -80,7 +80,8 @@
if (SAML11Constants.NAME_IDENTIFIER.equalsIgnoreCase(tag))
{
peekedElement = StaxParserUtil.getNextStartElement(xmlEventReader);
- SAML11NameIdentifierType nameID = new SAML11NameIdentifierType();
+ String val = StaxParserUtil.getElementText(xmlEventReader);
+ SAML11NameIdentifierType nameID = new SAML11NameIdentifierType(val);
Attribute formatAtt = peekedElement.getAttributeByName(new
QName(SAML11Constants.FORMAT));
if (formatAtt != null)
{
@@ -93,8 +94,6 @@
nameID.setNameQualifier(StaxParserUtil.getAttributeValue(nameQAtt));
}
- String val = StaxParserUtil.getElementText(xmlEventReader);
- nameID.setValue(val);
SAML11SubjectTypeChoice subChoice = new SAML11SubjectTypeChoice(nameID);
subject.setChoice(subChoice);
}
Modified:
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 2011-07-06
16:10:29 UTC (rev 1071)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/SAML11ProtocolContext.java 2011-07-06
18:33:55 UTC (rev 1072)
@@ -49,7 +49,7 @@
*/
public class SAML11ProtocolContext implements ProtocolContext
{
- protected SAML11NameIdentifierType issuerID;
+ protected String issuerID;
protected SAML11SubjectType subjectType;
@@ -65,16 +65,16 @@
* Get the Issuer ID
* @return instance of {@link SAML11NameIdentifierType}
*/
- public SAML11NameIdentifierType getIssuerID()
+ public String getIssuerID()
{
return issuerID;
}
/**
* Set the Issuer ID
- * @param issuerID {@link SAML11NameIdentifierType}
+ * @param issuerID {@link String}
*/
- public void setIssuerID(SAML11NameIdentifierType issuerID)
+ public void setIssuerID(String issuerID)
{
this.issuerID = issuerID;
}
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/providers/SAML11AssertionTokenProvider.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/providers/SAML11AssertionTokenProvider.java 2011-07-06
16:10:29 UTC (rev 1071)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/saml/v1/providers/SAML11AssertionTokenProvider.java 2011-07-06
18:33:55 UTC (rev 1072)
@@ -45,7 +45,6 @@
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.SAML11AuthenticationStatementType;
-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;
import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
@@ -117,7 +116,10 @@
SAML11ProtocolContext samlProtocolContext = (SAML11ProtocolContext) context;
- SAML11NameIdentifierType issuerID = samlProtocolContext.getIssuerID();
+ String issuerID = samlProtocolContext.getIssuerID();
+ if (issuerID == null)
+ throw new ProcessingException("Issuer in SAML Protocol Context is
null");
+
XMLGregorianCalendar issueInstant;
try
{
@@ -134,7 +136,7 @@
String assertionID = IDGenerator.create("ID_");
SAML11AssertionType assertionType = new SAML11AssertionType(assertionID,
issueInstant);
- assertionType.setIssuer(issuerID.getValue());
+ assertionType.setIssuer(issuerID);
assertionType.addAllStatements(statements);
try
{
Modified:
federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/saml/v1/assertion/SAML11NameIdentifierType.java
===================================================================
---
federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/saml/v1/assertion/SAML11NameIdentifierType.java 2011-07-06
16:10:29 UTC (rev 1071)
+++
federation/trunk/picketlink-fed-model/src/main/java/org/picketlink/identity/federation/saml/v1/assertion/SAML11NameIdentifierType.java 2011-07-06
18:33:55 UTC (rev 1072)
@@ -46,6 +46,11 @@
protected String value;
+ public SAML11NameIdentifierType(String val)
+ {
+ this.value = val;
+ }
+
public String getNameQualifier()
{
return nameQualifier;
@@ -70,9 +75,4 @@
{
return value;
}
-
- public void setValue(String value)
- {
- this.value = value;
- }
}
\ No newline at end of file
Modified: federation/trunk/picketlink-webapps/idp/src/main/webapp/index.jsp
===================================================================
--- federation/trunk/picketlink-webapps/idp/src/main/webapp/index.jsp 2011-07-06 16:10:29
UTC (rev 1071)
+++ federation/trunk/picketlink-webapps/idp/src/main/webapp/index.jsp 2011-07-06 18:33:55
UTC (rev 1072)
@@ -1 +1,5 @@
-Welcome to IDP.
+<html>
+<body>
+<a
href="?TARGET=http%3A//localhost%3a8080/sales-saml11/">Sales</a>
+</body>
+</html>