[jboss-cvs] Picketlink SVN: r516 - federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 2 18:39:23 EDT 2010


Author: anil.saldhana at jboss.com
Date: 2010-11-02 18:39:23 -0400 (Tue, 02 Nov 2010)
New Revision: 516

Modified:
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java
   federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAuthNRequestParser.java
Log:
PLFED-109: PLFED-110: add some addtl attribs

Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java	2010-11-02 22:23:16 UTC (rev 515)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAssertionParser.java	2010-11-02 22:39:23 UTC (rev 516)
@@ -24,7 +24,6 @@
 import javax.xml.bind.JAXBElement;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.events.Attribute;
 import javax.xml.stream.events.EndElement;
 import javax.xml.stream.events.StartElement;
@@ -191,8 +190,14 @@
       StaxParserUtil.matches( startElement, AUTHNSTATEMENT );
       
       Attribute authnInstant = startElement.getAttributeByName( new QName( "AuthnInstant" ));
+      if( authnInstant == null )
+         throw new RuntimeException( "Required attribute AuthnInstant in " + AUTHNSTATEMENT );
       authnStatementType.setAuthnInstant( XMLTimeUtil.parse( StaxParserUtil.getAttributeValue( authnInstant )));
       
+      Attribute sessionIndex = startElement.getAttributeByName( new QName( "SessionIndex" ));
+      if( sessionIndex != null )
+         authnStatementType.setSessionIndex( StaxParserUtil.getAttributeValue( sessionIndex ));
+      
       //Get the next start element
       startElement = StaxParserUtil.peekNextStartElement( xmlEventReader );
       String tag = startElement.getName().getLocalPart();

Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAuthNRequestParser.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAuthNRequestParser.java	2010-11-02 22:23:16 UTC (rev 515)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/saml/SAMLAuthNRequestParser.java	2010-11-02 22:39:23 UTC (rev 516)
@@ -108,17 +108,20 @@
       
       Attribute assertionConsumerServiceURL = startElement.getAttributeByName( new QName( "AssertionConsumerServiceURL" ));
       if( assertionConsumerServiceURL != null )
-         authnRequest.setAssertionConsumerServiceURL( StaxParserUtil.getAttributeValue( assertionConsumerServiceURL ));
+         authnRequest.setAssertionConsumerServiceURL( StaxParserUtil.getAttributeValue( assertionConsumerServiceURL )); 
+
+      Attribute assertionConsumerServiceIndex = startElement.getAttributeByName( new QName( "AssertionConsumerServiceIndex" ));
+      if( assertionConsumerServiceIndex != null )
+         authnRequest.setAssertionConsumerServiceIndex( Integer.parseInt( StaxParserUtil.getAttributeValue( assertionConsumerServiceIndex )));
       
       Attribute destination = startElement.getAttributeByName( new QName( "Destination" ));
       if( destination != null )
          authnRequest.setDestination( StaxParserUtil.getAttributeValue( destination ));
       
       Attribute issueInstant = startElement.getAttributeByName( new QName( "IssueInstant" ));
-      if( issueInstant != null )
-      {
-         authnRequest.setIssueInstant( XMLTimeUtil.parse( StaxParserUtil.getAttributeValue( issueInstant ))); 
-      }
+      if( issueInstant == null )
+         throw new RuntimeException( "IssueInstant attribute required in AuthnRequest" ); 
+      authnRequest.setIssueInstant( XMLTimeUtil.parse( StaxParserUtil.getAttributeValue( issueInstant )));  
       
       Attribute protocolBinding = startElement.getAttributeByName( new QName( "ProtocolBinding" ));
       if( protocolBinding != null )
@@ -128,9 +131,31 @@
       if( providerName != null )
          authnRequest.setProviderName( StaxParserUtil.getAttributeValue( providerName ));
       
+      Attribute consent = startElement.getAttributeByName( new QName( "Consent" ));
+      if( consent != null )
+         authnRequest.setConsent( StaxParserUtil.getAttributeValue( consent ));
+      
       Attribute version = startElement.getAttributeByName( new QName( "Version" ));
-      if( version != null )
-         authnRequest.setVersion( StaxParserUtil.getAttributeValue( version ));
+      if( version == null )
+         throw new RuntimeException( "Version attribute required in AuthnRequest" );
+      authnRequest.setVersion( StaxParserUtil.getAttributeValue( version ));
+      
+      Attribute forceAuthn = startElement.getAttributeByName( new QName( "ForceAuthn" ));
+      if( forceAuthn != null )
+      {
+         authnRequest.setForceAuthn( Boolean.parseBoolean( StaxParserUtil.getAttributeValue( forceAuthn ) ));
+      }
+      
+      Attribute isPassive = startElement.getAttributeByName( new QName( "IsPassive" ));
+      if( isPassive != null )
+      {
+         authnRequest.setIsPassive( Boolean.parseBoolean( StaxParserUtil.getAttributeValue( isPassive ) ));
+      }
+      
+      Attribute attributeConsumingServiceIndex = startElement.getAttributeByName( new QName( "AttributeConsumingServiceIndex" ));
+      if( attributeConsumingServiceIndex != null )
+         authnRequest.setAttributeConsumingServiceIndex( Integer.parseInt( StaxParserUtil.getAttributeValue( attributeConsumingServiceIndex )));
+      
       return authnRequest; 
    } 
    



More information about the jboss-cvs-commits mailing list