Author: anil.saldhana(a)jboss.com
Date: 2010-10-22 21:19:39 -0400 (Fri, 22 Oct 2010)
New Revision: 504
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/wsa/WSAddressingParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wsse/WSSecurityParser.java
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java
Log:
add the text char check
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-23
01:17:02 UTC (rev 503)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLConditionsParser.java 2010-10-23
01:19:39 UTC (rev 504)
@@ -163,6 +163,9 @@
if( !StaxParserUtil.matches(audienceElement, JBossSAMLConstants.AUDIENCE.get() )
)
break;
+ if( !StaxParserUtil.hasTextAhead( xmlEventReader ))
+ throw new ParsingException( "audienceValue is expected ahead" );
+
String audienceValue = StaxParserUtil.getElementText( xmlEventReader );
audience.getAudience().add( audienceValue );
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wsa/WSAddressingParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wsa/WSAddressingParser.java 2010-10-23
01:17:02 UTC (rev 503)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wsa/WSAddressingParser.java 2010-10-23
01:19:39 UTC (rev 504)
@@ -71,6 +71,10 @@
startElement = StaxParserUtil.getNextStartElement( xmlEventReader );
StaxParserUtil.validate(startElement, ADDRESS );
+
+ if( !StaxParserUtil.hasTextAhead( xmlEventReader ))
+ throw new ParsingException( "endpointURI is expected ahead"
);
+
String endpointURI = StaxParserUtil.getElementText( xmlEventReader );
AttributedURIType attributedURI = new AttributedURIType();
@@ -79,7 +83,8 @@
reference.setAddress(attributedURI);
//Lets get the end element
- EndElement endElement = (EndElement)
StaxParserUtil.getNextEvent(xmlEventReader);
+ xmlEvent = StaxParserUtil.getNextEvent(xmlEventReader);
+ EndElement endElement = (EndElement)xmlEvent;
StaxParserUtil.validate( endElement, ENDPOINT_REFERENCE );
return new ObjectFactory().createEndpointReference( reference );
Modified:
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wsse/WSSecurityParser.java
===================================================================
---
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wsse/WSSecurityParser.java 2010-10-23
01:17:02 UTC (rev 503)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wsse/WSSecurityParser.java 2010-10-23
01:19:39 UTC (rev 504)
@@ -80,6 +80,10 @@
userNameToken.setId( StaxParserUtil.getAttributeValue( idAttribute ));
startElement = StaxParserUtil.getNextStartElement(xmlEventReader);
+
+ if( !StaxParserUtil.hasTextAhead( xmlEventReader ))
+ throw new ParsingException( "userName is expected ahead" );
+
String userName = StaxParserUtil.getElementText(xmlEventReader);
AttributedString attributedString = new AttributedString();
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-23
01:17:02 UTC (rev 503)
+++
federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java 2010-10-23
01:19:39 UTC (rev 504)
@@ -101,6 +101,9 @@
{
subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
+ if( !StaxParserUtil.hasTextAhead( xmlEventReader ))
+ throw new ParsingException( "request type is expected ahead"
);
+
String value = StaxParserUtil.getElementText(xmlEventReader);
requestToken.setRequestType( new URI( value ));
}
@@ -108,6 +111,9 @@
{
subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
+ if( !StaxParserUtil.hasTextAhead( xmlEventReader ))
+ throw new ParsingException( "token type is expected ahead"
);
+
String value = StaxParserUtil.getElementText(xmlEventReader);
requestToken.setTokenType( new URI( value ));
}
@@ -154,6 +160,9 @@
else if( tag.equals( WSTrustConstants.KEY_TYPE ))
{
subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
+ if( !StaxParserUtil.hasTextAhead( xmlEventReader ))
+ throw new ParsingException( "key type is expected ahead" );
+
String keyType = StaxParserUtil.getElementText(xmlEventReader);
try
{
@@ -168,6 +177,10 @@
else if( tag.equals( WSTrustConstants.KEY_SIZE ))
{
subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
+
+ if( !StaxParserUtil.hasTextAhead( xmlEventReader ))
+ throw new ParsingException( "key size is expected ahead" );
+
String keySize = StaxParserUtil.getElementText(xmlEventReader);
try
{
@@ -188,6 +201,10 @@
BinarySecretType binarySecret = new BinarySecretType();
Attribute typeAttribute = subEvent.getAttributeByName( new QName(
"", "Type" ));
binarySecret.setType( StaxParserUtil.getAttributeValue( typeAttribute
));
+
+ if( !StaxParserUtil.hasTextAhead( xmlEventReader ))
+ throw new ParsingException( "binary secret value is expected
ahead" );
+
binarySecret.setValue(
StaxParserUtil.getElementText(xmlEventReader).getBytes() );
entropy.getAny().add( binarySecret );
}