mirror of https://github.com/requarks/wiki
parent
2870da0e9e
commit
4e990d50eb
After Width: | Height: | Size: 1.1 KiB |
@ -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)
|
||||
}
|
||||
}
|
||||
))
|
||||
}
|
||||
}
|
@ -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
|
Loading…
Reference in new issue