Skip to content

Commit

Permalink
Revert "[FAB-10241]"
Browse files Browse the repository at this point in the history
Fabric ca removed the token changes at https://gerrit.hyperledger.org/r/#/c/22067/

This reverts commit 19d3ddd.

Change-Id: Idf08d0260910a8142d3b2cf03782d718acb5ed78
Signed-off-by: zhaochy <[email protected]>
  • Loading branch information
zhaochy1990 committed May 22, 2018
1 parent 19d3ddd commit ea00937
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions fabric-ca-client/lib/FabricCAClientImpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ var FabricCAClient = class {
path: self._baseAPI + api_method,
method: http_method,
headers: {
Authorization: self.generateAuthToken(http_method, self._baseAPI + api_method, requestObj, signingIdentity)
Authorization: self.generateAuthToken(requestObj, signingIdentity)
},
ca: self._tlsOptions.trustedRoots,
rejectUnauthorized: self._tlsOptions.verify,
Expand Down Expand Up @@ -777,17 +777,16 @@ var FabricCAClient = class {
/*
* Generate authorization token required for accessing fabric-ca APIs
*/
generateAuthToken(method, uri, reqBody, signingIdentity) {
generateAuthToken(reqBody, signingIdentity) {
// specific signing procedure is according to:
// https://github.com/hyperledger/fabric-ca/blob/master/util/util.go#L271
// https://github.com/hyperledger/fabric-ca/blob/master/util/util.go#L213
let cert = Buffer.from(signingIdentity._certificate).toString('base64');
let b64Uri = Buffer.from(uri).toString('base64');
let bodyAndcert = method + '.' + b64Uri + '.';
let bodyAndcert;
if (reqBody) {
let body = Buffer.from(JSON.stringify(reqBody)).toString('base64');
bodyAndcert += body + '.' + cert;
bodyAndcert = body + '.' + cert;
} else {
bodyAndcert += '.' + cert;
bodyAndcert = '.' + cert;
}

let sig = signingIdentity.sign(bodyAndcert, { hashFunction: this._cryptoPrimitives.hash.bind(this._cryptoPrimitives) });
Expand Down

0 comments on commit ea00937

Please sign in to comment.