feat: added auth0, discord, twitch auth modules
This commit is contained in:
parent
a4e0e6d35c
commit
a155af20f5
@ -9,9 +9,9 @@
|
||||
.login-frame
|
||||
h1 {{ siteTitle }}
|
||||
h2 {{ $t('auth:loginrequired') }}
|
||||
input(type='text', name='email', :placeholder='$t("auth:fields.emailuser")')
|
||||
input(type='password', name='password', :placeholder='$t("auth:fields.password")')
|
||||
button.button.is-orange.is-fullwidth(@click='login')
|
||||
input(type='text', ref='iptEmail', :placeholder='$t("auth:fields.emailuser")')
|
||||
input(type='password', ref='iptPassword', :placeholder='$t("auth:fields.password")')
|
||||
button.button.is-blue.is-fullwidth(@click='login')
|
||||
span {{ $t('auth:actions.login') }}
|
||||
.login-copyright
|
||||
span {{ $t('footer.poweredby') }}
|
||||
@ -69,6 +69,7 @@ export default {
|
||||
mounted() {
|
||||
this.$store.commit('navigator/subtitleStatic', 'Login')
|
||||
this.refreshStrategies()
|
||||
this.$refs.iptEmail.focus()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -22,26 +22,34 @@
|
||||
transition(name='navigator-sd')
|
||||
.navigator-sd(v-show='sdShown')
|
||||
.navigator-sd-actions
|
||||
a.is-active(href='')
|
||||
a.is-active(href='', title='Search')
|
||||
svg.icons.is-24(role='img')
|
||||
title Search
|
||||
use(xlink:href='#gg-search')
|
||||
a(href='')
|
||||
svg.icons.is-24(role='img')
|
||||
svg.icons.is-24(role='img', title='New Document')
|
||||
title New Document
|
||||
use(xlink:href='#nc-plus-circle')
|
||||
a(href='')
|
||||
svg.icons.is-24(role='img')
|
||||
title Navigation
|
||||
svg.icons.is-24(role='img', title='Edit Document')
|
||||
title Edit Document
|
||||
use(xlink:href='#nc-pen-red')
|
||||
a(href='')
|
||||
svg.icons.is-24(role='img')
|
||||
title Navigation
|
||||
svg.icons.is-24(role='img', title='History')
|
||||
title History
|
||||
use(xlink:href='#nc-restore')
|
||||
a(href='')
|
||||
svg.icons.is-24(role='img')
|
||||
title New Document
|
||||
svg.icons.is-24(role='img', title='View Source')
|
||||
title View Source
|
||||
use(xlink:href='#nc-code-editor')
|
||||
a(href='')
|
||||
svg.icons.is-24(role='img', title='Move Document')
|
||||
title Move Document
|
||||
use(xlink:href='#nc-move')
|
||||
a(href='')
|
||||
svg.icons.is-24(role='img', title='Delete Document')
|
||||
title Delete Document
|
||||
use(xlink:href='#nc-trash')
|
||||
.navigator-sd-search
|
||||
input(type='text', placeholder='Search')
|
||||
.navigator-sd-results
|
||||
|
@ -229,7 +229,7 @@
|
||||
|
||||
input[type=text], input[type=password] {
|
||||
width: 100%;
|
||||
border: 1px solid rgba(mc('light-blue','500'), .5);
|
||||
border: 1px solid rgba(mc('blue-grey','500'), .5);
|
||||
border-radius: 3px;
|
||||
background-color: rgba(255,255,255,.9);
|
||||
box-shadow: inset 0 0 0 3px rgba(255,255,255, .25);
|
||||
@ -253,7 +253,7 @@
|
||||
}
|
||||
|
||||
.button {
|
||||
background-image: linear-gradient(to top, mc('deep-orange', '400') 0%, mc('deep-orange', '400') 50%, mc('orange', '500') 100%);
|
||||
background-image: linear-gradient(to bottom, mc('blue', '400') 0%, mc('blue', '600') 50%, mc('blue', '700') 100%);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 200%;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg" style="display: none;">
|
||||
<symbol id="nc-check-simple" viewBox="0 0 64 64">
|
||||
<g>
|
||||
<g class="nc-icon-wrapper">
|
||||
@ -389,7 +390,7 @@
|
||||
<path fill="#B3B3B3" d="M24,42c10.539,0,18.992-9.105,17.906-19.862c-0.862-8.531-7.863-15.387-16.409-16.077 c-6.106-0.493-11.83,2.057-15.508,6.629l7.65-1.024l0.531,3.965L6.276,17.223c-0.09,0.012-0.18,0.018-0.269,0.018 c-0.986,0-1.845-0.729-1.979-1.734L2.436,3.612L6.4,3.081l0.886,6.617c4.686-5.496,11.853-8.446,19.428-7.535 c10.097,1.214,18.149,9.444,19.17,19.562C47.212,34.873,36.881,46,24,46C12.213,46,2.561,36.682,2.024,25.026 C1.998,24.464,2.464,24,3.026,24h2.003c0.541,0,0.969,0.431,0.997,0.972C6.532,34.447,14.401,42,24,42z"></path>
|
||||
<path fill="#43A6DD" d="M29.879,32.707l-7.293-7.293C22.211,25.039,22,24.53,22,23.999V15c0-0.552,0.448-1,1-1h2 c0.552,0,1,0.448,1,1v8.172l6.707,6.707c0.391,0.391,0.391,1.024,0,1.414l-1.414,1.414C30.903,33.097,30.269,33.097,29.879,32.707z"></path>
|
||||
</g>
|
||||
</symbol>
|
||||
</symbol>
|
||||
<symbol id='nc-code-editor' viewBox="0 0 48 48">
|
||||
<g class="nc-icon-wrapper">
|
||||
<path fill="#444444" d="M47,11V6c0-1.105-0.895-2-2-2H3C1.895,4,1,4.895,1,6v5H47z"></path>
|
||||
@ -410,4 +411,20 @@
|
||||
<rect x="20" y="38" fill="#E86C60" width="5" height="2"></rect>
|
||||
</g>
|
||||
</symbol>
|
||||
<symbol id='nc-trash' viewBox="0 0 48 48">
|
||||
<g class="nc-icon-wrapper">
|
||||
<path fill="#335262" d="M37,47H11c-2.20914,0-4-1.79086-4-4V14c0-0.55229,0.44772-1,1-1h32c0.55228,0,1,0.44771,1,1v29 C41,45.20914,39.20914,47,37,47z"></path>
|
||||
<path fill="#223E49" d="M24,39c-0.55273,0-1-0.44775-1-1V23c0-0.55225,0.44727-1,1-1s1,0.44775,1,1v15 C25,38.55225,24.55273,39,24,39z"></path>
|
||||
<path fill="#223E49" d="M16,39c-0.55273,0-1-0.44775-1-1V23c0-0.55225,0.44727-1,1-1s1,0.44775,1,1v15 C17,38.55225,16.55273,39,16,39z"></path>
|
||||
<path fill="#223E49" d="M32,39c-0.55273,0-1-0.44775-1-1V23c0-0.55225,0.44727-1,1-1s1,0.44775,1,1v15 C33,38.55225,32.55273,39,32,39z"></path>
|
||||
<path fill="#5A7A84" d="M30,11c-0.55273,0-1-0.44775-1-1V3H19v7c0,0.55225-0.44727,1-1,1s-1-0.44775-1-1V2c0-0.55225,0.44727-1,1-1 h12c0.55273,0,1,0.44775,1,1v8C31,10.55225,30.55273,11,30,11z"></path>
|
||||
<path fill="#5A7A84" d="M46,14H2c-0.55273,0-1-0.44775-1-1V9c0-0.55225,0.44727-1,1-1h44c0.55273,0,1,0.44775,1,1v4 C47,13.55225,46.55273,14,46,14z"></path>
|
||||
</g>
|
||||
</symbol>
|
||||
<symbol id='nc-move' viewBox="0 0 48 48">
|
||||
<g class="nc-icon-wrapper">
|
||||
<path fill="#B3B3B3" d="M47.658,33.247l-8-7c-0.294-0.257-0.715-0.32-1.071-0.157C38.229,26.252,38,26.607,38,27v5 c-7.171,0-11.745-4.573-16.586-9.414C16.21,17.382,10.829,12,2,12H1c-0.552,0-1,0.448-1,1v2c0,0.552,0.448,1,1,1h1 c7.171,0,11.745,4.573,16.586,9.414C23.79,30.618,29.171,36,38,36v5c0,0.393,0.229,0.748,0.587,0.91C38.719,41.971,38.86,42,39,42 c0.237,0,0.473-0.085,0.658-0.247l8-7C47.876,34.562,48,34.288,48,34S47.876,33.437,47.658,33.247z"></path>
|
||||
<path fill="#444444" d="M47.658,13.247l-8-7c-0.294-0.257-0.715-0.32-1.071-0.157C38.229,6.252,38,6.607,38,7v5 c-8.829,0-14.21,5.382-19.414,10.586C13.745,27.427,9.171,32,2,32H1c-0.552,0-1,0.448-1,1v2c0,0.552,0.448,1,1,1h1 c8.829,0,14.21-5.382,19.414-10.586C26.255,20.573,30.829,16,38,16v5c0,0.393,0.229,0.748,0.587,0.91C38.719,21.971,38.86,22,39,22 c0.237,0,0.473-0.085,0.658-0.247l8-7C47.876,14.562,48,14.288,48,14S47.876,13.438,47.658,13.247z"></path>
|
||||
</g>
|
||||
</symbol>
|
||||
</svg>
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 42 KiB |
@ -100,13 +100,16 @@
|
||||
"node-graceful": "0.2.3",
|
||||
"ora": "1.3.0",
|
||||
"passport": "0.4.0",
|
||||
"passport-auth0": "0.6.1",
|
||||
"passport-azure-ad-oauth2": "0.0.4",
|
||||
"passport-discord": "0.1.3",
|
||||
"passport-facebook": "2.1.1",
|
||||
"passport-github2": "0.1.11",
|
||||
"passport-google-oauth20": "1.0.0",
|
||||
"passport-ldapauth": "2.0.0",
|
||||
"passport-local": "1.0.0",
|
||||
"passport-slack": "0.0.7",
|
||||
"passport-twitch": "1.0.3",
|
||||
"passport-windowslive": "1.0.2",
|
||||
"pg": "6.4.2",
|
||||
"pg-hstore": "2.3.2",
|
||||
|
30
server/extensions/authentication/auth0.js
Normal file
30
server/extensions/authentication/auth0.js
Normal file
@ -0,0 +1,30 @@
|
||||
/* global wiki */
|
||||
|
||||
// ------------------------------------
|
||||
// Auth0 Account
|
||||
// ------------------------------------
|
||||
|
||||
const Auth0Strategy = require('passport-auth0').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'auth0',
|
||||
title: 'Auth0',
|
||||
useForm: false,
|
||||
props: ['domain', 'clientId', 'clientSecret'],
|
||||
init (passport, conf) {
|
||||
passport.use('auth0',
|
||||
new Auth0Strategy({
|
||||
domain: conf.domain,
|
||||
clientID: conf.clientId,
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL
|
||||
}, function (accessToken, refreshToken, profile, cb) {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
})
|
||||
}
|
||||
))
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ module.exports = {
|
||||
key: 'azure',
|
||||
title: 'Azure Active Directory',
|
||||
useForm: false,
|
||||
props: ['clientId', 'clientSecret', 'callbackURL', 'resource', 'tenant'],
|
||||
props: ['clientId', 'clientSecret', 'resource', 'tenant'],
|
||||
init (passport, conf) {
|
||||
const jwt = require('jsonwebtoken')
|
||||
passport.use('azure_ad_oauth2',
|
||||
|
30
server/extensions/authentication/discord.js
Normal file
30
server/extensions/authentication/discord.js
Normal file
@ -0,0 +1,30 @@
|
||||
/* global wiki */
|
||||
|
||||
// ------------------------------------
|
||||
// Discord Account
|
||||
// ------------------------------------
|
||||
|
||||
const DiscordStrategy = require('passport-discord').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'discord',
|
||||
title: 'Discord',
|
||||
useForm: false,
|
||||
props: ['clientId', 'clientSecret'],
|
||||
init (passport, conf) {
|
||||
passport.use('discord',
|
||||
new DiscordStrategy({
|
||||
clientID: conf.clientId,
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL,
|
||||
scope: 'identify email'
|
||||
}, function (accessToken, refreshToken, profile, cb) {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
})
|
||||
}
|
||||
))
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ module.exports = {
|
||||
key: 'facebook',
|
||||
title: 'Facebook',
|
||||
useForm: false,
|
||||
props: ['clientId', 'clientSecret', 'callbackURL'],
|
||||
props: ['clientId', 'clientSecret'],
|
||||
init (passport, conf) {
|
||||
passport.use('facebook',
|
||||
new FacebookStrategy({
|
||||
|
@ -10,7 +10,7 @@ module.exports = {
|
||||
key: 'github',
|
||||
title: 'GitHub',
|
||||
useForm: false,
|
||||
props: ['clientId', 'clientSecret', 'callbackURL'],
|
||||
props: ['clientId', 'clientSecret'],
|
||||
init (passport, conf) {
|
||||
passport.use('github',
|
||||
new GitHubStrategy({
|
||||
|
@ -10,7 +10,7 @@ module.exports = {
|
||||
key: 'google',
|
||||
title: 'Google ID',
|
||||
useForm: false,
|
||||
props: ['clientId', 'clientSecret', 'callbackURL'],
|
||||
props: ['clientId', 'clientSecret'],
|
||||
init (passport, conf) {
|
||||
passport.use('google',
|
||||
new GoogleStrategy({
|
||||
|
@ -10,7 +10,7 @@ module.exports = {
|
||||
key: 'microsoft',
|
||||
title: 'Microsoft Account',
|
||||
useForm: false,
|
||||
props: ['clientId', 'clientSecret', 'callbackURL'],
|
||||
props: ['clientId', 'clientSecret'],
|
||||
init (passport, conf) {
|
||||
passport.use('microsoft',
|
||||
new WindowsLiveStrategy({
|
||||
|
@ -10,7 +10,7 @@ module.exports = {
|
||||
key: 'slack',
|
||||
title: 'Slack',
|
||||
useForm: false,
|
||||
props: ['clientId', 'clientSecret', 'callbackURL'],
|
||||
props: ['clientId', 'clientSecret'],
|
||||
init (passport, conf) {
|
||||
passport.use('slack',
|
||||
new SlackStrategy({
|
||||
|
30
server/extensions/authentication/twitch.js
Normal file
30
server/extensions/authentication/twitch.js
Normal file
@ -0,0 +1,30 @@
|
||||
/* global wiki */
|
||||
|
||||
// ------------------------------------
|
||||
// Twitch Account
|
||||
// ------------------------------------
|
||||
|
||||
const TwitchStrategy = require('passport-twitch').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'twitch',
|
||||
title: 'Twitch',
|
||||
useForm: false,
|
||||
props: ['clientId', 'clientSecret'],
|
||||
init (passport, conf) {
|
||||
passport.use('twitch',
|
||||
new TwitchStrategy({
|
||||
clientID: conf.clientId,
|
||||
clientSecret: conf.clientSecret,
|
||||
callbackURL: conf.callbackURL,
|
||||
scope: 'user_read'
|
||||
}, function (accessToken, refreshToken, profile, cb) {
|
||||
wiki.db.User.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
})
|
||||
}
|
||||
))
|
||||
}
|
||||
}
|
27
yarn.lock
27
yarn.lock
@ -6164,12 +6164,26 @@ parseurl@~1.3.2:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.2.tgz#fc289d4ed8993119460c156253262cdc8de65bf3"
|
||||
|
||||
passport-auth0@0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/passport-auth0/-/passport-auth0-0.6.1.tgz#8a6ace06b5d1927aaad15e22e1c43b9b04e5ddee"
|
||||
dependencies:
|
||||
passport-oauth "^1.0.0"
|
||||
request "^2.61.0"
|
||||
xtend "^4.0.0"
|
||||
|
||||
passport-azure-ad-oauth2@0.0.4:
|
||||
version "0.0.4"
|
||||
resolved "https://registry.yarnpkg.com/passport-azure-ad-oauth2/-/passport-azure-ad-oauth2-0.0.4.tgz#1a09d8869efd4afd095116e228941961b3a5c120"
|
||||
dependencies:
|
||||
passport-oauth "1.0.x"
|
||||
|
||||
passport-discord@0.1.3:
|
||||
version "0.1.3"
|
||||
resolved "https://registry.yarnpkg.com/passport-discord/-/passport-discord-0.1.3.tgz#669cc4a770b592f57eb17002ca1743a22e8d7c38"
|
||||
dependencies:
|
||||
passport-oauth2 "^1.2.0"
|
||||
|
||||
passport-facebook@2.1.1:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/passport-facebook/-/passport-facebook-2.1.1.tgz#c39d0b52ae4d59163245a4e21a7b9b6321303311"
|
||||
@ -6211,7 +6225,7 @@ passport-oauth1@1.x.x:
|
||||
passport-strategy "1.x.x"
|
||||
utils-merge "1.x.x"
|
||||
|
||||
passport-oauth2@1.x.x:
|
||||
passport-oauth2@1.x.x, passport-oauth2@^1.1.2, passport-oauth2@^1.2.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/passport-oauth2/-/passport-oauth2-1.4.0.tgz#f62f81583cbe12609be7ce6f160b9395a27b86ad"
|
||||
dependencies:
|
||||
@ -6220,7 +6234,7 @@ passport-oauth2@1.x.x:
|
||||
uid2 "0.0.x"
|
||||
utils-merge "1.x.x"
|
||||
|
||||
passport-oauth@1.0.x:
|
||||
passport-oauth@1.0.x, passport-oauth@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/passport-oauth/-/passport-oauth-1.0.0.tgz#90aff63387540f02089af28cdad39ea7f80d77df"
|
||||
dependencies:
|
||||
@ -6246,6 +6260,13 @@ passport-strategy@1.x.x, passport-strategy@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/passport-strategy/-/passport-strategy-1.0.0.tgz#b5539aa8fc225a3d1ad179476ddf236b440f52e4"
|
||||
|
||||
passport-twitch@1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/passport-twitch/-/passport-twitch-1.0.3.tgz#82a4a1fbe19368d44e62f057e93c414a9d4fe7cc"
|
||||
dependencies:
|
||||
passport-oauth2 "^1.1.2"
|
||||
pkginfo "0.2.x"
|
||||
|
||||
passport-windowslive@1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/passport-windowslive/-/passport-windowslive-1.0.2.tgz#383cfee6589ffb5ecc2ad19c3a41ef691462a705"
|
||||
@ -7158,7 +7179,7 @@ request@2, request@^2.65.0, request@^2.67.0, request@^2.79.0, request@^2.81.0:
|
||||
tunnel-agent "^0.6.0"
|
||||
uuid "^3.0.0"
|
||||
|
||||
request@2.83.0, request@^2.83.0:
|
||||
request@2.83.0, request@^2.61.0, request@^2.83.0:
|
||||
version "2.83.0"
|
||||
resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356"
|
||||
dependencies:
|
||||
|
Loading…
Reference in New Issue
Block a user