[jboss-cvs] Picketlink SVN: r490 - in federation/trunk/picketlink-fed-core/src: main/java/org/picketlink/identity/federation/core/wstrust and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 18 18:26:48 EDT 2010


Author: anil.saldhana at jboss.com
Date: 2010-10-18 18:26:48 -0400 (Mon, 18 Oct 2010)
New Revision: 490

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/wstrust/WSTrustConstants.java
   federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicKeyTestCase.java
Log:
PLFED-109: parse the symmetric key

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-18 22:10:21 UTC (rev 489)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/parsers/wst/WSTRequestSecurityTokenParser.java	2010-10-18 22:26:48 UTC (rev 490)
@@ -43,7 +43,9 @@
 import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
 import org.picketlink.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
 import org.picketlink.identity.federation.ws.policy.AppliesTo;
+import org.picketlink.identity.federation.ws.trust.BinarySecretType;
 import org.picketlink.identity.federation.ws.trust.CancelTargetType;
+import org.picketlink.identity.federation.ws.trust.EntropyType;
 import org.picketlink.identity.federation.ws.trust.OnBehalfOfType;
 import org.picketlink.identity.federation.ws.trust.UseKeyType;
 import org.picketlink.identity.federation.ws.trust.ValidateTargetType;
@@ -151,7 +153,35 @@
                {
                   throw new ParsingException( e );
                }  
-            }  
+            } 
+            else if( tag.equals( WSTrustConstants.KEY_SIZE ))
+            {
+               subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
+               String keySize = StaxParserUtil.getElementText(xmlEventReader);
+               try
+               { 
+                  requestToken.setKeySize(Long.parseLong( keySize ));
+               }
+               catch( NumberFormatException e )
+               {
+                  throw new ParsingException( e );
+               }  
+            } 
+            else if( tag.equals( WSTrustConstants.ENTROPY ))
+            {
+               subEvent = StaxParserUtil.getNextStartElement(xmlEventReader); 
+               EntropyType entropy = new EntropyType();
+               subEvent = StaxParserUtil.getNextStartElement(xmlEventReader);
+               if( StaxParserUtil.matches(subEvent, WSTrustConstants.BINARY_SECRET ))
+               {
+                  BinarySecretType binarySecret = new BinarySecretType();
+                  Attribute typeAttribute = subEvent.getAttributeByName( new QName( "", "Type" ));
+                  binarySecret.setType( StaxParserUtil.getAttributeValue( typeAttribute ));
+                  binarySecret.setValue( StaxParserUtil.getElementText(xmlEventReader).getBytes() ); 
+                  entropy.getAny().add( binarySecret );
+               }
+               requestToken.setEntropy(entropy);
+            }
             else if( tag.equals( WSTrustConstants.USE_KEY ))
             {
                subEvent = StaxParserUtil.getNextStartElement(xmlEventReader); 

Modified: federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/WSTrustConstants.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/WSTrustConstants.java	2010-10-18 22:10:21 UTC (rev 489)
+++ federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/WSTrustConstants.java	2010-10-18 22:26:48 UTC (rev 490)
@@ -82,7 +82,10 @@
    public static final String RSTR_STATUS_TOKEN_TYPE = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/RSTR/Status";
    
    //Element Names
+   public static final String BINARY_SECRET = "BinarySecret";
+   public static final String ENTROPY = "Entropy";
    public static final String On_BEHALF_OF = "OnBehalfOf";
+   public static final String KEY_SIZE = "KeySize";
    public static final String KEY_TYPE = "KeyType";
    public static final String RST = "RequestSecurityToken";
    public static final String RST_COLLECTION = "RequestSecurityTokenCollection";

Modified: federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicKeyTestCase.java
===================================================================
--- federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicKeyTestCase.java	2010-10-18 22:10:21 UTC (rev 489)
+++ federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/parser/wst/WSTrustIssuePublicKeyTestCase.java	2010-10-18 22:26:48 UTC (rev 490)
@@ -38,7 +38,7 @@
 import org.w3c.dom.Element;
 
 /**
- * Validate parsing of RST with Use Key set to a X509 certificate
+ * Validate parsing of RST with Use Key set to a RSA Public Key
  * @author Anil.Saldhana at redhat.com
  * @since Oct 18, 2010
  */



More information about the jboss-cvs-commits mailing list