2023-04-23 10:21:21 +00:00
|
|
|
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin new authentication")}}
|
|
|
|
<div class="admin-setting-content">
|
2017-03-15 22:39:38 +00:00
|
|
|
<h4 class="ui top attached header">
|
2023-09-25 08:56:50 +00:00
|
|
|
{{ctx.Locale.Tr "admin.auths.new"}}
|
2017-03-15 22:39:38 +00:00
|
|
|
</h4>
|
|
|
|
<div class="ui attached segment">
|
|
|
|
<form class="ui form" action="{{.Link}}" method="post">
|
2021-10-18 22:08:41 +00:00
|
|
|
{{template "base/disable_form_autofill"}}
|
2017-03-15 22:39:38 +00:00
|
|
|
{{.CsrfTokenHtml}}
|
|
|
|
<!-- Types and name -->
|
|
|
|
<div class="inline required field {{if .Err_Type}}error{{end}}">
|
2023-09-25 08:56:50 +00:00
|
|
|
<label>{{ctx.Locale.Tr "admin.auths.auth_type"}}</label>
|
2017-03-15 22:39:38 +00:00
|
|
|
<div class="ui selection type dropdown">
|
2022-03-10 22:40:43 +00:00
|
|
|
<input type="hidden" id="auth_type" name="type" value="{{.type}}">
|
2017-03-15 22:39:38 +00:00
|
|
|
<div class="text">{{.CurrentTypeName}}</div>
|
2020-10-31 22:15:11 +00:00
|
|
|
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
|
2017-03-15 22:39:38 +00:00
|
|
|
<div class="menu">
|
|
|
|
{{range .AuthSources}}
|
2021-07-25 07:09:52 +00:00
|
|
|
<div class="item" data-value="{{.Type.Int}}">{{.Name}}</div>
|
2017-03-15 22:39:38 +00:00
|
|
|
{{end}}
|
2015-12-07 22:30:52 +00:00
|
|
|
</div>
|
2017-03-15 22:39:38 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="required inline field {{if .Err_Name}}error{{end}}">
|
2023-09-25 08:56:50 +00:00
|
|
|
<label for="auth_name">{{ctx.Locale.Tr "admin.auths.auth_name"}}</label>
|
2023-06-15 01:12:50 +00:00
|
|
|
<input id="auth_name" name="name" value="{{.name}}" autofocus required>
|
2017-03-15 22:39:38 +00:00
|
|
|
</div>
|
2015-09-10 21:11:41 +00:00
|
|
|
|
2017-03-15 22:39:38 +00:00
|
|
|
<!-- LDAP and DLDAP -->
|
2022-08-31 15:58:54 +00:00
|
|
|
{{template "admin/auth/source/ldap" .}}
|
2015-09-10 21:11:41 +00:00
|
|
|
|
2017-03-15 22:39:38 +00:00
|
|
|
<!-- SMTP -->
|
2022-08-31 15:58:54 +00:00
|
|
|
{{template "admin/auth/source/smtp" .}}
|
2015-09-10 21:11:41 +00:00
|
|
|
|
2017-03-15 22:39:38 +00:00
|
|
|
<!-- PAM -->
|
2024-03-24 18:23:38 +00:00
|
|
|
<div class="pam required field {{if not (eq .type 4)}}tw-hidden{{end}}">
|
2023-09-25 08:56:50 +00:00
|
|
|
<label for="pam_service_name">{{ctx.Locale.Tr "admin.auths.pam_service_name"}}</label>
|
2023-03-27 16:05:51 +00:00
|
|
|
<input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}">
|
2023-09-25 08:56:50 +00:00
|
|
|
<label for="pam_email_domain">{{ctx.Locale.Tr "admin.auths.pam_email_domain"}}</label>
|
2021-05-13 22:11:47 +00:00
|
|
|
<input id="pam_email_domain" name="pam_email_domain" value="{{.pam_email_domain}}">
|
2017-03-15 22:39:38 +00:00
|
|
|
</div>
|
2024-03-24 18:23:38 +00:00
|
|
|
<div class="pam optional field {{if not (eq .type 4)}}tw-hidden{{end}}">
|
2021-09-27 01:02:01 +00:00
|
|
|
<div class="ui checkbox">
|
2023-09-25 08:56:50 +00:00
|
|
|
<label for="skip_local_two_fa"><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
|
2021-09-27 01:02:01 +00:00
|
|
|
<input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if .skip_local_two_fa}}checked{{end}}>
|
2023-09-25 08:56:50 +00:00
|
|
|
<p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p>
|
2021-09-27 01:02:01 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2017-02-22 07:14:37 +00:00
|
|
|
|
2017-03-15 22:39:38 +00:00
|
|
|
<!-- OAuth2 -->
|
2022-08-31 15:58:54 +00:00
|
|
|
{{template "admin/auth/source/oauth" .}}
|
2015-09-10 21:11:41 +00:00
|
|
|
|
2019-11-22 23:33:31 +00:00
|
|
|
<!-- SSPI -->
|
2022-08-31 15:58:54 +00:00
|
|
|
{{template "admin/auth/source/sspi" .}}
|
2019-11-22 23:33:31 +00:00
|
|
|
|
2017-03-15 22:39:38 +00:00
|
|
|
<div class="ldap field">
|
|
|
|
<div class="ui checkbox">
|
2023-09-25 08:56:50 +00:00
|
|
|
<label><strong>{{ctx.Locale.Tr "admin.auths.attributes_in_bind"}}</strong></label>
|
2017-03-15 22:39:38 +00:00
|
|
|
<input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}>
|
|
|
|
</div>
|
|
|
|
</div>
|
allow synchronizing user status from OAuth2 login providers (#31572)
This leverages the existing `sync_external_users` cron job to
synchronize the `IsActive` flag on users who use an OAuth2 provider set
to synchronize. This synchronization is done by checking for expired
access tokens, and using the stored refresh token to request a new
access token. If the response back from the OAuth2 provider is the
`invalid_grant` error code, the user is marked as inactive. However, the
user is able to reactivate their account by logging in the web browser
through their OAuth2 flow.
Also changed to support this is that a linked `ExternalLoginUser` is
always created upon a login or signup via OAuth2.
Ideally, we would also refresh permissions from the configured OAuth
provider (e.g., admin, restricted and group mappings) to match the
implementation of LDAP. However, the OAuth library used for this `goth`,
doesn't seem to support issuing a session via refresh tokens. The
interface provides a [`RefreshToken`
method](https://github.com/markbates/goth/blob/master/provider.go#L20),
but the returned `oauth.Token` doesn't implement the `goth.Session` we
would need to call `FetchUser`. Due to specific implementations, we
would need to build a compatibility function for every provider, since
they cast to concrete types (e.g.
[Azure](https://github.com/markbates/goth/blob/master/providers/azureadv2/azureadv2.go#L132))
---------
Co-authored-by: Kyle D <kdumontnu@gmail.com>
(cherry picked from commit 416c36f3034e228a27258b5a8a15eec4e5e426ba)
Conflicts:
- tests/integration/auth_ldap_test.go
Trivial conflict resolved by manually applying the change.
- routers/web/auth/oauth.go
Technically not a conflict, but the original PR removed the
modules/util import, which in our version, is still in use. Added it
back.
2024-07-16 18:33:16 +00:00
|
|
|
<div class="oauth2 ldap inline field {{if not (or (eq .type 2) (eq .type 6))}}tw-hidden{{end}}">
|
2017-05-10 13:10:18 +00:00
|
|
|
<div class="ui checkbox">
|
2023-09-25 08:56:50 +00:00
|
|
|
<label><strong>{{ctx.Locale.Tr "admin.auths.syncenabled"}}</strong></label>
|
2017-05-10 13:10:18 +00:00
|
|
|
<input name="is_sync_enabled" type="checkbox" {{if .is_sync_enabled}}checked{{end}}>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-03-15 22:39:38 +00:00
|
|
|
<div class="inline field">
|
|
|
|
<div class="ui checkbox">
|
2023-09-25 08:56:50 +00:00
|
|
|
<label><strong>{{ctx.Locale.Tr "admin.auths.activated"}}</strong></label>
|
2017-03-15 22:39:38 +00:00
|
|
|
<input name="is_active" type="checkbox" {{if .is_active}}checked{{end}}>
|
|
|
|
</div>
|
2015-12-07 22:30:52 +00:00
|
|
|
</div>
|
2015-09-10 21:11:41 +00:00
|
|
|
|
2017-03-15 22:39:38 +00:00
|
|
|
<div class="field">
|
2023-09-25 08:56:50 +00:00
|
|
|
<button class="ui primary button">{{ctx.Locale.Tr "admin.auths.new"}}</button>
|
2015-12-07 22:30:52 +00:00
|
|
|
</div>
|
2017-03-15 22:39:38 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h4 class="ui top attached header">
|
2023-09-25 08:56:50 +00:00
|
|
|
{{ctx.Locale.Tr "admin.auths.tips"}}
|
2017-03-15 22:39:38 +00:00
|
|
|
</h4>
|
|
|
|
<div class="ui attached segment">
|
2024-03-17 16:04:11 +00:00
|
|
|
<h5>{{ctx.Locale.Tr "admin.auths.tips.gmail_settings"}}</h5>
|
2017-03-15 22:39:38 +00:00
|
|
|
<p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p>
|
2017-05-01 13:26:53 +00:00
|
|
|
|
2023-09-25 08:56:50 +00:00
|
|
|
<h5 class="oauth2">{{ctx.Locale.Tr "admin.auths.tips.oauth2.general"}}:</h5>
|
|
|
|
<p class="oauth2">{{ctx.Locale.Tr "admin.auths.tips.oauth2.general.tip"}} <b id="oauth2-callback-url"></b></p>
|
2017-05-01 13:26:53 +00:00
|
|
|
|
2023-09-25 08:56:50 +00:00
|
|
|
<h5 class="ui top attached header">{{ctx.Locale.Tr "admin.auths.tip.oauth2_provider"}}</h5>
|
2017-05-01 13:26:53 +00:00
|
|
|
<div class="ui attached segment">
|
|
|
|
<li>Bitbucket</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.bitbucket"}}</span>
|
2017-05-01 13:26:53 +00:00
|
|
|
<li>Dropbox</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.dropbox"}}</span>
|
2017-05-01 13:26:53 +00:00
|
|
|
<li>Facebook</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.facebook"}}</span>
|
2017-05-01 13:26:53 +00:00
|
|
|
<li>GitHub</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.github"}}</span>
|
2017-05-01 13:26:53 +00:00
|
|
|
<li>GitLab</li>
|
2024-03-21 15:48:13 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.gitlab_new"}}</span>
|
2019-09-14 10:02:39 +00:00
|
|
|
<li>Google</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.google_plus"}}</span>
|
2017-05-01 13:26:53 +00:00
|
|
|
<li>OpenID Connect</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.openid_connect"}}</span>
|
2017-05-01 13:26:53 +00:00
|
|
|
<li>Twitter</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.twitter"}}</span>
|
2019-01-13 19:06:22 +00:00
|
|
|
<li>Discord</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.discord"}}</span>
|
2019-09-13 02:15:36 +00:00
|
|
|
<li>Gitea</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.gitea"}}</span>
|
2020-03-03 03:11:45 +00:00
|
|
|
<li>Nextcloud</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.nextcloud"}}</span>
|
2020-03-04 22:08:52 +00:00
|
|
|
<li>Yandex</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.yandex"}}</span>
|
2021-04-11 03:46:37 +00:00
|
|
|
<li>Mastodon</li>
|
2023-09-25 08:56:50 +00:00
|
|
|
<span>{{ctx.Locale.Tr "admin.auths.tip.mastodon"}}</span>
|
2017-05-01 13:26:53 +00:00
|
|
|
</div>
|
2015-12-07 22:30:52 +00:00
|
|
|
</div>
|
2014-05-03 02:48:14 +00:00
|
|
|
</div>
|
2023-04-23 10:21:21 +00:00
|
|
|
{{template "admin/layout_footer" .}}
|