SAML; Dashboard
This commit is contained in:
@@ -2,7 +2,7 @@ const { Service } = require('flitter-di')
|
||||
|
||||
class VueService extends Service {
|
||||
static get services() {
|
||||
return [...super.services, 'configs']
|
||||
return [...super.services, 'configs', 'utility']
|
||||
}
|
||||
|
||||
data(merge = {}) {
|
||||
@@ -15,6 +15,26 @@ class VueService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
session(req, merge = {}) {
|
||||
return {
|
||||
vue_session: this.utility.deep_merge({
|
||||
app: {
|
||||
name: this.configs.get('app.name'),
|
||||
url: this.configs.get('app.url'),
|
||||
},
|
||||
user: {
|
||||
first_name: req.user.first_name,
|
||||
last_name: req.user.last_name,
|
||||
username: req.user.uid,
|
||||
email: req.user.email,
|
||||
tagline: req.user.tagline,
|
||||
user_id: req.user.id,
|
||||
has_mfa: req.user.mfa_enabled,
|
||||
},
|
||||
}, merge)
|
||||
}
|
||||
}
|
||||
|
||||
auth_message(res, {message, next_destination, ...args}) {
|
||||
const text = args.button_text || 'Continue'
|
||||
return res.page('public:message', {
|
||||
@@ -30,6 +50,26 @@ class VueService extends Service {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
confirm(res, {message, yes, no, yes_text = 'Yes', no_text = 'No'}) {
|
||||
return res.page('public:message', {
|
||||
...this.data({
|
||||
message,
|
||||
actions: [
|
||||
{
|
||||
text: no_text,
|
||||
action: 'redirect',
|
||||
next: no,
|
||||
},
|
||||
{
|
||||
text: yes_text,
|
||||
action: 'redirect',
|
||||
next: yes,
|
||||
}
|
||||
],
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = VueService
|
||||
|
||||
16
app/services/cobalt.service.js
Normal file
16
app/services/cobalt.service.js
Normal file
@@ -0,0 +1,16 @@
|
||||
const { Service } = require('flitter-di')
|
||||
|
||||
class CobaltService extends Service {
|
||||
static get services() {
|
||||
return [...super.services, 'Vue']
|
||||
}
|
||||
|
||||
listing(req, res, { title = '', columns, data }) {
|
||||
return res.page('cobalt:listing', {
|
||||
...this.Vue.data({ definition: { title, columns, data } }),
|
||||
...this.Vue.session(req),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = CobaltService
|
||||
22
app/services/saml.service.js
Normal file
22
app/services/saml.service.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const { Service } = require('flitter-di')
|
||||
const fs = require('fs').promises
|
||||
|
||||
class SamlService extends Service {
|
||||
static get services() {
|
||||
return [...super.services, 'configs']
|
||||
}
|
||||
|
||||
config() {
|
||||
return this.configs.get('saml')
|
||||
}
|
||||
|
||||
async private_key() {
|
||||
return String(await fs.readFile(this.configs.get('saml.cert_file.private')))
|
||||
}
|
||||
|
||||
async public_cert() {
|
||||
return String(await fs.readFile(this.configs.get('saml.cert_file.public')))
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = SamlService
|
||||
Reference in New Issue
Block a user