You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by mu...@apache.org on 2004/10/16 10:15:27 UTC

cvs commit: ws-fx/wss4j/src/org/apache/ws/security/message/token SecurityTokenReference.java

muthulee    2004/10/16 01:15:27

  Modified:    wss4j/src/org/apache/ws/security/message/token
                        SecurityTokenReference.java
  Log:
  Adding Ruchith's changes to the SecurityTokenReference
  
  Revision  Changes    Path
  1.18      +19 -0     ws-fx/wss4j/src/org/apache/ws/security/message/token/SecurityTokenReference.java
  
  Index: SecurityTokenReference.java
  ===================================================================
  RCS file: /home/cvs/ws-fx/wss4j/src/org/apache/ws/security/message/token/SecurityTokenReference.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SecurityTokenReference.java	9 Aug 2004 17:53:45 -0000	1.17
  +++ SecurityTokenReference.java	16 Oct 2004 08:15:27 -0000	1.18
  @@ -35,6 +35,8 @@
   import org.w3c.dom.NodeList;
   import org.w3c.dom.Text;
   
  +import sun.security.x509.KeyIdentifier;
  +
   import java.security.cert.CertificateEncodingException;
   import java.security.cert.X509Certificate;
   
  @@ -277,6 +279,23 @@
               this.element.appendChild(keyId);
           }
       }
  +    
  +	public void setSAMLKeyIdentifier(String keyIdVal)
  +			throws WSSecurityException {
  +		Document doc = this.element.getOwnerDocument();
  +		Element keyId =
  +				doc.createElementNS(wssConfig.getWsseNS(), "wsse:KeyIdentifier");
  +			keyId.setAttributeNS(wssConfig.getWsseNS(),
  +					"ValueType",
  +					"http://docs.oasis-open.org/wss/2004/XX/oasis-2004XX-wss-saml-token-profile-1.0#SAMLAssertionID");
  +		keyId.appendChild(doc.createTextNode(keyIdVal));
  +		Element elem = getFirstElement();
  +		if (elem != null) {
  +			this.element.replaceChild(keyId, elem);
  +		} else {
  +			this.element.appendChild(keyId);
  +		}
  +	}
   
       /**
        * Gets the KeyIdentifer.