Author: anil.saldhana(a)jboss.com
Date: 2010-10-14 12:21:26 -0400 (Thu, 14 Oct 2010)
New Revision: 470
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLConditionsParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLSubjectParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenCollectionParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTValidateTargetParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTrustParser.java
Log:
PLFED-109: PLFED-110:
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLConditionsParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLConditionsParser.java 2010-10-14
16:07:45 UTC (rev 469)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLConditionsParser.java 2010-10-14
16:21:26 UTC (rev 470)
@@ -137,7 +137,11 @@
*/
public boolean supports(QName qname)
{
- return false;
+ String nsURI = qname.getNamespaceURI();
+ String localPart = qname.getLocalPart();
+
+ return nsURI.equals( JBossSAMLURIConstants.ASSERTION_NSURI.get() )
+ && localPart.equals( JBossSAMLConstants.CONDITIONS.get() );
}
/**
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLParser.java 2010-10-14
16:07:45 UTC (rev 469)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLParser.java 2010-10-14
16:21:26 UTC (rev 470)
@@ -23,7 +23,6 @@
import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
@@ -48,15 +47,7 @@
{
while( xmlEventReader.hasNext() )
{
- XMLEvent xmlEvent = null;
- try
- {
- xmlEvent = xmlEventReader.peek();
- }
- catch (XMLStreamException e)
- {
- throw new ParsingException( e );
- }
+ XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
if( xmlEvent instanceof StartElement )
{
@@ -71,14 +62,7 @@
}
else
{
- try
- {
- xmlEventReader.nextEvent();
- }
- catch (XMLStreamException e)
- {
- throw new ParsingException( e );
- }
+ StaxParserUtil.getNextEvent(xmlEventReader);
}
}
throw new RuntimeException( "SAML Parsing has failed" );
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLSubjectParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLSubjectParser.java 2010-10-14
16:07:45 UTC (rev 469)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLSubjectParser.java 2010-10-14
16:21:26 UTC (rev 470)
@@ -135,8 +135,12 @@
/**
* @see {@link ParserNamespaceSupport#supports(QName)}
*/
- public boolean supports(QName qname)
+ public boolean supports( QName qname )
{
- return false;
+ String nsURI = qname.getNamespaceURI();
+ String localPart = qname.getLocalPart();
+
+ return nsURI.equals( JBossSAMLURIConstants.ASSERTION_NSURI.get() )
+ && localPart.equals( JBossSAMLConstants.SUBJECT.get() );
}
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java 2010-10-14
16:07:45 UTC (rev 469)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/util/StaxParserUtil.java 2010-10-14
16:21:26 UTC (rev 470)
@@ -328,6 +328,6 @@
{
String elementTag = getEndElementName( endElement );
if( !tag.equals( elementTag ))
- throw new RuntimeException( "Expecting <" + tag + ">.
Found <" + elementTag + ">" );
+ throw new RuntimeException( "Expecting </" + tag + ">.
Found </" + elementTag + ">" );
}
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenCollectionParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenCollectionParser.java 2010-10-14
16:07:45 UTC (rev 469)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenCollectionParser.java 2010-10-14
16:21:26 UTC (rev 470)
@@ -23,7 +23,6 @@
import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.StartElement;
import org.picketlink.identity.federation.core.exceptions.ParsingException;
@@ -45,19 +44,12 @@
*/
public Object parse( XMLEventReader xmlEventReader ) throws ParsingException
{
- try
- {
- xmlEventReader.nextEvent();
- }
- catch (XMLStreamException e)
- {
- throw new ParsingException( e );
- }
+ StaxParserUtil.getNextEvent(xmlEventReader);
RequestSecurityTokenCollection requestCollection = new
RequestSecurityTokenCollection();
//Peek at the next event
- while( true )
+ while( xmlEventReader.hasNext() )
{
StartElement peekedElement = StaxParserUtil.peekNextStartElement( xmlEventReader
);
if( peekedElement == null )
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java 2010-10-14
16:07:45 UTC (rev 469)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java 2010-10-14
16:21:26 UTC (rev 470)
@@ -25,8 +25,7 @@
import java.net.URISyntaxException;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLEventReader;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.EndElement;
import javax.xml.stream.events.StartElement;
@@ -83,12 +82,12 @@
String tag = StaxParserUtil.getStartElementName( subEvent );
if( tag.equals( WSTrustConstants.REQUEST_TYPE ))
{
- String value = xmlEventReader.getElementText();
+ String value = StaxParserUtil.getElementText(xmlEventReader);
requestToken.setRequestType( new URI( value ));
}
else if( tag.equals( WSTrustConstants.TOKEN_TYPE ))
{
- String value = xmlEventReader.getElementText();
+ String value = StaxParserUtil.getElementText(xmlEventReader);
requestToken.setTokenType( new URI( value ));
}
else if( tag.equals( WSTrustConstants.VALIDATE_TARGET ))
@@ -97,14 +96,9 @@
ValidateTargetType validateTarget = (ValidateTargetType)
wstValidateTargetParser.parse( xmlEventReader );
requestToken.setValidateTarget( validateTarget );
EndElement validateTargetEndElement =
StaxParserUtil.getNextEndElement(xmlEventReader);
- if( !StaxParserUtil.getEndElementName( validateTargetEndElement ).equals(
WSTrustConstants.VALIDATE_TARGET ) )
- throw new RuntimeException( "</" +
WSTrustConstants.VALIDATE_TARGET + "> expected" );
+ StaxParserUtil.validate( validateTargetEndElement,
WSTrustConstants.VALIDATE_TARGET ) ;
}
- }
- catch( XMLStreamException e )
- {
- throw new ParsingException( e );
- }
+ }
catch (URISyntaxException e)
{
throw new ParsingException( e );
@@ -119,6 +113,10 @@
*/
public boolean supports(QName qname)
{
- return false;
+ String nsURI = qname.getNamespaceURI();
+ String localPart = qname.getLocalPart();
+
+ return WSTrustConstants.BASE_NAMESPACE.equals( nsURI )
+ && WSTrustConstants.RST.equals( localPart );
}
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTValidateTargetParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTValidateTargetParser.java 2010-10-14
16:07:45 UTC (rev 469)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTValidateTargetParser.java 2010-10-14
16:21:26 UTC (rev 470)
@@ -30,6 +30,7 @@
import org.picketlink.identity.federation.core.parsers.saml.SAMLParser;
import org.picketlink.identity.federation.core.parsers.util.StaxParserUtil;
import org.picketlink.identity.federation.core.saml.v2.constants.JBossSAMLConstants;
+import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
import org.picketlink.identity.federation.saml.v2.assertion.AssertionType;
import org.picketlink.identity.federation.ws.trust.ValidateTargetType;
@@ -65,6 +66,10 @@
*/
public boolean supports(QName qname)
{
- return false;
+ String nsURI = qname.getNamespaceURI();
+ String localPart = qname.getLocalPart();
+
+ return WSTrustConstants.BASE_NAMESPACE.equals( nsURI )
+ && WSTrustConstants.VALIDATE_TARGET.equals( localPart );
}
}
\ No newline at end of file
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTrustParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTrustParser.java 2010-10-14
16:07:45 UTC (rev 469)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTrustParser.java 2010-10-14
16:21:26 UTC (rev 470)
@@ -23,7 +23,6 @@
import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
@@ -48,15 +47,7 @@
{
while( xmlEventReader.hasNext() )
{
- XMLEvent xmlEvent = null;
- try
- {
- xmlEvent = xmlEventReader.peek();
- }
- catch (XMLStreamException e)
- {
- throw new ParsingException( e );
- }
+ XMLEvent xmlEvent = StaxParserUtil.peek(xmlEventReader);
if( xmlEvent instanceof StartElement )
{
@@ -76,14 +67,7 @@
}
else
{
- try
- {
- xmlEventReader.nextEvent();
- }
- catch (XMLStreamException e)
- {
- throw new ParsingException( e );
- }
+ StaxParserUtil.getNextEvent(xmlEventReader);
}
}
throw new RuntimeException( "WSTrust Parsing has failed" );
Show replies by date