Initial working google auth
This commit is contained in:
parent
fb52d49f74
commit
00a40f6bba
1058 changed files with 114441 additions and 0 deletions
44
auth-service/node_modules/passport-oauth2/lib/errors/authorizationerror.js
generated
vendored
Normal file
44
auth-service/node_modules/passport-oauth2/lib/errors/authorizationerror.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* `AuthorizationError` error.
|
||||
*
|
||||
* AuthorizationError represents an error in response to an authorization
|
||||
* request. For details, refer to RFC 6749, section 4.1.2.1.
|
||||
*
|
||||
* References:
|
||||
* - [The OAuth 2.0 Authorization Framework](http://tools.ietf.org/html/rfc6749)
|
||||
*
|
||||
* @constructor
|
||||
* @param {String} [message]
|
||||
* @param {String} [code]
|
||||
* @param {String} [uri]
|
||||
* @param {Number} [status]
|
||||
* @api public
|
||||
*/
|
||||
function AuthorizationError(message, code, uri, status) {
|
||||
if (!status) {
|
||||
switch (code) {
|
||||
case 'access_denied': status = 403; break;
|
||||
case 'server_error': status = 502; break;
|
||||
case 'temporarily_unavailable': status = 503; break;
|
||||
}
|
||||
}
|
||||
|
||||
Error.call(this);
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
this.name = this.constructor.name;
|
||||
this.message = message;
|
||||
this.code = code || 'server_error';
|
||||
this.uri = uri;
|
||||
this.status = status || 500;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Error`.
|
||||
*/
|
||||
AuthorizationError.prototype.__proto__ = Error.prototype;
|
||||
|
||||
|
||||
/**
|
||||
* Expose `AuthorizationError`.
|
||||
*/
|
||||
module.exports = AuthorizationError;
|
||||
49
auth-service/node_modules/passport-oauth2/lib/errors/internaloautherror.js
generated
vendored
Normal file
49
auth-service/node_modules/passport-oauth2/lib/errors/internaloautherror.js
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* `InternalOAuthError` error.
|
||||
*
|
||||
* InternalOAuthError wraps errors generated by node-oauth. By wrapping these
|
||||
* objects, error messages can be formatted in a manner that aids in debugging
|
||||
* OAuth issues.
|
||||
*
|
||||
* @constructor
|
||||
* @param {String} [message]
|
||||
* @param {Object|Error} [err]
|
||||
* @api public
|
||||
*/
|
||||
function InternalOAuthError(message, err) {
|
||||
Error.call(this);
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
this.name = this.constructor.name;
|
||||
this.message = message;
|
||||
this.oauthError = err;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Error`.
|
||||
*/
|
||||
InternalOAuthError.prototype.__proto__ = Error.prototype;
|
||||
|
||||
/**
|
||||
* Returns a string representing the error.
|
||||
*
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
InternalOAuthError.prototype.toString = function() {
|
||||
var m = this.name;
|
||||
if (this.message) { m += ': ' + this.message; }
|
||||
if (this.oauthError) {
|
||||
if (this.oauthError instanceof Error) {
|
||||
m = this.oauthError.toString();
|
||||
} else if (this.oauthError.statusCode && this.oauthError.data) {
|
||||
m += ' (status: ' + this.oauthError.statusCode + ' data: ' + this.oauthError.data + ')';
|
||||
}
|
||||
}
|
||||
return m;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Expose `InternalOAuthError`.
|
||||
*/
|
||||
module.exports = InternalOAuthError;
|
||||
36
auth-service/node_modules/passport-oauth2/lib/errors/tokenerror.js
generated
vendored
Normal file
36
auth-service/node_modules/passport-oauth2/lib/errors/tokenerror.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* `TokenError` error.
|
||||
*
|
||||
* TokenError represents an error received from a token endpoint. For details,
|
||||
* refer to RFC 6749, section 5.2.
|
||||
*
|
||||
* References:
|
||||
* - [The OAuth 2.0 Authorization Framework](http://tools.ietf.org/html/rfc6749)
|
||||
*
|
||||
* @constructor
|
||||
* @param {String} [message]
|
||||
* @param {String} [code]
|
||||
* @param {String} [uri]
|
||||
* @param {Number} [status]
|
||||
* @api public
|
||||
*/
|
||||
function TokenError(message, code, uri, status) {
|
||||
Error.call(this);
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
this.name = this.constructor.name;
|
||||
this.message = message;
|
||||
this.code = code || 'invalid_request';
|
||||
this.uri = uri;
|
||||
this.status = status || 500;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `Error`.
|
||||
*/
|
||||
TokenError.prototype.__proto__ = Error.prototype;
|
||||
|
||||
|
||||
/**
|
||||
* Expose `TokenError`.
|
||||
*/
|
||||
module.exports = TokenError;
|
||||
Loading…
Add table
Add a link
Reference in a new issue