Support external authenticaton source #129
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
orinoco/dump-things-server!129
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "external-auth-source"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
TODO
Description
This PR adds the ability to use multiple authentication sources for user authentication and authorization. The supported sources are:
The PR adds the new optional, collection-level configuration key
auth_sourcesto the configuration. The key contains a list of authentication source definitions. Authentication sources are tried in order until a token can be authenticated, or no more authentication sources are available. If the same authentication source is defined multiple times, only the first instance is used. Theauthkey is optional. If the key is not present, the configuration file is used as the sole authentication source.The PR modifies the code to allow on-demand creation of token stores. This is necessary to support the authentication of tokens that are not defined a priori in the configuration.
Configuration authentication source
Forgejo authentication source
A token is successfully authenticated if all of the following hold:
If no repository is provided, the token has to have at least read permissions for:
If a repository is provided, the token has to have at least read permissions for:
This is required to determine the teams that have access to the repository.
User ID
The user ID is the email of the user
Incoming label
If
incoming_label_typeisteam, the incoming label will be:forgejo-team-<organization-name>-<team-name>.If
incoming_label_typeisuser, the incoming label will beforgejo-user-<user-login>.Permissions
The permissions will be fetched from the unit
repo.codeof the team definition. The following mapping is applied:repo.codenoneFalseFalseFalsereadTrueTrueFalsewriteTrueTrueTrueAdditional instructions:
Since Forgejo API requests can be expensive, lookups of teams, organizations, and team's access to repositories are cached until the service is restarted.