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