UNPKG

@fdm-monster/server

Version:

FDM Monster is a bulk OctoPrint manager to set up, configure and monitor 3D printers. Our aim is to provide extremely optimized websocket performance and reliability.

34 lines (33 loc) 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "JwtService", { enumerable: true, get: function() { return JwtService; } }); const _jsonwebtoken = require("jsonwebtoken"); const _serverconstants = require("../../server.constants"); class JwtService { settingsStore; configService; constructor(settingsStore, configService){ this.settingsStore = settingsStore; this.configService = configService; } async signJwtToken(userId, username) { const { jwtSecret, jwtExpiresIn } = await this.settingsStore.getCredentialSettings(); return (0, _jsonwebtoken.sign)({ userId, username }, jwtSecret, { expiresIn: jwtExpiresIn, subject: userId.toString(), audience: this.configService.get(_serverconstants.AppConstants.OVERRIDE_JWT_AUDIENCE, _serverconstants.AppConstants.DEFAULT_JWT_AUDIENCE), issuer: this.configService.get(_serverconstants.AppConstants.OVERRIDE_JWT_ISSUER, _serverconstants.AppConstants.DEFAULT_JWT_ISSUER) }); } } //# sourceMappingURL=jwt.service.js.map