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 we...@apache.org on 2004/02/29 14:38:18 UTC
cvs commit: ws-fx/wss4j/src/org/apache/ws/security/message/token UsernameToken.java
werner 2004/02/29 05:38:18
Modified: wss4j/src/org/apache/ws/security WSConstants.java
wss4j/src/org/apache/ws/security/message/token
UsernameToken.java
Log:
Adapt UserNameToken to current OASIS WSS specifications.
Revision Changes Path
1.4 +2 -2 ws-fx/wss4j/src/org/apache/ws/security/WSConstants.java
Index: WSConstants.java
===================================================================
RCS file: /home/cvs/ws-fx/wss4j/src/org/apache/ws/security/WSConstants.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WSConstants.java 29 Feb 2004 12:30:35 -0000 1.3
+++ WSConstants.java 29 Feb 2004 13:38:18 -0000 1.4
@@ -86,7 +86,7 @@
* <p/>
* This is a required method as defined by WS Specification, Username token profile.
*/
- public static final String PASSWORD_DIGEST = "PasswordDigest";
+ public static final String PASSWORD_DIGEST = WSSE_NS + "#PasswordDigest";
/**
* Sets the {@link org.apache.ws.security.message.WSSAddUsernameToken#build(Document, String, String) UserNameToken}
@@ -94,7 +94,7 @@
* <p/>
* This is a required method as defined by WS Specification, Username token profile.
*/
- public static final String PASSWORD_TEXT = "PasswordText";
+ public static final String PASSWORD_TEXT = WSSE_NS + "#PasswordText";
/**
* Sets the {@link org.apache.ws.security.message.WSEncryptBody#build(Document, Crypto) encryption}
1.2 +3 -5 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UsernameToken.java 13 Feb 2004 20:43:08 -0000 1.1
+++ UsernameToken.java 29 Feb 2004 13:38:18 -0000 1.2
@@ -91,7 +91,7 @@
throw new WSSecurityException(WSSecurityException.INVALID_SECURITY_TOKEN, "badTokenType01", new Object[]{el});
}
String type = elementPassword.getAttribute("Type");
- if (type.equals("wsse:" + WSConstants.PASSWORD_DIGEST)) {
+ if (type.equals(WSConstants.PASSWORD_DIGEST)) {
hashed = true;
if (elementNonce == null || elementCreated == null) {
throw new WSSecurityException(WSSecurityException.INVALID_SECURITY_TOKEN, "badTokenType01", new Object[]{el});
@@ -140,10 +140,8 @@
if (passwordType.equals(WSConstants.PASSWORD_TEXT)) {
hashed = false;
- this.elementPassword.setAttribute("Type", "wsse:" + WSConstants.PASSWORD_TEXT);
} else {
hashed = true;
- this.elementPassword.setAttribute("Type", "wsse:" + WSConstants.PASSWORD_DIGEST);
if (elementNonce == null) {
addNonce(doc);
@@ -294,7 +292,7 @@
try {
if (!hashed) {
node.setData(pwd);
- this.elementPassword.setAttribute("Type", "wsse:PasswordText");
+ this.elementPassword.setAttribute("Type", WSConstants.PASSWORD_TEXT);
} else {
byte[] b1 = Base64.decode(getNonce());
byte[] b2 = getCreated().getBytes("UTF-8");
@@ -315,7 +313,7 @@
sha.reset();
sha.update(b4);
node.setData(Base64.encode(sha.digest()));
- this.elementPassword.setAttribute("Type", "wsse:PasswordDigest");
+ this.elementPassword.setAttribute("Type", WSConstants.PASSWORD_DIGEST);
}
} catch (Exception e) {
e.printStackTrace();