feat: gitlab auth module + storage locale namespacing fix

This commit is contained in:
NGPixel
2019-06-25 02:13:41 +00:00
parent 2870da0e9e
commit 4e990d50eb
11 changed files with 195 additions and 39 deletions

View File

@@ -0,0 +1,34 @@
/* global WIKI */
// ------------------------------------
// GitLab Account
// ------------------------------------
const GitLabStrategy = require('passport-gitlab2').Strategy
const _ = require('lodash')
module.exports = {
init (passport, conf) {
passport.use('gitlab',
new GitLabStrategy({
clientID: conf.clientId,
clientSecret: conf.clientSecret,
callbackURL: conf.callbackURL,
scope: ['read_user']
}, async (accessToken, refreshToken, profile, cb) => {
try {
const user = await WIKI.models.users.processProfile({
profile: {
...profile,
picture: _.get(profile, 'avatarUrl', '')
},
providerKey: 'gitlab'
})
cb(null, user)
} catch (err) {
cb(err, null)
}
}
))
}
}

View File

@@ -0,0 +1,26 @@
key: gitlab
title: GitLab
description: GitLab is a web-based DevOps lifecycle tool that provides a Git-repository manager providing wiki, issue-tracking and CI/CD pipeline features.
author: requarks.io
logo: https://static.requarks.io/logo/gitlab.svg
color: deep-orange
website: https://gitlab.com
isAvailable: true
useForm: false
props:
clientId:
type: String
title: Client ID
hint: Application Client ID
order: 1
clientSecret:
type: String
title: Client Secret
hint: Application Client Secret
order: 2
baseUrl:
type: String
title: Base URL
hint: For self-managed GitLab instances, define the base URL (e.g. https://gitlab.example.com). Leave default for GitLab.com SaaS (https://gitlab.com).
default: https://gitlab.com
order: 3