Additional OAuth2 providers (#1010)
* add google+ * sort signin oauth2 providers based on the name so order is always the same * update auth tip for google+ * add gitlab provider * add bitbucket provider (and some go fmt) * add twitter provider * add facebook provider * add dropbox provider * add openid connect provider incl. new format of tips section in "Add New Source" * lower the amount of disk storage for each session to prevent issues while building cross platform (and disk overflow) * imports according to goimport and code style * make it possible to set custom urls to gitlab and github provider (only these could have a different host) * split up oauth2 into multiple files * small typo in comment * fix indention * fix indentation * fix new line before external import * fix layout of signin part * update "broken" dependency
|
@ -965,7 +965,7 @@ footer .ui.language .menu {
|
|||
float: left;
|
||||
}
|
||||
.signin .oauth2 a {
|
||||
margin-right: 5px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
.signin .oauth2 a:last-child {
|
||||
margin-right: 0px;
|
||||
|
@ -974,6 +974,9 @@ footer .ui.language .menu {
|
|||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
.signin .oauth2 img.openidConnect {
|
||||
width: auto;
|
||||
}
|
||||
.user.activate form,
|
||||
.user.forgot.password form,
|
||||
.user.reset.password form,
|
||||
|
|
BIN
public/img/auth/bitbucket.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
public/img/auth/dropbox.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
public/img/auth/facebook.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
public/img/auth/gitlab.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
public/img/auth/google_plus.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
public/img/auth/openid_connect.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/img/auth/twitter.png
Normal file
After Width: | Height: | Size: 3 KiB |
|
@ -1047,6 +1047,56 @@ function initAdmin() {
|
|||
}
|
||||
}
|
||||
|
||||
function onOAuth2Change() {
|
||||
$('.open_id_connect_auto_discovery_url, .oauth2_use_custom_url').hide();
|
||||
$('.open_id_connect_auto_discovery_url input[required]').removeAttr('required');
|
||||
|
||||
var provider = $('#oauth2_provider').val();
|
||||
switch (provider) {
|
||||
case 'github':
|
||||
case 'gitlab':
|
||||
$('.oauth2_use_custom_url').show();
|
||||
break;
|
||||
case 'openidConnect':
|
||||
$('.open_id_connect_auto_discovery_url input').attr('required', 'required');
|
||||
$('.open_id_connect_auto_discovery_url').show();
|
||||
break;
|
||||
}
|
||||
onOAuth2UseCustomURLChange();
|
||||
}
|
||||
|
||||
function onOAuth2UseCustomURLChange() {
|
||||
var provider = $('#oauth2_provider').val();
|
||||
$('.oauth2_use_custom_url_field').hide();
|
||||
$('.oauth2_use_custom_url_field input[required]').removeAttr('required');
|
||||
|
||||
if ($('#oauth2_use_custom_url').is(':checked')) {
|
||||
if (!$('#oauth2_token_url').val()) {
|
||||
$('#oauth2_token_url').val($('#' + provider + '_token_url').val());
|
||||
}
|
||||
if (!$('#oauth2_auth_url').val()) {
|
||||
$('#oauth2_auth_url').val($('#' + provider + '_auth_url').val());
|
||||
}
|
||||
if (!$('#oauth2_profile_url').val()) {
|
||||
$('#oauth2_profile_url').val($('#' + provider + '_profile_url').val());
|
||||
}
|
||||
if (!$('#oauth2_email_url').val()) {
|
||||
$('#oauth2_email_url').val($('#' + provider + '_email_url').val());
|
||||
}
|
||||
switch (provider) {
|
||||
case 'github':
|
||||
$('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input, .oauth2_email_url input').attr('required', 'required');
|
||||
$('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url, .oauth2_email_url').show();
|
||||
break;
|
||||
case 'gitlab':
|
||||
$('.oauth2_token_url input, .oauth2_auth_url input, .oauth2_profile_url input').attr('required', 'required');
|
||||
$('.oauth2_token_url, .oauth2_auth_url, .oauth2_profile_url').show();
|
||||
$('#oauth2_email_url').val('');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// New authentication
|
||||
if ($('.admin.new.authentication').length > 0) {
|
||||
$('#auth_type').change(function () {
|
||||
|
@ -1075,22 +1125,28 @@ function initAdmin() {
|
|||
break;
|
||||
case '6': // OAuth2
|
||||
$('.oauth2').show();
|
||||
$('.oauth2 input').attr('required', 'required');
|
||||
$('.oauth2 div.required:not(.oauth2_use_custom_url,.oauth2_use_custom_url_field,.open_id_connect_auto_discovery_url) input').attr('required', 'required');
|
||||
onOAuth2Change();
|
||||
break;
|
||||
}
|
||||
|
||||
if (authType == '2' || authType == '5') {
|
||||
onSecurityProtocolChange()
|
||||
}
|
||||
});
|
||||
$('#auth_type').change();
|
||||
$('#security_protocol').change(onSecurityProtocolChange)
|
||||
$('#security_protocol').change(onSecurityProtocolChange);
|
||||
$('#oauth2_provider').change(onOAuth2Change);
|
||||
$('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
|
||||
}
|
||||
// Edit authentication
|
||||
if ($('.admin.edit.authentication').length > 0) {
|
||||
var authType = $('#auth_type').val();
|
||||
if (authType == '2' || authType == '5') {
|
||||
$('#security_protocol').change(onSecurityProtocolChange);
|
||||
} else if (authType == '6') {
|
||||
$('#oauth2_provider').change(onOAuth2Change);
|
||||
$('#oauth2_use_custom_url').change(onOAuth2UseCustomURLChange);
|
||||
onOAuth2Change();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
}
|
||||
a {
|
||||
margin-right: 5px;
|
||||
margin-right: 3px;
|
||||
&:last-child {
|
||||
margin-right: 0px;
|
||||
}
|
||||
|
@ -64,6 +64,9 @@
|
|||
img {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
&.openidConnect {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|