You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2016/05/02 17:57:54 UTC
svn commit: r1741993 [29/29] - in /qpid/java/trunk:
bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb/
bdbstore/src/main/java/resources/js/qpid/management/virtualhost/bdb_ha/
bdbstore/src/main/java/resources/js/qpid/management/virtual...
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/ShaSaslClient.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/ShaSaslClient.js?rev=1741993&r1=1741992&r2=1741993&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/ShaSaslClient.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/ShaSaslClient.js Mon May 2 15:57:52 2016
@@ -26,242 +26,244 @@ define(["dojo/_base/declare",
"dojo/Deferred",
"qpid/sasl/CredentialBasedSaslClient",
"qpid/sasl/UsernamePasswordProvider"],
- function (declare, lang, base64, json, script, uuid, Deferred, SaslClient, UsernamePasswordProvider)
- {
+ function (declare, lang, base64, json, script, uuid, Deferred, SaslClient, UsernamePasswordProvider)
+ {
- var toBase64 = function toBase64(input)
- {
- var result = [];
- for (var i = 0; i < input.length; i++)
- {
- result[i] = input.charCodeAt(i);
- }
- return base64.encode(result)
- };
-
- var fromBase64 = function fromBase64(input)
- {
- var decoded = base64.decode(input);
- var result = "";
- for (var i = 0; i < decoded.length; i++)
- {
- result += String.fromCharCode(decoded[i]);
- }
- return result;
- };
-
- var xor = function xor(lhs, rhs)
- {
- var words = [];
- for (var i = 0; i < lhs.words.length; i++)
- {
- words.push(lhs.words[i] ^ rhs.words[i]);
- }
- return CryptoJS.lib.WordArray.create(words);
- };
-
- var hasNonAscii = function hasNonAscii(name)
- {
- for (var i = 0; i < name.length; i++)
- {
- if (name.charCodeAt(i) > 127)
- {
- return true;
- }
- }
- return false;
- };
-
- var generateSaltedPassword = function generateSaltedPassword(digest, salt, password, iterationCount)
- {
- var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo[digest], password);
- hmac.update(salt);
- hmac.update(CryptoJS.enc.Hex.parse("00000001"));
- var result = hmac.finalize();
- var previous = null;
- for (var i = 1; i < iterationCount; i++)
- {
- hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo[digest], password);
- hmac.update(previous != null ? previous : result);
- previous = hmac.finalize();
- result = xor(result, previous);
- }
- return result;
- };
-
- var scriptLoadError = function scriptLoadError(error)
- {
- var message = "Cannot load script due to " + json.stringify(error);
- console.error(message);
- throw {message: message};
- };
-
- // hidden context scope variables
- var shaName = null;
- var digest = null;
- var hmac = null;
- var gs2_header = "n,,";
- var initialized = new Deferred();
- return declare("qpid.sasl.ShaSaslClient", [SaslClient], {
- _state: "initial",
- "-chains-": {
- constructor: "manual" // disable auto-constructor invocation
- },
- constructor: function (mechanism)
- {
- this._mechanism = mechanism;
- shaName = mechanism.substring(6).replace('-', '').toLowerCase();
- digest = shaName.toUpperCase();
- hmac = "Hmac" + digest;
-
- // loading crypto-js functionality based on mechanism
- script.get("js/crypto-js/hmac-" + shaName + ".js").then(function ()
- {
- script.get(
- "js/crypto-js/enc-base64-min.js")
- .then(function ()
- {
- initialized.resolve(true);
- }, function (error)
- {
- initialized.reject(error);
- scriptLoadError(error);
- });
- }, function (error)
- {
- initialized.reject("error");
- scriptLoadError(error);
- });
- },
- getMechanismName: function ()
- {
- return this._mechanism;
- },
- isComplete: function ()
- {
- return this._state == "completed";
- },
- getResponse: function (data)
- {
- if (initialized.promise.isResolved())
- {
- return this._getResponse(data);
- }
- else
- {
- throw {message: "Not initialized"};
- }
- },
- _getResponse: function (data)
- {
- if (this._state == "initial")
- {
- if (!hasNonAscii(data.username))
- {
- var user = data.username;
- user = user.replace(/=/g, "=3D");
- user = user.replace(/,/g, "=2C");
- this._password = data.password;
- this._username = user;
- this._clientNonce = uuid();
- this._clientFirstMessageBare = "n=" + this._username + ",r=" + this._clientNonce;
- var response = toBase64(gs2_header + this._clientFirstMessageBare);
- this._state = "initiated";
- return {
- mechanism: this.getMechanismName(),
- response: response
- };
- }
- else
- {
- this._state = "error";
- throw {
- message: "Username '" + challenge.username + "' is invalid"
- };
- }
- }
- else if (this._state == "initiated")
- {
- var serverFirstMessage = fromBase64(data.challenge);
- var id = data.id;
- var parts = serverFirstMessage.split(",");
- var nonce = parts[0].substring(2);
- if (!nonce.substr(0, this._clientNonce.length) == this._clientNonce)
- {
- this._state = "error";
- throw {
- message: "Authentication error - server nonce does " + "not start with client nonce"
- };
- }
- else
- {
- var salt = CryptoJS.enc.Base64.parse(parts[1].substring(2));
- var iterationCount = parts[2].substring(2);
- var saltedPassword = generateSaltedPassword(digest, salt, this._password, iterationCount);
- var clientFinalMessageWithoutProof = "c=" + toBase64(gs2_header) + ",r=" + nonce;
- var authMessage = this._clientFirstMessageBare + "," + serverFirstMessage + ","
- + clientFinalMessageWithoutProof;
- var clientKey = CryptoJS[hmac]("Client Key", saltedPassword);
- var storedKey = CryptoJS[digest](clientKey);
- var clientSignature = CryptoJS[hmac](authMessage, storedKey);
- var clientProof = xor(clientKey, clientSignature);
- var serverKey = CryptoJS[hmac]("Server Key", saltedPassword);
- this._serverSignature = CryptoJS[hmac](authMessage, serverKey);
- var response = toBase64(clientFinalMessageWithoutProof + ",p=" + clientProof.toString(
- CryptoJS.enc.Base64));
- this._state = "generated";
- return {
- id: id,
- response: response
- };
- }
- }
- else if (this._state == "generated")
- {
- var serverFinalMessage = fromBase64(data.challenge);
- if (this._serverSignature.toString(CryptoJS.enc.Base64) == serverFinalMessage.substring(2))
- {
- this._state = "completed";
- return null;
- }
- else
- {
- this._state == "error";
- throw {message: "Server signature does not match"};
- }
- }
- else
- {
- throw {
- message: "Unexpected state '" + this._state + ". Cannot handle challenge!"
- };
- }
- },
- toString: function ()
- {
- return "[SaslClient" + this.getMechanismName() + "]";
- },
- getCredentials: function ()
- {
- var credentials = new Deferred();
- var successHandler = function (data)
- {
- credentials.resolve(data);
- };
- var errorHandler = function (data)
- {
- credentials.reject(data)
- };
- initialized.then(function (initData)
- {
- dojo.when(UsernamePasswordProvider.get())
- .then(function (data)
- {
- successHandler(data);
- }, errorHandler);
- }, errorHandler);
- return credentials.promise;
- }
- });
+ var toBase64 = function toBase64(input)
+ {
+ var result = [];
+ for (var i = 0; i < input.length; i++)
+ {
+ result[i] = input.charCodeAt(i);
+ }
+ return base64.encode(result)
+ };
+
+ var fromBase64 = function fromBase64(input)
+ {
+ var decoded = base64.decode(input);
+ var result = "";
+ for (var i = 0; i < decoded.length; i++)
+ {
+ result += String.fromCharCode(decoded[i]);
+ }
+ return result;
+ };
+
+ var xor = function xor(lhs, rhs)
+ {
+ var words = [];
+ for (var i = 0; i < lhs.words.length; i++)
+ {
+ words.push(lhs.words[i] ^ rhs.words[i]);
+ }
+ return CryptoJS.lib.WordArray.create(words);
+ };
+
+ var hasNonAscii = function hasNonAscii(name)
+ {
+ for (var i = 0; i < name.length; i++)
+ {
+ if (name.charCodeAt(i) > 127)
+ {
+ return true;
+ }
+ }
+ return false;
+ };
+
+ var generateSaltedPassword = function generateSaltedPassword(digest, salt, password, iterationCount)
+ {
+ var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo[digest], password);
+ hmac.update(salt);
+ hmac.update(CryptoJS.enc.Hex.parse("00000001"));
+ var result = hmac.finalize();
+ var previous = null;
+ for (var i = 1; i < iterationCount; i++)
+ {
+ hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo[digest], password);
+ hmac.update(previous != null ? previous : result);
+ previous = hmac.finalize();
+ result = xor(result, previous);
+ }
+ return result;
+ };
+
+ var scriptLoadError = function scriptLoadError(error)
+ {
+ var message = "Cannot load script due to " + json.stringify(error);
+ console.error(message);
+ throw {message: message};
+ };
+
+ // hidden context scope variables
+ var shaName = null;
+ var digest = null;
+ var hmac = null;
+ var gs2_header = "n,,";
+ var initialized = new Deferred();
+ return declare("qpid.sasl.ShaSaslClient", [SaslClient], {
+ _state: "initial",
+ "-chains-": {
+ constructor: "manual" // disable auto-constructor invocation
+ },
+ constructor: function (mechanism)
+ {
+ this._mechanism = mechanism;
+ shaName = mechanism.substring(6)
+ .replace('-', '')
+ .toLowerCase();
+ digest = shaName.toUpperCase();
+ hmac = "Hmac" + digest;
+
+ // loading crypto-js functionality based on mechanism
+ script.get("js/crypto-js/hmac-" + shaName + ".js")
+ .then(function ()
+ {
+ script.get("js/crypto-js/enc-base64-min.js")
+ .then(function ()
+ {
+ initialized.resolve(true);
+ }, function (error)
+ {
+ initialized.reject(error);
+ scriptLoadError(error);
+ });
+ }, function (error)
+ {
+ initialized.reject("error");
+ scriptLoadError(error);
+ });
+ },
+ getMechanismName: function ()
+ {
+ return this._mechanism;
+ },
+ isComplete: function ()
+ {
+ return this._state == "completed";
+ },
+ getResponse: function (data)
+ {
+ if (initialized.promise.isResolved())
+ {
+ return this._getResponse(data);
+ }
+ else
+ {
+ throw {message: "Not initialized"};
+ }
+ },
+ _getResponse: function (data)
+ {
+ if (this._state == "initial")
+ {
+ if (!hasNonAscii(data.username))
+ {
+ var user = data.username;
+ user = user.replace(/=/g, "=3D");
+ user = user.replace(/,/g, "=2C");
+ this._password = data.password;
+ this._username = user;
+ this._clientNonce = uuid();
+ this._clientFirstMessageBare = "n=" + this._username + ",r=" + this._clientNonce;
+ var response = toBase64(gs2_header + this._clientFirstMessageBare);
+ this._state = "initiated";
+ return {
+ mechanism: this.getMechanismName(),
+ response: response
+ };
+ }
+ else
+ {
+ this._state = "error";
+ throw {
+ message: "Username '" + challenge.username + "' is invalid"
+ };
+ }
+ }
+ else if (this._state == "initiated")
+ {
+ var serverFirstMessage = fromBase64(data.challenge);
+ var id = data.id;
+ var parts = serverFirstMessage.split(",");
+ var nonce = parts[0].substring(2);
+ if (!nonce.substr(0, this._clientNonce.length) == this._clientNonce)
+ {
+ this._state = "error";
+ throw {
+ message: "Authentication error - server nonce does " + "not start with client nonce"
+ };
+ }
+ else
+ {
+ var salt = CryptoJS.enc.Base64.parse(parts[1].substring(2));
+ var iterationCount = parts[2].substring(2);
+ var saltedPassword = generateSaltedPassword(digest, salt, this._password, iterationCount);
+ var clientFinalMessageWithoutProof = "c=" + toBase64(gs2_header) + ",r=" + nonce;
+ var authMessage = this._clientFirstMessageBare + "," + serverFirstMessage + ","
+ + clientFinalMessageWithoutProof;
+ var clientKey = CryptoJS[hmac]("Client Key", saltedPassword);
+ var storedKey = CryptoJS[digest](clientKey);
+ var clientSignature = CryptoJS[hmac](authMessage, storedKey);
+ var clientProof = xor(clientKey, clientSignature);
+ var serverKey = CryptoJS[hmac]("Server Key", saltedPassword);
+ this._serverSignature = CryptoJS[hmac](authMessage, serverKey);
+ var response = toBase64(clientFinalMessageWithoutProof + ",p="
+ + clientProof.toString(CryptoJS.enc.Base64));
+ this._state = "generated";
+ return {
+ id: id,
+ response: response
+ };
+ }
+ }
+ else if (this._state == "generated")
+ {
+ var serverFinalMessage = fromBase64(data.challenge);
+ if (this._serverSignature.toString(CryptoJS.enc.Base64) == serverFinalMessage.substring(2))
+ {
+ this._state = "completed";
+ return null;
+ }
+ else
+ {
+ this._state == "error";
+ throw {message: "Server signature does not match"};
+ }
+ }
+ else
+ {
+ throw {
+ message: "Unexpected state '" + this._state + ". Cannot handle challenge!"
+ };
+ }
+ },
+ toString: function ()
+ {
+ return "[SaslClient" + this.getMechanismName() + "]";
+ },
+ getCredentials: function ()
+ {
+ var credentials = new Deferred();
+ var successHandler = function (data)
+ {
+ credentials.resolve(data);
+ };
+ var errorHandler = function (data)
+ {
+ credentials.reject(data)
+ };
+ initialized.then(function (initData)
+ {
+ dojo.when(UsernamePasswordProvider.get())
+ .then(function (data)
+ {
+ successHandler(data);
+ }, errorHandler);
+ }, errorHandler);
+ return credentials.promise;
+ }
+ });
- });
\ No newline at end of file
+ });
\ No newline at end of file
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/cram-md5-hex/SaslClient.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/cram-md5-hex/SaslClient.js?rev=1741993&r1=1741992&r2=1741993&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/cram-md5-hex/SaslClient.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/cram-md5-hex/SaslClient.js Mon May 2 15:57:52 2016
@@ -23,24 +23,24 @@ define(["dojo/_base/declare",
"dojox/encoding/digests/_base",
"dojox/encoding/digests/MD5",
"qpid/sasl/cram-md5/SaslClient"], function (declare, lang, base64, digestsBase, MD5, SaslClientCramMD5)
- {
- return declare("qpid.sasl.SaslClientCramMD5Hex", [SaslClientCramMD5], {
- getMechanismName: function ()
- {
- return "CRAM-MD5-HEX";
- },
- getPriority: function ()
- {
- return 2;
- },
- initialize: function (username, password)
- {
- var hashedPassword = MD5(password, digestsBase.outputTypes.Hex);
- this.inherited(arguments, [username, hashedPassword]);
- },
- toString: function ()
- {
- return "[SaslClientCramMD5Hex]";
- }
- });
- });
\ No newline at end of file
+{
+ return declare("qpid.sasl.SaslClientCramMD5Hex", [SaslClientCramMD5], {
+ getMechanismName: function ()
+ {
+ return "CRAM-MD5-HEX";
+ },
+ getPriority: function ()
+ {
+ return 2;
+ },
+ initialize: function (username, password)
+ {
+ var hashedPassword = MD5(password, digestsBase.outputTypes.Hex);
+ this.inherited(arguments, [username, hashedPassword]);
+ },
+ toString: function ()
+ {
+ return "[SaslClientCramMD5Hex]";
+ }
+ });
+});
\ No newline at end of file
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/cram-md5/SaslClient.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/cram-md5/SaslClient.js?rev=1741993&r1=1741992&r2=1741993&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/cram-md5/SaslClient.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/cram-md5/SaslClient.js Mon May 2 15:57:52 2016
@@ -24,95 +24,97 @@ define(["dojo/_base/declare",
"dojox/encoding/digests/MD5",
"qpid/sasl/CredentialBasedSaslClient",
"qpid/sasl/UsernamePasswordProvider"],
- function (declare, lang, base64, digestsBase, MD5, SaslClient, UsernamePasswordProvider)
- {
- return declare("qpid.sasl.SaslClientCramMD5", [SaslClient], {
- _state: "initial",
- getMechanismName: function ()
- {
- return "CRAM-MD5";
- },
- isComplete: function ()
- {
- return this._state == "completed";
- },
- getPriority: function ()
- {
- return 3;
- },
- getResponse: function (data)
- {
- if (this._state == "initial")
- {
- this.initialize(data.username, data.password);
- this._state = "initiated";
- return {
- mechanism: this.getMechanismName()
- };
- }
- else if (this._state == "initiated")
- {
- var challengeBytes = base64.decode(data.challenge);
- var wa = [];
- var bitLength = challengeBytes.length * 8;
- for (var i = 0; i < bitLength; i += 8)
- {
- wa[i >> 5] |= (challengeBytes[i / 8] & 0xFF) << (i % 32);
- }
- var challengeStr = digestsBase.wordToString(wa)
- .substring(0, challengeBytes.length);
+ function (declare, lang, base64, digestsBase, MD5, SaslClient, UsernamePasswordProvider)
+ {
+ return declare("qpid.sasl.SaslClientCramMD5", [SaslClient], {
+ _state: "initial",
+ getMechanismName: function ()
+ {
+ return "CRAM-MD5";
+ },
+ isComplete: function ()
+ {
+ return this._state == "completed";
+ },
+ getPriority: function ()
+ {
+ return 3;
+ },
+ getResponse: function (data)
+ {
+ if (this._state == "initial")
+ {
+ this.initialize(data.username, data.password);
+ this._state = "initiated";
+ return {
+ mechanism: this.getMechanismName()
+ };
+ }
+ else if (this._state == "initiated")
+ {
+ var challengeBytes = base64.decode(data.challenge);
+ var wa = [];
+ var bitLength = challengeBytes.length * 8;
+ for (var i = 0; i < bitLength; i += 8)
+ {
+ wa[i >> 5] |= (challengeBytes[i / 8] & 0xFF) << (i % 32);
+ }
+ var challengeStr = digestsBase.wordToString(wa)
+ .substring(0, challengeBytes.length);
- var digest = this._username + " " + MD5._hmac(challengeStr,
- this._password,
- digestsBase.outputTypes.Hex);
- var id = data.id;
+ var digest = this._username + " " + MD5._hmac(challengeStr,
+ this._password,
+ digestsBase.outputTypes.Hex);
+ var id = data.id;
- var response = base64.encode(this._encodeUTF8(digest));
- this._state = "completed";
- return {
- id: id,
- response: response
- };
- }
- else
- {
- throw {
- message: "Unexpected state '" + this._state + ". Cannot handle challenge!"
- };
- }
- },
- toString: function ()
- {
- return "[SaslClientCramMD5]";
- },
- getCredentials: function ()
- {
- return UsernamePasswordProvider.get();
- },
- initialize: function (username, password)
- {
- this._password = password;
- this._username = username;
- },
- _encodeUTF8: function (str)
- {
- var byteArray = [];
- for (var i = 0; i < str.length; i++)
- {
- if (str.charCodeAt(i) <= 0x7F)
- {
- byteArray.push(str.charCodeAt(i));
- }
- else
- {
- var h = encodeURIComponent(str.charAt(i)).substr(1).split('%');
- for (var j = 0; j < h.length; j++)
- {
- byteArray.push(parseInt(h[j], 16));
- }
- }
- }
- return byteArray;
- }
- });
- });
\ No newline at end of file
+ var response = base64.encode(this._encodeUTF8(digest));
+ this._state = "completed";
+ return {
+ id: id,
+ response: response
+ };
+ }
+ else
+ {
+ throw {
+ message: "Unexpected state '" + this._state + ". Cannot handle challenge!"
+ };
+ }
+ },
+ toString: function ()
+ {
+ return "[SaslClientCramMD5]";
+ },
+ getCredentials: function ()
+ {
+ return UsernamePasswordProvider.get();
+ },
+ initialize: function (username, password)
+ {
+ this._password = password;
+ this._username = username;
+ },
+ _encodeUTF8: function (str)
+ {
+ var byteArray = [];
+ for (var i = 0; i < str.length; i++)
+ {
+ if (str.charCodeAt(i) <= 0x7F)
+ {
+ byteArray.push(str.charCodeAt(i));
+ }
+ else
+ {
+ var h = encodeURIComponent(str.charAt(i))
+ .substr(1)
+ .split('%');
+ for (var j = 0; j < h.length; j++)
+ {
+ byteArray.push(parseInt(h[j], 16));
+ }
+ }
+ }
+ return byteArray;
+ }
+ });
+ });
\ No newline at end of file
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/plain/SaslClient.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/plain/SaslClient.js?rev=1741993&r1=1741992&r2=1741993&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/plain/SaslClient.js (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/resources/js/qpid/sasl/plain/SaslClient.js Mon May 2 15:57:52 2016
@@ -22,69 +22,71 @@ define(["dojo/_base/declare",
"dojox/encoding/base64",
"qpid/sasl/CredentialBasedSaslClient",
"qpid/sasl/UsernamePasswordProvider"], function (declare, lang, base64, SaslClient, UsernamePasswordProvider)
- {
- return declare("qpid.sasl.SaslClientPlain", [SaslClient], {
- _state: "initial",
- getMechanismName: function ()
- {
- return "PLAIN";
- },
- isComplete: function ()
- {
- return this._state == "completed";
- },
- getPriority: function ()
- {
- return 1;
- },
- getResponse: function (challenge)
- {
- if (this._state == "initial")
- {
- var responseArray = [0].concat(this._encodeUTF8(challenge.username))
- .concat([0])
- .concat(this._encodeUTF8(challenge.password));
- var plainResponse = base64.encode(responseArray);
- this._state = "completed"
- return {
- mechanism: this.getMechanismName(),
- response: plainResponse
- };
- }
- else
- {
- throw {
- message: "Unexpected state '" + this._state + ". Cannot handle challenge!"
- };
- }
- },
- toString: function ()
- {
- return "[SaslClientPlain]";
- },
- getCredentials: function ()
- {
- return UsernamePasswordProvider.get();
- },
- _encodeUTF8: function (str)
- {
- var byteArray = [];
- for (var i = 0; i < str.length; i++)
- {
- if (str.charCodeAt(i) <= 0x7F)
- {
- byteArray.push(str.charCodeAt(i));
- }
- else
- {
- var h = encodeURIComponent(str.charAt(i)).substr(1).split('%');
- for (var j = 0; j < h.length; j++)
- {
- byteArray.push(parseInt(h[j], 16));
- }
- }
- }
- return byteArray;
- }
- });
- });
\ No newline at end of file
+{
+ return declare("qpid.sasl.SaslClientPlain", [SaslClient], {
+ _state: "initial",
+ getMechanismName: function ()
+ {
+ return "PLAIN";
+ },
+ isComplete: function ()
+ {
+ return this._state == "completed";
+ },
+ getPriority: function ()
+ {
+ return 1;
+ },
+ getResponse: function (challenge)
+ {
+ if (this._state == "initial")
+ {
+ var responseArray = [0].concat(this._encodeUTF8(challenge.username))
+ .concat([0])
+ .concat(this._encodeUTF8(challenge.password));
+ var plainResponse = base64.encode(responseArray);
+ this._state = "completed"
+ return {
+ mechanism: this.getMechanismName(),
+ response: plainResponse
+ };
+ }
+ else
+ {
+ throw {
+ message: "Unexpected state '" + this._state + ". Cannot handle challenge!"
+ };
+ }
+ },
+ toString: function ()
+ {
+ return "[SaslClientPlain]";
+ },
+ getCredentials: function ()
+ {
+ return UsernamePasswordProvider.get();
+ },
+ _encodeUTF8: function (str)
+ {
+ var byteArray = [];
+ for (var i = 0; i < str.length; i++)
+ {
+ if (str.charCodeAt(i) <= 0x7F)
+ {
+ byteArray.push(str.charCodeAt(i));
+ }
+ else
+ {
+ var h = encodeURIComponent(str.charAt(i))
+ .substr(1)
+ .split('%');
+ for (var j = 0; j < h.length; j++)
+ {
+ byteArray.push(parseInt(h[j], 16));
+ }
+ }
+ }
+ return byteArray;
+ }
+ });
+});
\ No newline at end of file
Modified: qpid/java/trunk/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/add.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/add.js?rev=1741993&r1=1741992&r2=1741993&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/add.js (original)
+++ qpid/java/trunk/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhost/memory/add.js Mon May 2 15:57:52 2016
@@ -25,12 +25,12 @@ define(["dojo/_base/xhr",
"dojo/text!virtualhost/memory/add.html",
"dijit/form/ValidationTextBox",
"dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template)
- {
- return {
- show: function (data)
- {
- this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
- parser.parse(this.containerNode);
- }
- };
- });
+{
+ return {
+ show: function (data)
+ {
+ this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
+ parser.parse(this.containerNode);
+ }
+ };
+});
Modified: qpid/java/trunk/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js?rev=1741993&r1=1741992&r2=1741993&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js (original)
+++ qpid/java/trunk/broker-plugins/memory-store/src/main/java/resources/js/qpid/management/virtualhostnode/memory/add.js Mon May 2 15:57:52 2016
@@ -27,12 +27,12 @@ define(["dojo/_base/xhr",
"dojo/text!virtualhostnode/memory/add.html",
"dijit/form/ValidationTextBox",
"dojo/domReady!"], function (xhr, parser, dom, domConstruct, json, registry, template)
- {
- return {
- show: function (data)
- {
- this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
- parser.parse(this.containerNode);
- }
- };
- });
+{
+ return {
+ show: function (data)
+ {
+ this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode);
+ parser.parse(this.containerNode);
+ }
+ };
+});
Modified: qpid/java/trunk/perftests/etc/testdefs/defaultTests.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/perftests/etc/testdefs/defaultTests.js?rev=1741993&r1=1741992&r2=1741993&view=diff
==============================================================================
--- qpid/java/trunk/perftests/etc/testdefs/defaultTests.js (original)
+++ qpid/java/trunk/perftests/etc/testdefs/defaultTests.js Mon May 2 15:57:52 2016
@@ -89,25 +89,18 @@ function createTest(name, numberOfPartic
var queueName = "testQueue_" + i;
var destination = queueName;
test._queues.push({
- "_name": destination,
- "_durable": true
- });
+ "_name": destination,
+ "_durable": true
+ });
test._clients.push({
- "_name": "producingClient_" + i,
- "_connections": [createProducerConnection(i,
- connectionFactory,
- destination,
- acknowledgeMode,
- deliveryMode)]
- });
+ "_name": "producingClient_" + i,
+ "_connections": [createProducerConnection(i, connectionFactory, destination, acknowledgeMode, deliveryMode)]
+ });
test._clients.push({
- "_name": "consumingClient_" + i,
- "_connections": [createConsumerConnection(i,
- connectionFactory,
- destination,
- acknowledgeMode)]
- });
+ "_name": "consumingClient_" + i,
+ "_connections": [createConsumerConnection(i, connectionFactory, destination, acknowledgeMode)]
+ });
}
return test;
@@ -115,24 +108,24 @@ function createTest(name, numberOfPartic
var jsonObject = {
_tests: [createTest("persistent_transaction_plain",
- numberOfParticipantPairs,
- ACKNOWLEDGE_MODE_SESSION_TRANSACTED,
- DELIVERY_MODE_PERSISTENT,
- "PLAIN"),
+ numberOfParticipantPairs,
+ ACKNOWLEDGE_MODE_SESSION_TRANSACTED,
+ DELIVERY_MODE_PERSISTENT,
+ "PLAIN"),
createTest("transient_autoack_plain",
- numberOfParticipantPairs,
- ACKNOWLEDGE_MODE_AUTO_ACKNOWLEDGE,
- DELIVERY_MODE_TRANSIENT,
- "PLAIN"),
+ numberOfParticipantPairs,
+ ACKNOWLEDGE_MODE_AUTO_ACKNOWLEDGE,
+ DELIVERY_MODE_TRANSIENT,
+ "PLAIN"),
createTest("persistent_transaction_ssl",
- numberOfParticipantPairs,
- ACKNOWLEDGE_MODE_SESSION_TRANSACTED,
- DELIVERY_MODE_PERSISTENT,
- "SSL"),
+ numberOfParticipantPairs,
+ ACKNOWLEDGE_MODE_SESSION_TRANSACTED,
+ DELIVERY_MODE_PERSISTENT,
+ "SSL"),
createTest("transient_autoack_ssl",
- numberOfParticipantPairs,
- ACKNOWLEDGE_MODE_AUTO_ACKNOWLEDGE,
- DELIVERY_MODE_TRANSIENT,
- "SSL")]
+ numberOfParticipantPairs,
+ ACKNOWLEDGE_MODE_AUTO_ACKNOWLEDGE,
+ DELIVERY_MODE_TRANSIENT,
+ "SSL")]
};
Modified: qpid/java/trunk/perftests/src/main/java/json2.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/perftests/src/main/java/json2.js?rev=1741993&r1=1741992&r2=1741993&view=diff
==============================================================================
--- qpid/java/trunk/perftests/src/main/java/json2.js (original)
+++ qpid/java/trunk/perftests/src/main/java/json2.js Mon May 2 15:57:52 2016
@@ -214,7 +214,8 @@ if (!JSON)
return escapable.test(string) ? '"' + string.replace(escapable, function (a)
{
var c = meta[a];
- return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0)
+ .toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
@@ -460,7 +461,8 @@ if (!JSON)
{
text = text.replace(cx, function (a)
{
- return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ return '\\u' + ('0000' + a.charCodeAt(0)
+ .toString(16)).slice(-4);
});
}
@@ -479,8 +481,8 @@ if (!JSON)
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
- .replace(/(?:^|:|,)(?:\s*\[)+/g, '')))
+ .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
+ .replace(/(?:^|:|,)(?:\s*\[)+/g, '')))
{
// In the third stage we use the eval function to compile the text into a
Modified: qpid/java/trunk/qpid-perftests-systests/src/test/resources/org/apache/qpid/systest/disttest/endtoend/hillclimbing.js
URL: http://svn.apache.org/viewvc/qpid/java/trunk/qpid-perftests-systests/src/test/resources/org/apache/qpid/systest/disttest/endtoend/hillclimbing.js?rev=1741993&r1=1741992&r2=1741993&view=diff
==============================================================================
--- qpid/java/trunk/qpid-perftests-systests/src/test/resources/org/apache/qpid/systest/disttest/endtoend/hillclimbing.js (original)
+++ qpid/java/trunk/qpid-perftests-systests/src/test/resources/org/apache/qpid/systest/disttest/endtoend/hillclimbing.js Mon May 2 15:57:52 2016
@@ -24,7 +24,8 @@ var acknowledgeMode = 0;
var deliveryMode = 2;
var queueName = "testQueueHillClimbing";
-var destination = "BURL:direct://amq.direct//".concat(queueName).concat("?durable='true'");
+var destination = "BURL:direct://amq.direct//".concat(queueName)
+ .concat("?durable='true'");
var test = {
"_name": "HillClimbing",
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org