atlassian-connect-auth
Version:
Helper for handling webhooks from Atlassian products
37 lines (36 loc) • 1.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthError = exports.AuthErrorCode = void 0;
/**
* Types of possible Validation errors.
*/
var AuthErrorCode;
(function (AuthErrorCode) {
AuthErrorCode["MISSING_JWT"] = "MISSING_JWT";
AuthErrorCode["UNAUTHORIZED_REQUEST"] = "UNAUTHORIZED_REQUEST";
AuthErrorCode["FAILED_TO_DECODE"] = "FAILED_TO_DECODE";
AuthErrorCode["UNKNOWN_ISSUER"] = "UNKNOWN_ISSUER";
AuthErrorCode["WRONG_ISSUER"] = "WRONG_ISSUER";
AuthErrorCode["WRONG_AUDIENCE"] = "WRONG_AUDIENCE";
AuthErrorCode["MISSING_QSH"] = "MISSING_QSH";
AuthErrorCode["INVALID_QSH"] = "INVALID_QSH";
AuthErrorCode["INVALID_SIGNATURE"] = "INVALID_SIGNATURE";
AuthErrorCode["TOKEN_EXPIRED"] = "TOKEN_EXPIRED";
AuthErrorCode["FAILED_TO_OBTAIN_PUBLIC_KEY"] = "FAILED_TO_OBTAIN_PUBLIC_KEY";
AuthErrorCode["MISSING_KID"] = "MISSING_KID";
})(AuthErrorCode = exports.AuthErrorCode || (exports.AuthErrorCode = {}));
/**
* Error thrown when authentication fails upon installation or request verification.
*/
class AuthError extends Error {
constructor(message, { code, originError, connectJwt, unverifiedConnectJwt, qshInfo }) {
super(message);
this.message = message;
this.code = code;
this.originError = originError;
this.connectJwt = connectJwt;
this.unverifiedConnectJwt = unverifiedConnectJwt;
this.qshInfo = qshInfo;
}
}
exports.AuthError = AuthError;