use in-scope PromiseA
This commit is contained in:
parent
22fd3ff917
commit
ccbca7f661
|
@ -217,7 +217,7 @@
|
|||
return OAUTH3.discover(decoded.payload.iss).then(function (directives) {
|
||||
var urlObj = OAUTH3.urls.jwk(directives, decoded);
|
||||
return OAUTH3.request(urlObj).catch(function (err) {
|
||||
return PromiseA.reject({
|
||||
return OAUTH3.PromiseA.reject({
|
||||
message: 'failed to retrieve public key from token issuer'
|
||||
, code: 'E_NO_PUB_KEY'
|
||||
, url: 'https://oauth3.org/docs/errors#E_NO_PUB_KEY'
|
||||
|
@ -225,7 +225,7 @@
|
|||
});
|
||||
});
|
||||
}, function (err) {
|
||||
return PromiseA.reject({
|
||||
return OAUTH3.PromiseA.reject({
|
||||
message: 'token issuer is not a valid OAuth3 provider'
|
||||
, code: 'E_INVALID_ISS'
|
||||
, url: 'https://oauth3.org/docs/errors#E_INVALID_ISS'
|
||||
|
@ -233,7 +233,7 @@
|
|||
});
|
||||
}).then(function (res) {
|
||||
if (res.data.error) {
|
||||
return PromiseA.reject(res.data.error);
|
||||
return OAUTH3.PromiseA.reject(res.data.error);
|
||||
}
|
||||
return res.data;
|
||||
});
|
||||
|
@ -242,7 +242,7 @@
|
|||
var decoded;
|
||||
|
||||
if (!token) {
|
||||
return PromiseA.reject({
|
||||
return OAUTH3.PromiseA.reject({
|
||||
message: 'no token provided'
|
||||
, code: 'E_NO_TOKEN'
|
||||
, url: 'https://oauth3.org/docs/errors#E_NO_TOKEN'
|
||||
|
@ -253,7 +253,7 @@
|
|||
decoded = OAUTH3.jwt.decode(token, {complete: true});
|
||||
} catch (e) {}
|
||||
if (!decoded) {
|
||||
return PromiseA.reject({
|
||||
return OAUTH3.PromiseA.reject({
|
||||
message: 'provided token not a JSON Web Token'
|
||||
, code: 'E_NOT_JWT'
|
||||
, url: 'https://oauth3.org/docs/errors#E_NOT_JWT'
|
||||
|
@ -271,7 +271,7 @@
|
|||
try {
|
||||
return OAUTH3.jwt.verify(token, jwk, opts);
|
||||
} catch (err) {
|
||||
return PromiseA.reject({
|
||||
return OAUTH3.PromiseA.reject({
|
||||
message: 'token verification failed'
|
||||
, code: 'E_INVALID_TOKEN'
|
||||
, url: 'https://oauth3.org/docs/errors#E_INVALID_TOKEN'
|
||||
|
|
Loading…
Reference in New Issue