You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by dk...@apache.org on 2008/12/18 04:38:44 UTC
svn commit: r727629 - in /webservices/wss4j/trunk/src/org/apache/ws/security:
WSPasswordCallback.java processor/DerivedKeyTokenProcessor.java
Author: dkulp
Date: Wed Dec 17 19:38:44 2008
New Revision: 727629
URL: http://svn.apache.org/viewvc?rev=727629&view=rev
Log:
Enable callbacks for all types of derived keys, not just the sha1 keys
Modified:
webservices/wss4j/trunk/src/org/apache/ws/security/WSPasswordCallback.java
webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/WSPasswordCallback.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/WSPasswordCallback.java?rev=727629&r1=727628&r2=727629&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/WSPasswordCallback.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/WSPasswordCallback.java Wed Dec 17 19:38:44 2008
@@ -80,7 +80,7 @@
private String password;
private byte[] key;
private int usage;
- private String passwordType;
+ private String type;
private Element customToken;
/**
@@ -102,7 +102,7 @@
public WSPasswordCallback(String id, String pw, String type, int usage) {
identifier = id;
password = pw;
- passwordType = type;
+ this.type = type;
this.usage = usage;
}
/**
@@ -195,9 +195,17 @@
* @return Returns the passwordType.
*/
public String getPasswordType() {
- return passwordType;
+ return type;
}
+ /**
+ * The key type is only relevant for usage <code>ENCRYPTED_KEY_TOKEN</code>
+ *
+ * @return Returns the type.
+ */
+ public String getKeyType() {
+ return type;
+ }
public Element getCustomToken() {
return customToken;
}
Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java?rev=727629&r1=727628&r2=727629&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/DerivedKeyTokenProcessor.java Wed Dec 17 19:38:44 2008
@@ -198,25 +198,20 @@
"noCallback");
}
- WSPasswordCallback pwcb = null;
-
- //Handle the EncryptedKeySHA1 type key references
- if (keyIdentifierType.equals
- (SecurityTokenReference.ENC_KEY_SHA1_URI)) {
-
- pwcb = new WSPasswordCallback(keyIdentifierValue,
+ WSPasswordCallback pwcb = new WSPasswordCallback(keyIdentifierValue,
+ null,
+ keyIdentifierType,
WSPasswordCallback.ENCRYPTED_KEY_TOKEN);
- try {
- cb.handle(new Callback[]{pwcb});
- } catch (IOException e) {
- throw new WSSecurityException(WSSecurityException.FAILURE, "noKey",
- new Object[] { id }, e);
- } catch (UnsupportedCallbackException e) {
- throw new WSSecurityException(WSSecurityException.FAILURE, "noKey",
- new Object[] { id }, e);
- }
-
+ try {
+ cb.handle(new Callback[]{pwcb});
+ } catch (IOException e) {
+ throw new WSSecurityException(WSSecurityException.FAILURE, "noKey",
+ new Object[] { id }, e);
+ } catch (UnsupportedCallbackException e) {
+ throw new WSSecurityException(WSSecurityException.FAILURE, "noKey",
+ new Object[] { id }, e);
}
+
return pwcb.getKey();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org