feat: authentication module refactor + added CAS module
This commit is contained in:
@@ -7,14 +7,6 @@
|
||||
const Auth0Strategy = require('passport-auth0').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'auth0',
|
||||
title: 'Auth0',
|
||||
useForm: false,
|
||||
props: {
|
||||
domain: String,
|
||||
clientId: String,
|
||||
clientSecret: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('auth0',
|
||||
new Auth0Strategy({
|
8
server/modules/authentication/auth0/definition.yml
Normal file
8
server/modules/authentication/auth0/definition.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
key: auth0
|
||||
title: Auth0
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
domain: String
|
||||
clientId: String
|
||||
clientSecret: String
|
@@ -7,21 +7,6 @@
|
||||
const AzureAdOAuth2Strategy = require('passport-azure-ad-oauth2').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'azure',
|
||||
title: 'Azure Active Directory',
|
||||
useForm: false,
|
||||
props: {
|
||||
clientId: String,
|
||||
clientSecret: String,
|
||||
resource: {
|
||||
type: String,
|
||||
default: '00000002-0000-0000-c000-000000000000'
|
||||
},
|
||||
tenant: {
|
||||
type: String,
|
||||
default: 'YOUR_TENANT.onmicrosoft.com'
|
||||
}
|
||||
},
|
||||
init (passport, conf) {
|
||||
const jwt = require('jsonwebtoken')
|
||||
passport.use('azure_ad_oauth2',
|
13
server/modules/authentication/azure/definition.yml
Normal file
13
server/modules/authentication/azure/definition.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
key: azure
|
||||
title: Azure Active Directory
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
clientId: String
|
||||
clientSecret: String
|
||||
resource:
|
||||
type: String,
|
||||
default: '00000002-0000-0000-c000-000000000000'
|
||||
tenant:
|
||||
type: String,
|
||||
default: YOUR_TENANT.onmicrosoft.com
|
24
server/modules/authentication/cas/authentication.js
Normal file
24
server/modules/authentication/cas/authentication.js
Normal file
@@ -0,0 +1,24 @@
|
||||
/* global WIKI */
|
||||
|
||||
// ------------------------------------
|
||||
// CAS Account
|
||||
// ------------------------------------
|
||||
|
||||
const CASStrategy = require('passport-cas').Strategy
|
||||
|
||||
module.exports = {
|
||||
init (passport, conf) {
|
||||
passport.use('cas',
|
||||
new CASStrategy({
|
||||
ssoBaseURL: conf.ssoBaseURL,
|
||||
serverBaseURL: conf.serverBaseURL
|
||||
}, (profile, cb) => {
|
||||
WIKI.db.users.processProfile(profile).then((user) => {
|
||||
return cb(null, user) || true
|
||||
}).catch((err) => {
|
||||
return cb(err, null) || true
|
||||
})
|
||||
}
|
||||
))
|
||||
}
|
||||
}
|
7
server/modules/authentication/cas/definition.yml
Normal file
7
server/modules/authentication/cas/definition.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
key: cas
|
||||
title: CAS
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
ssoBaseURL: String
|
||||
serverBaseURL: String
|
@@ -7,13 +7,6 @@
|
||||
const DiscordStrategy = require('passport-discord').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'discord',
|
||||
title: 'Discord',
|
||||
useForm: false,
|
||||
props: {
|
||||
clientId: String,
|
||||
clientSecret: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('discord',
|
||||
new DiscordStrategy({
|
7
server/modules/authentication/discord/definition.yml
Normal file
7
server/modules/authentication/discord/definition.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
key: discord
|
||||
title: Discord
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
clientId: String
|
||||
clientSecret: String
|
@@ -7,13 +7,6 @@
|
||||
const DropboxStrategy = require('passport-dropbox-oauth2').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'dropbox',
|
||||
title: 'Dropbox',
|
||||
useForm: false,
|
||||
props: {
|
||||
clientId: String,
|
||||
clientSecret: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('dropbox',
|
||||
new DropboxStrategy({
|
7
server/modules/authentication/dropbox/definition.yml
Normal file
7
server/modules/authentication/dropbox/definition.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
key: dropbox
|
||||
title: Dropbox
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
clientId: String
|
||||
clientSecret: String
|
@@ -7,13 +7,6 @@
|
||||
const FacebookStrategy = require('passport-facebook').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'facebook',
|
||||
title: 'Facebook',
|
||||
useForm: false,
|
||||
props: {
|
||||
clientId: String,
|
||||
clientSecret: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('facebook',
|
||||
new FacebookStrategy({
|
7
server/modules/authentication/facebook/definition.yml
Normal file
7
server/modules/authentication/facebook/definition.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
key: facebook
|
||||
title: Facebook
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
clientId: String
|
||||
clientSecret: String
|
@@ -7,13 +7,6 @@
|
||||
const GitHubStrategy = require('passport-github2').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'github',
|
||||
title: 'GitHub',
|
||||
useForm: false,
|
||||
props: {
|
||||
clientId: String,
|
||||
clientSecret: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('github',
|
||||
new GitHubStrategy({
|
7
server/modules/authentication/github/definition.yml
Normal file
7
server/modules/authentication/github/definition.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
key: github
|
||||
title: GitHub
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
clientId: String
|
||||
clientSecret: String
|
@@ -7,13 +7,6 @@
|
||||
const GoogleStrategy = require('passport-google-oauth20').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'google',
|
||||
title: 'Google',
|
||||
useForm: false,
|
||||
props: {
|
||||
clientId: String,
|
||||
clientSecret: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('google',
|
||||
new GoogleStrategy({
|
7
server/modules/authentication/google/definition.yml
Normal file
7
server/modules/authentication/google/definition.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
key: google
|
||||
title: Google
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
clientId: String
|
||||
clientSecret: String
|
@@ -8,33 +8,6 @@ const LdapStrategy = require('passport-ldapauth').Strategy
|
||||
const fs = require('fs')
|
||||
|
||||
module.exports = {
|
||||
key: 'ldap',
|
||||
title: 'LDAP / Active Directory',
|
||||
useForm: true,
|
||||
props: {
|
||||
url: {
|
||||
type: String,
|
||||
default: 'ldap://serverhost:389'
|
||||
},
|
||||
bindDn: {
|
||||
type: String,
|
||||
default: `cn='root'`
|
||||
},
|
||||
bindCredentials: String,
|
||||
searchBase: {
|
||||
type: String,
|
||||
default: 'o=users,o=example.com'
|
||||
},
|
||||
searchFilter: {
|
||||
type: String,
|
||||
default: '(uid={{username}})'
|
||||
},
|
||||
tlsEnabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
tlsCertPath: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('ldapauth',
|
||||
new LdapStrategy({
|
22
server/modules/authentication/ldap/definition.yml
Normal file
22
server/modules/authentication/ldap/definition.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
key: ldap
|
||||
title: LDAP / Active Directory
|
||||
author: requarks.io
|
||||
useForm: true
|
||||
props:
|
||||
url:
|
||||
type: String
|
||||
default: 'ldap://serverhost:389'
|
||||
bindDn:
|
||||
type: String
|
||||
default: cn='root'
|
||||
bindCredentials: String
|
||||
searchBase:
|
||||
type: String
|
||||
default: 'o=users,o=example.com'
|
||||
searchFilter:
|
||||
type: String
|
||||
default: '(uid={{username}})'
|
||||
tlsEnabled:
|
||||
type: Boolean
|
||||
default: false
|
||||
tlsCertPath: String
|
@@ -7,10 +7,6 @@
|
||||
const LocalStrategy = require('passport-local').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'local',
|
||||
title: 'Local',
|
||||
useForm: true,
|
||||
props: {},
|
||||
init (passport, conf) {
|
||||
passport.use('local',
|
||||
new LocalStrategy({
|
5
server/modules/authentication/local/definition.yml
Normal file
5
server/modules/authentication/local/definition.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
key: local
|
||||
title: Local
|
||||
author: requarks.io
|
||||
useForm: true
|
||||
props: {}
|
@@ -7,13 +7,6 @@
|
||||
const WindowsLiveStrategy = require('passport-windowslive').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'microsoft',
|
||||
title: 'Microsoft Account',
|
||||
useForm: false,
|
||||
props: {
|
||||
clientId: String,
|
||||
clientSecret: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('microsoft',
|
||||
new WindowsLiveStrategy({
|
7
server/modules/authentication/microsoft/definition.yml
Normal file
7
server/modules/authentication/microsoft/definition.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
key: microsoft
|
||||
title: Microsoft Account
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
clientId: String
|
||||
clientSecret: String
|
@@ -7,15 +7,6 @@
|
||||
const OAuth2Strategy = require('passport-oauth2').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'oauth2',
|
||||
title: 'OAuth2',
|
||||
useForm: false,
|
||||
props: {
|
||||
clientId: String,
|
||||
clientSecret: String,
|
||||
authorizationURL: String,
|
||||
tokenURL: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('oauth2',
|
||||
new OAuth2Strategy({
|
9
server/modules/authentication/oauth2/definition.yml
Normal file
9
server/modules/authentication/oauth2/definition.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
key: oauth2
|
||||
title: OAuth2
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
clientId: String
|
||||
clientSecret: String
|
||||
authorizationURL: String
|
||||
tokenURL: String
|
@@ -7,13 +7,6 @@
|
||||
const SlackStrategy = require('passport-slack').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'slack',
|
||||
title: 'Slack',
|
||||
useForm: false,
|
||||
props: {
|
||||
clientId: String,
|
||||
clientSecret: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('slack',
|
||||
new SlackStrategy({
|
7
server/modules/authentication/slack/definition.yml
Normal file
7
server/modules/authentication/slack/definition.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
key: slack
|
||||
title: Slack
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
clientId: String
|
||||
clientSecret: String
|
@@ -7,13 +7,6 @@
|
||||
const TwitchStrategy = require('passport-twitch').Strategy
|
||||
|
||||
module.exports = {
|
||||
key: 'twitch',
|
||||
title: 'Twitch',
|
||||
useForm: false,
|
||||
props: {
|
||||
clientId: String,
|
||||
clientSecret: String
|
||||
},
|
||||
init (passport, conf) {
|
||||
passport.use('twitch',
|
||||
new TwitchStrategy({
|
7
server/modules/authentication/twitch/definition.yml
Normal file
7
server/modules/authentication/twitch/definition.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
key: twitch
|
||||
title: Twitch
|
||||
author: requarks.io
|
||||
useForm: false
|
||||
props:
|
||||
clientId: String
|
||||
clientSecret: String
|
Reference in New Issue
Block a user