blankogmbh / kirby-gitlab-oauth2
0.1.0
2017-08-25 10:18 UTC
Requires
- getkirby/kirby: ^2.5
- omines/oauth2-gitlab: ^3.0
This package is auto-updated.
Last update: 2019-05-13 07:36:05 UTC
README
这是一个为Kirby提供的插件,允许您使用GitLab账户登录。
使用方法
访问yourdomain.com/gitlab-login,您将经历GitLab身份验证过程并登录到面板。
安装
Composer
如果您通过composer安装了kirby,请打开您的项目的composer.json文件,添加blankogmbh/kirby-gitlab-oauth2作为需求并添加自定义路径,使其安装到网站的plugins文件夹中,然后运行composer install。
之后的composer.json将看起来像这样
{
"name": "your-company/your-project",
"require": {
"mnsami/composer-custom-directory-installer": "1.1.*",
"getkirby/kirby": "^2.5",
"getkirby/panel": "^2.5",
"blankogmbh/kirby-gitlab-oauth2": "1.*"
},
"extra": {
"installer-paths": {
"./kirby": ["getkirby/kirby"],
"./kirby/toolkit": ["getkirby/toolkit"],
"./panel": ["getkirby/panel"],
"./site/plugins/gitlab-oauth2": ["blankogmbh/kirby-gitlab-oauth2"]
}
}
}
将以下内容添加到您的site/config/config.php(获取App-ID和Secret)
c::set('gitlab-oauth2', true); c::set('gitlab-oauth2-clientId', 'your-app-id'); c::set('gitlab-oauth2-clientSecret', 'your-secret'); // if you have a self-hosted gitlab, add your custom url here: c::set('gitlab-oauth2-domain', 'https://git.yourdomain.com');
您可以通过三种方式允许用户登录,通过用户名、用户ID或电子邮件地址的域
c::set('gitlab-oauth2-allowedUsernames', [ 'pascalmh', 'markusdenhoff', ]); c::set('gitlab-oauth2-allowedUserIds', [ 123, 456, ]); c::set('gitlab-oauth2-allowedDomains', [ 'blanko.de', // this would allow anyone@blanko.de to login 'blanko.biz', // this would allow anyone@blanko.biz to login ]);
作者
Pascal 'Pascalmh' Küsgen http://pascalmh.de