feat: auth strategies over GraphQL + svg loading
This commit is contained in:
1 parent
51f5c236d6
commit
501f0a9a53
13 files changed
+165
-28
No files matched your search
@@ -1 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" stroke-miterlimit="1.414" viewBox="0 0 159 158" clip-rule="evenodd" stroke-linejoin="round"><path fill="#51b5d7" d="M75.768.125c0 .07-.277.125-.617.125-.34 0-.65.057-.69.127-.04.07-.13.094-.2.053-.06-.04-.1 0-.08.092.03.113-.14.178-.51.205-.41.03-.56.097-.61.28-.04.182-.17.243-.49.243-.33 0-.45.06-.5.25-.05.19-.17.25-.5.25-.32 0-.45.06-.49.238-.03.13-.17.267-.3.3-.13.035-.24.147-.24.25 0 .112-.17.216-.43.266-.26.05-.43.156-.43.264 0 .1-.06.182-.14.182-.08 0-.23.103-.34.228-.11.124-.3.263-.42.308-.12.045-.22.167-.22.272 0 .106-.09.192-.2.192-.11 0-.23.113-.26.25s-.15.25-.25.25-.21.107-.24.238c-.03.13-.17.267-.3.3-.13.035-.24.146-.24.248 0 .102-.11.214-.25.25-.13.036-.25.15-.25.25 0 .102-.11.214-.25.25-.13.036-.25.15-.25.25s-.11.214-.25.25c-.13.036-.25.148-.25.25 0 .102-.11.214-.25.25-.13.036-.25.15-.25.25 0 .102-.11.214-.25.25-.13.036-.25.155-.25.264 0 .11-.09.2-.2.2-.11 0-.23.113-.26.25-.04.138-.15.25-.25.25s-.21.113-.25.25c-.04.137-.15.25-.25.25s-.21.107-.25.238c-.03.132-.17.267-.3.3-.13.036-.24.153-.24.263 0 .11-.09.2-.2.2-.11 0-.23.12-.26.25-.04.14-.15.25-.25.25s-.21.11-.25.24-.17.27-.3.3c-.13.04-.24.15-.24.25s-.11.21-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.16-.25.27 0 .11-.09.2-.2.2-.11 0-.22.11-.26.24-.03.13-.17.27-.3.3-.13.04-.24.15-.24.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.16-.25.27 0 .11-.09.2-.2.2-.11 0-.23.11-.26.25-.04.14-.15.25-.25.25-.11 0-.22.11-.25.25-.04.14-.15.25-.25.25-.11 0-.22.12-.25.25-.04.14-.15.25-.25.25s-.22.11-.25.25c-.04.14-.15.25-.25.25-.11 0-.22.11-.25.25-.04.14-.15.25-.25.25-.11 0-.22.11-.25.24-.04.13-.17.27-.3.3-.14.04-.24.15-.24.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.15-.25.25s-.12.22-.25.25c-.14.04-.25.16-.25.27 0 .11-.09.2-.2.2-.11 0-.23.11-.26.24-.04.13-.17.27-.3.3-.14.04-.24.15-.24.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.15-.25.25 0 .11-.12.22-.25.25-.14.04-.25.16-.25.27 0 .11-.09.2-.2.2-.11 0-.23.12-.27.25-.04.14-.15.25-.25.25s-.21.12-.25.25c-.04.14-.15.25-.25.25s-.21.12-.25.25c-.04.14-.15.25-.25.25s-.21.12-.25.25c-.04.14-.15.25-.25.25s-.21.12-.25.25c-.04.14-.15.25-.25.25s-.21.11-.25.24-.17.27-.3.3c-.13.04-.24.15-.24.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25s-.11.22-.25.25c-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04-.25.15-.25.25 0 .11-.11.22-.25.25-.14.04Line truncated
|
||||
<svg width="100%" height="100%" viewBox="0 0 159 158" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
|
||||
<path fill="#51b5d7" d="M87.477,3.864c-4.583,-4.583 -12.024,-4.583 -16.608,0l-66.432,66.432c-4.583,4.583 -4.583,12.025 0,16.608l67.352,67.352c4.583,4.583 12.025,4.583 16.608,0l66.432,-66.432c4.583,-4.583 4.583,-12.025 0,-16.608l-67.352,-67.352Zm-14.477,44.282c-3.497,-2.176 -5.826,-6.054 -5.826,-10.472c0,-6.803 5.523,-12.326 12.326,-12.326c6.803,0 12.326,5.523 12.326,12.326c0,4.418 -2.329,8.296 -5.826,10.472l0,61.157c0.415,0.214 0.818,0.447 1.208,0.699l24.89,-24.89c-0.909,-1.718 -1.424,-3.676 -1.424,-5.753c0,-6.803 5.523,-12.326 12.326,-12.326c6.803,0 12.326,5.523 12.326,12.326c0,6.803 -5.523,12.326 -12.326,12.326c-1.493,0 -2.924,-0.266 -4.249,-0.753l-25.952,25.951c0.606,1.58 0.938,3.295 0.938,5.088c0,7.857 -6.38,14.236 -14.237,14.236c-7.857,0 -14.237,-6.379 -14.237,-14.236c0,-1.804 0.337,-3.531 0.95,-5.119l-26.466,-26.466c-1.182,0.377 -2.441,0.581 -3.747,0.581c-6.803,0 -12.326,-5.523 -12.326,-12.326c0,-6.803 5.523,-12.326 12.326,-12.326c6.803,0 12.326,5.523 12.326,12.326c0,2.254 -0.606,4.368 -1.665,6.187l25.157,25.157c0.382,-0.245 0.776,-0.473 1.182,-0.682l0,-61.157Z" />
|
||||
<path fill="#97cbe1" d="M91.745,39.094l28.297,28.297c-4.527,1.116 -8.072,4.737 -9.079,9.306l-24.963,-24.963l0,-3.588c3.116,-1.939 5.306,-5.231 5.745,-9.052Zm-24.49,0c0.439,3.821 2.629,7.113 5.745,9.052l0,3.588l-24.846,24.846c-0.785,-4.655 -4.183,-8.427 -8.632,-9.753l27.733,-27.733Z" />
|
||||
<circle fill="#97cbe1" cx="35.84" cy="78.701" r="6.701" />
|
||||
<circle fill="#97cbe1" cx="123.16" cy="79.778" r="6.701" />
|
||||
<circle fill="#97cbe1" cx="79.299" cy="37.243" r="6.701" />
|
||||
<circle fill="#97cbe1" cx="79.633" cy="122.201" r="8.201" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1,8 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve">
|
||||
<path d="M32,19c13.089,0,27-3.154,27-9S45.089,1,32,1S5,4.154,5,10S18.911,19,32,19z"/>
|
||||
<path d="M32,41c13.089,0,27-3.154,27-9V14.436c-1.481,1.493-3.963,2.968-8.022,4.174C45.864,20.128,38.946,21,32,21
|
||||
s-13.864-0.872-18.978-2.391C8.963,17.403,6.481,15.929,5,14.436V32C5,37.846,18.911,41,32,41z"/>
|
||||
<path d="M32,63c13.089,0,27-3.154,27-9V36.436c-1.481,1.493-3.963,2.968-8.022,4.174C45.864,42.128,38.946,43,32,43
|
||||
s-13.864-0.872-18.978-2.391C8.963,39.403,6.481,37.929,5,36.436V54C5,59.846,18.911,63,32,63z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 729 B |
+10
-1
@@ -3,6 +3,8 @@
|
||||
/* global siteConfig */
|
||||
/* eslint-disable no-new */
|
||||
|
||||
import CONSTANTS from './constants'
|
||||
|
||||
import Vue from 'vue'
|
||||
import VueResource from 'vue-resource'
|
||||
import VueClipboards from 'vue-clipboards'
|
||||
@@ -54,11 +56,18 @@ import contentViewComponent from './pages/content-view.component.js'
|
||||
import editorComponent from './components/editor.component.js'
|
||||
import sourceViewComponent from './pages/source-view.component.js'
|
||||
|
||||
// ====================================
|
||||
// Initialize Global Vars
|
||||
// ====================================
|
||||
|
||||
window.wiki = null
|
||||
window.CONSTANTS = CONSTANTS
|
||||
|
||||
// ====================================
|
||||
// Initialize Apollo Client (GraphQL)
|
||||
// ====================================
|
||||
|
||||
window.apollo = new ApolloClient({
|
||||
window.graphQL = new ApolloClient({
|
||||
networkInterface: createBatchingNetworkInterface({
|
||||
uri: window.location.protocol + '//' + window.location.host + siteConfig.path + '/graphql'
|
||||
}),
|
||||
|
||||
@@ -7,11 +7,8 @@
|
||||
| {{ error.title }}
|
||||
span {{ error.message }}
|
||||
.login-providers(v-show='strategies.length > 1')
|
||||
button.is-active(:title='$t("auth:providers.local")')
|
||||
i.nc-icon-outline.ui-1_database
|
||||
span {{ $t('auth:providers.local') }}
|
||||
button(v-for='strategy in strategies', @onclick='selectProvider(strategy.key, strategy.useForm)', :title='strategy.title')
|
||||
//-!= strategy.icon
|
||||
button(v-for='strategy in strategies', :class='{ "is-active": strategy.key === selectedStrategy }', @click='selectStrategy(strategy.key, strategy.useForm)', :title='strategy.title')
|
||||
em(v-html='strategy.icon')
|
||||
span {{ strategy.title }}
|
||||
.login-frame
|
||||
h1 {{ siteTitle }}
|
||||
@@ -32,7 +29,8 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
error: false,
|
||||
strategies: []
|
||||
strategies: [],
|
||||
selectedStrategy: 'local'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -41,9 +39,31 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selectProvider(key, useForm) {
|
||||
|
||||
selectStrategy(key, useForm) {
|
||||
this.selectedStrategy = key
|
||||
if (!useForm) {
|
||||
window.location.assign(siteConfig.path + '/login/' + key)
|
||||
}
|
||||
},
|
||||
refreshStrategies() {
|
||||
graphQL.query({
|
||||
query: CONSTANTS.GRAPHQL.GQL_QUERY_AUTHENTICATION,
|
||||
variables: {
|
||||
mode: 'active'
|
||||
}
|
||||
}).then(resp => {
|
||||
if (resp.data.authentication) {
|
||||
this.strategies = resp.data.authentication
|
||||
} else {
|
||||
throw new Error('No authentication providers available!')
|
||||
}
|
||||
}).catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.refreshStrategies()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
export default {
|
||||
GQL_QUERY_AUTHENTICATION: gql`
|
||||
query($mode: String!) {
|
||||
authentication(mode:$mode) {
|
||||
key
|
||||
useForm
|
||||
title
|
||||
icon
|
||||
}
|
||||
}
|
||||
`,
|
||||
GQL_QUERY_TRANSLATIONS: gql`
|
||||
query($locale: String!, $namespace: String!) {
|
||||
translations(locale:$locale, namespace:$namespace) {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import GRAPHQL from './graphql'
|
||||
|
||||
export default {
|
||||
GRAPHQL
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
import i18next from 'i18next'
|
||||
import i18nextXHR from 'i18next-xhr-backend'
|
||||
import i18nextCache from 'i18next-localstorage-cache'
|
||||
import gql from 'graphql-tag'
|
||||
import VueI18Next from '@panter/vue-i18next'
|
||||
import loSet from 'lodash/set'
|
||||
|
||||
/* global siteConfig */
|
||||
/* global siteConfig, graphQL, CONSTANTS */
|
||||
|
||||
module.exports = {
|
||||
VueI18Next,
|
||||
@@ -19,16 +18,12 @@ module.exports = {
|
||||
parse: (data) => data,
|
||||
ajax: (url, opts, cb, data) => {
|
||||
let langParams = url.split('/')
|
||||
console.info(langParams)
|
||||
window.apollo.query({
|
||||
query: gql`
|
||||
{
|
||||
translations(locale:"${langParams[0]}", namespace:"${langParams[1]}") {
|
||||
key
|
||||
value
|
||||
}
|
||||
}
|
||||
`
|
||||
graphQL.query({
|
||||
query: CONSTANTS.GRAPHQL.GQL_QUERY_TRANSLATIONS,
|
||||
variables: {
|
||||
locale: langParams[0],
|
||||
namespace: langParams[1]
|
||||
}
|
||||
}).then(resp => {
|
||||
let ns = {}
|
||||
if (resp.data.translations.length > 0) {
|
||||
|
||||
@@ -61,7 +61,11 @@ .button {
|
||||
background-color: mc($color,'800');
|
||||
color: #FFF;
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
&:focus {
|
||||
box-shadow: inset 0 0 0 3px rgba(255,255,255, .4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ .login {
|
||||
|
||||
.login-frame {
|
||||
border-radius: 0 6px 6px 0;
|
||||
border-left: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +105,10 @@ .login {
|
||||
align-items: center;
|
||||
transition: all .4s ease;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@include until($tablet) {
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -114,12 +119,24 @@ .login {
|
||||
|
||||
&:first-child {
|
||||
border-top: none;
|
||||
|
||||
&.is-active {
|
||||
border-top: 1px solid rgba(255,255,255, .5);
|
||||
}
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
background-color: mc('grey', '100');
|
||||
background-image: radial-gradient(circle at top left, rgba(mc('grey', '200'),1) 0%,rgba(255,255,255,1) 100%);
|
||||
background-image: linear-gradient(to right, rgba(255,255,255,1) 0%,rgba(255,255,255,.77) 100%);
|
||||
color: mc('light-blue', '700');
|
||||
cursor: default;
|
||||
|
||||
&:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
svg path {
|
||||
fill: mc('light-blue', '800');
|
||||
}
|
||||
}
|
||||
|
||||
i {
|
||||
@@ -160,7 +177,8 @@ .login {
|
||||
}
|
||||
|
||||
&-frame {
|
||||
background-image: radial-gradient(circle at top left, rgba(255,255,255,1) 5%,rgba(240,240,240,.6) 100%);
|
||||
background-image: radial-gradient(circle at top center, rgba(255,255,255,1) 5%,rgba(255,255,255,.6) 100%);
|
||||
border: 1px solid rgba(255,255,255, .5);
|
||||
border-radius: 6px;
|
||||
width: 400px;
|
||||
padding: 1rem;
|
||||
@@ -178,6 +196,7 @@ .login {
|
||||
font-size: 2rem;
|
||||
font-weight: 600;
|
||||
color: mc('light-blue', '700');
|
||||
text-shadow: 1px 1px 0 #FFF;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
@@ -186,6 +205,7 @@ .login {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 300;
|
||||
color: mc('grey', '700');
|
||||
text-shadow: 1px 1px 0 #FFF;
|
||||
padding: 0;
|
||||
margin: 0 0 25px 0;
|
||||
}
|
||||
@@ -200,6 +220,7 @@ .login {
|
||||
border: 1px solid #FFF;
|
||||
border-radius: 3px;
|
||||
background-color: rgba(255,255,255,.9);
|
||||
box-shadow: inset 0 0 0 3px rgba(255,255,255, .25);
|
||||
padding: 0 15px;
|
||||
height: 40px;
|
||||
margin: 0 0 10px 0;
|
||||
@@ -212,6 +233,9 @@ .login {
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: mc('light-blue','500');
|
||||
background-color: rgba(255,255,255,1);
|
||||
box-shadow: inset 0 0 0 3px rgba(mc('light-blue','500'), .25);
|
||||
color: mc('light-blue', '800');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = {
|
||||
useForm: false,
|
||||
props: ['clientId', 'clientSecret', 'callbackURL'],
|
||||
init (passport, conf) {
|
||||
passport.use('windowslive',
|
||||
passport.use('microsoft',
|
||||
new WindowsLiveStrategy({
|
||||
clientID: conf.clientId,
|
||||
clientSecret: conf.clientSecret,
|
||||
|
||||
@@ -10,6 +10,7 @@ const _ = require('lodash')
|
||||
const typeDefs = fs.readFileSync(path.join(wiki.SERVERPATH, 'schemas/types.graphql'), 'utf8')
|
||||
|
||||
const DateScalar = require('../schemas/scalar-date')
|
||||
const AuthenticationResolvers = require('../schemas/resolvers-authentication')
|
||||
const CommentResolvers = require('../schemas/resolvers-comment')
|
||||
const DocumentResolvers = require('../schemas/resolvers-document')
|
||||
const FileResolvers = require('../schemas/resolvers-file')
|
||||
@@ -21,6 +22,7 @@ const TranslationResolvers = require('../schemas/resolvers-translation')
|
||||
const UserResolvers = require('../schemas/resolvers-user')
|
||||
|
||||
const resolvers = _.merge(
|
||||
AuthenticationResolvers,
|
||||
CommentResolvers,
|
||||
DocumentResolvers,
|
||||
FileResolvers,
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
const _ = require('lodash')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
|
||||
/* global wiki */
|
||||
|
||||
module.exports = {
|
||||
Query: {
|
||||
authentication(obj, args, context, info) {
|
||||
switch (args.mode) {
|
||||
case 'active':
|
||||
let strategies = _.chain(wiki.auth.strategies).map(str => {
|
||||
return {
|
||||
key: str.key,
|
||||
title: str.title,
|
||||
useForm: str.useForm
|
||||
}
|
||||
}).sortBy(['title']).value()
|
||||
let localStrategy = _.remove(strategies, str => str.key === 'local')
|
||||
return _.concat(localStrategy, strategies)
|
||||
case 'all':
|
||||
|
||||
break
|
||||
default:
|
||||
return null
|
||||
}
|
||||
}
|
||||
},
|
||||
Mutation: {},
|
||||
AuthenticationProvider: {
|
||||
icon (ap, args) {
|
||||
return fs.readFileAsync(path.join(wiki.ROOTPATH, `assets/svg/auth-icon-${ap.key}.svg`), 'utf8').catch(err => {
|
||||
if (err.code === 'ENOENT') {
|
||||
return null
|
||||
}
|
||||
throw err
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,10 +32,11 @@ interface Base {
|
||||
# TYPES
|
||||
|
||||
type AuthenticationProvider {
|
||||
id: String!
|
||||
key: String!
|
||||
useForm: Boolean!
|
||||
title: String!
|
||||
props: [String]
|
||||
icon: String
|
||||
config: String
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user