werner      2005/05/06 08:28:02

  Modified:    wss4j/src/org/apache/ws/security/message/token
                        UsernameToken.java
  Log:
  Add a method to get the password type string.
  
  Revision  Changes    Path
  1.15      +11 -3     
ws-fx/wss4j/src/org/apache/ws/security/message/token/UsernameToken.java
  
  Index: UsernameToken.java
  ===================================================================
  RCS file: 
/home/cvs/ws-fx/wss4j/src/org/apache/ws/security/message/token/UsernameToken.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- UsernameToken.java        1 May 2005 18:17:05 -0000       1.14
  +++ UsernameToken.java        6 May 2005 15:28:01 -0000       1.15
  @@ -58,6 +58,7 @@
       protected Element elementPassword = null;

       protected Element elementNonce = null;

       protected Element elementCreated = null;

  +    protected String passwordType = null;

       protected boolean hashed = true;

       private static SecureRandom random = null;

       protected WSSConfig wssConfig = WSSConfig.getDefaultWSConfig();

  @@ -104,8 +105,8 @@
               throw new 
WSSecurityException(WSSecurityException.INVALID_SECURITY_TOKEN, 
"badTokenType01", new Object[]{el});

           }

           hashed = false;

  -        String type = elementPassword.getAttribute("Type");

  -        if (type != null && type.equals(WSConstants.PASSWORD_DIGEST)) {

  +        passwordType = elementPassword.getAttribute("Type");

  +        if (passwordType != null && 
passwordType.equals(WSConstants.PASSWORD_DIGEST)) {

               hashed = true;

               if (elementNonce == null || elementCreated == null) {

                   throw new 
WSSecurityException(WSSecurityException.INVALID_SECURITY_TOKEN, 
"badTokenType01", new Object[]{el});

  @@ -138,7 +139,7 @@
        *                     [EMAIL PROTECTED] WSConstants#PASSWORD_DIGEST} or

        *                     [EMAIL PROTECTED] WSConstants#PASSWORD_TEXT}

        */

  -    public UsernameToken(WSSConfig wssConfig, Document doc, String 
passwordType) {

  +    public UsernameToken(WSSConfig wssConfig, Document doc, String pwType) {

           this.wssConfig = wssConfig;

           this.element = doc.createElementNS(wssConfig.getWsseNS(), "wsse:" + 
WSConstants.USERNAME_TOKEN_LN);

           WSSecurityUtil.setNamespace(this.element, wssConfig.getWsseNS(), 
WSConstants.WSSE_PREFIX);

  @@ -154,6 +155,7 @@
           element.appendChild(elementPassword);

   

           hashed = false;

  +        passwordType = pwType;

           if (passwordType != null && 
passwordType.equals(WSConstants.PASSWORD_DIGEST)) {

               hashed = true;

               addNonce(doc);

  @@ -255,6 +257,12 @@
           return hashed;

       }

   

  +     /**

  +      * @return Returns the passwordType.

  +      */

  +     public String getPasswordType() {

  +             return passwordType;

  +     }

       /**

        * Sets the password string.

        * This function sets the password in the <code>UsernameToken</code>

  
  
  

Reply via email to