const { Controller } = require('libflitter') class SAMLController extends Controller { static get services() { return [...super.services, 'cobalt'] } async get_sp_listing(req, res, next) { return this.cobalt.listing(req, res, { title: 'SAML Service Providers', resource: 'saml/Provider', columns: [ { name: 'Provider Name', field: 'name', }, { name: 'Entity ID', field: 'entity_id', }, { name: 'Has SLO?', field: 'has_slo', renderer: 'boolean', }, { name: 'ACS URL', field: 'acs_url', }, ], actions: [ { type: 'resource', position: 'main', action: 'insert', text: 'Create New', color: 'success', }, ], }) } async get_sp_form(req, res, next) { return this.cobalt.form(req, res, { item: 'SAML Service Provider', plural: 'SAML Service Providers', resource: 'saml/Provider', ...(req.params.id ? { existing_id: req.params.id } : {}), fields: [ { name: 'Provider Name', field: 'name', placeholder: 'Awesome External App', required: true, }, { name: 'Entity ID', field: 'entity_id', placeholder: 'https://my.awesome.app/saml/metadata.xml', required: true, }, { name: 'Assertion Consumer Service URL', field: 'acs_url', placeholder: 'https://my.awesome.app/saml/acs', required: true, }, { name: 'Single-Logout URL', field: 'slo_url', placeholder: 'https://my.awesome.app/saml/logout', }, ], }) } } module.exports = exports = SAMLController