You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
820 B

const _ = require('lodash')
const fs = require('fs-extra')
const path = require('path')
/* global WIKI */
module.exports = {
Query: {
async authentication() { return {} }
},
Mutation: {
async authentication() { return {} }
},
AuthenticationQuery: {
providers(obj, args, context, info) {
return _.chain(WIKI.auth.strategies).map(str => {
return {
isEnabled: true,
key: str.key,
title: str.title,
useForm: str.useForm
}
}).sortBy(['title']).value()
}
},
AuthenticationProvider: {
icon (ap, args) {
return fs.readFile(path.join(WIKI.ROOTPATH, `assets/svg/auth-icon-${ap.key}.svg`), 'utf8').catch(err => {
if (err.code === 'ENOENT') {
return null
}
throw err
})
}
}
}