1
0
Fork 0
forgejo/models
Earl Warren 7cabc5670d
Implement remote user login source and promotion to regular user
A remote user (UserTypeRemoteUser) is a placeholder that can be
promoted to a regular user (UserTypeIndividual). It represents users
that exist somewhere else. Although the UserTypeRemoteUser already
exists in Forgejo, it is neither used or documented.

A new login type / source (Remote) is introduced and set to be the login type
of remote users.

Type        UserTypeRemoteUser
LogingType  Remote

The association between a remote user and its counterpart in another
environment (for instance another forge) is via the OAuth2 login
source:

LoginName   set to the unique identifier relative to the login source
LoginSource set to the identifier of the remote source

For instance when migrating from GitLab.com, a user can be created as
if it was authenticated using GitLab.com as an OAuth2 authentication
source.

When a user authenticates to Forejo from the same authentication
source and the identifier match, the remote user is promoted to a
regular user. For instance if 43 is the ID of the GitLab.com OAuth2
login source, 88 is the ID of the Remote loging source, and 48323
is the identifier of the foo user:

Type        UserTypeRemoteUser
LogingType  Remote
LoginName   48323
LoginSource 88
Email       (empty)
Name        foo

Will be promoted to the following when the user foo authenticates to
the Forgejo instance using GitLab.com as an OAuth2 provider. All users
with a LoginType of Remote and a LoginName of 48323 are examined. If
the LoginSource has a provider name that matches the provider name of
GitLab.com (usually just "gitlab"), it is a match and can be promoted.

The email is obtained via the OAuth2 provider and the user set to:

Type        UserTypeIndividual
LogingType  OAuth2
LoginName   48323
LoginSource 43
Email       foo@example.com
Name        foo

Note: the Remote login source is an indirection to the actual login
source, i.e. the provider string my be set to a login source that does
not exist yet.
2024-04-25 13:03:49 +02:00
..
actions Refactor more filterslice (gitea#30370) 2024-04-16 11:51:00 +02:00
activities Reduce unnecessary database queries on actions table (#30509) 2024-04-21 12:07:30 +02:00
admin
asymkey Clean up log messages (#30313) 2024-04-15 20:01:35 +02:00
auth Implement remote user login source and promotion to regular user 2024-04-25 13:03:49 +02:00
avatars Replace 10 more gt- classes with tw- (#29945) 2024-03-26 19:04:27 +01:00
db Merge pull request '[gitea] week 2024-17 cherry pick (gitea/main -> forgejo)' (#3350) from algernon/wcp/2024-17 into forgejo 2024-04-22 18:48:13 +00:00
dbfs
fixtures fix(actions): call automerge service on successful commit state 2024-04-15 16:17:45 +02:00
forgejo/semver
forgejo_migrations [FEAT]Add Option to hide Release Archive links (#3139) 2024-04-24 15:15:55 +00:00
git Merge pull request '[Port] container.FilterSlice function (gitea#30339 & gitea#30370)' (#3264) from oliverpool/forgejo:port_30339 into forgejo 2024-04-16 13:12:11 +00:00
issues Partial revert of "Refactor more filterslice (gitea#30370)" 2024-04-16 11:54:47 +02:00
migrations s/Gitea/Forgejo in various log messages and comments 2024-04-21 21:26:15 +05:00
organization Check the token's owner and repository when registering a runner (#30406) 2024-04-16 09:38:26 +02:00
packages Fix package list performance (#30520) 2024-04-21 16:28:16 +02:00
perm Users with read permission of pull requests can be assigned too (#27263) 2024-02-26 22:30:27 +01:00
project Fix migration v292 (#30153) 2024-03-30 07:17:32 +01:00
pull
repo [FEAT]Add Option to hide Release Archive links (#3139) 2024-04-24 15:15:55 +00:00
secret Make runs-on support variable expression (#29468) 2024-03-11 23:36:59 +07:00
shared/types
system
unit
unittest [CHORE] Remove Microsoft SQL Server Support 2024-04-05 23:37:36 +02:00
user Implement remote user login source and promotion to regular user 2024-04-25 13:03:49 +02:00
webhook webhook: sourcehut_builds: ask for access_token instead of authorization_header 2024-04-16 08:59:55 +02:00
error.go
fixture_generation.go
fixture_test.go
main_test.go
org.go
org_team.go
org_team_test.go
org_test.go
repo.go
repo_test.go
repo_transfer.go
repo_transfer_test.go