How to use the express-session.Session.prototype function in express-session

To help you get started, we’ve selected a few express-session examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudfoundry-incubator / service-fabrik-broker / api-controllers / DashboardController.js View on Github external
const errors = require('../common/errors');
const logger = require('../common/logger');
const catalog = require('../common/models').catalog;
const utils = require('../common/utils');
const CONST = require('../common/constants');
const eventmesh = require('../data-access-layer/eventmesh');
const cf = require('../data-access-layer/cf');
const DirectorService = require('../operators/bosh-operator/DirectorService');
const DockerService = require('../operators/docker-operator/DockerService');
const VirtualHostService = require('../operators/virtualhost-operator/VirtualHostService');
const FabrikBaseController = require('./FabrikBaseController');
const Forbidden = errors.Forbidden;
const ContinueWithNext = errors.ContinueWithNext;
const assert = require('assert');

Promise.promisifyAll(crypto, Session.prototype);

class DashboardController extends FabrikBaseController {
  constructor() {
    super();
    this.cloudController = cf.cloudController;
    this.uaa = cf.uaa;
  }

  show(req, res) {
    const managerType = req.service.plan.manager.name;
    return req.service
      .getInfo()
      .then(info => {
        let additional_info = {};
        if (req.service.plan.manager.settings.dashboard_template) {
          additional_info = yaml.safeLoad(_.template(Buffer.from(req.service.plan.manager.settings.dashboard_template, 'base64'))(info));
github cloudfoundry-incubator / service-fabrik-broker / lib / controllers / DashboardController.js View on Github external
const crypto = require('crypto');
const _ = require('lodash');
const yaml = require('js-yaml');
const Promise = require('bluebird');
const Session = require('express-session').Session;
const config = require('../config');
const errors = require('../errors');
const logger = require('../logger');
const catalog = require('../models').catalog;
const utils = require('../utils');
const BaseController = require('./BaseController');
const Forbidden = errors.Forbidden;
const ContinueWithNext = errors.ContinueWithNext;
const CONST = require('../constants');

Promise.promisifyAll(crypto, Session.prototype);

class DashboardController extends BaseController {
  constructor() {
    super();
  }

  show(req, res) {
    const managerType = req.instance.plan.manager.name;
    return req.instance
      .getInfo()
      .then(info => {
        let additional_info = {};
        if (req.instance.plan.manager.settings.dashboard_template) {
          additional_info = yaml.safeLoad(_.template(Buffer.from(req.instance.plan.manager.settings.dashboard_template, 'base64'))(info));
        }
        info = _.assign({