Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Summary] Improve auth source / login system #24821

Open
wxiaoguang opened this issue May 20, 2023 · 3 comments
Open

[Summary] Improve auth source / login system #24821

wxiaoguang opened this issue May 20, 2023 · 3 comments
Labels
type/summary This issue aggregates a bunch of other issues

Comments

@wxiaoguang
Copy link
Contributor

wxiaoguang commented May 20, 2023

Feature Description

There are more and more requirements for a better login system.

Including (but not only):

Some of them might be improved by a "patch", but Gitea really needs a better login system to satisfies most users, otherwise some changes may conflict and block each other eventually.

The first step IMO is to have a (nearly) complete design,to define the expected behaviors for various situations.

Screenshots

No response

@wxiaoguang wxiaoguang added type/proposal The new feature has not been accepted yet but needs to be discussed first. type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels May 20, 2023
@wxiaoguang wxiaoguang added type/summary This issue aggregates a bunch of other issues and removed type/proposal The new feature has not been accepted yet but needs to be discussed first. type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels May 20, 2023
@pboguslawski
Copy link
Contributor

pboguslawski commented May 20, 2023

Ideas to consider:

  • implement separate framework (go interface, as stable as possible to avoid breaking compatibility with modules/plugins, as general as possible to allow different solutions, even not known today) for (1) authentication and (2) authorization and (3) user list and migrate existing stuff as separate modules/plugins; allow implementing other modules/plugins in the future,
  • ad (1): allow user choose active authentication backends; user should be authenticated if any of active backends allows user (don't think of tokens, passwords only; present HTTP header or sometimes client IP may be enough for some scenarios); don't force users to use specific backends (i.e. oauth, tokens, passwords) nor 2fa (not required when frontend proxy is safe enough and should be trusted blindly); don't assume signon/signin/2fa features are always required (external user backends like LDAP/reverse proxy may work without it),
  • ad (2): privileges from different active authz backends should be summarized problably,
  • ad (3): users should be periodically synchronized from all active backends (i.e. disable inactive users from LDAP) and created automatically on first login (before sync),
  • don't allow local modification of user data that is synchronized from external backend (or allow to disable local user management globally in app if easier),
  • for easier maintenance (i.e. less code, automatic setup friendly) and security probably (no access to sensitive config stuff from SQL) allow backend configuration in files (i.e. app.ini) only not UI+SQL (UI is not required for such things and costs time for implementation and maintenance),
  • due to the high level of difficulty should be implemented in stages probably.

@jrjake
Copy link

jrjake commented Jul 9, 2023

I think a good first step to this would be to only show username/email field on login page for first render, so flow sort of looks like this:

  • User enter email/username and click "Next" button
  • Browser POST with email/username, Gitea checks that account exists.
    • If not exist, Gitea either shows error or redirects to default authentication source (maybe make this configurable in future, but just default to local authentication for now).
    • If exist, Gitea will change action based on account type.
      • If local/SMTP/PAM/LDAP, render password form for user.
      • If SPNEGO, Gitea will send 401 header with Authenticate: Negotiate header and render some "Login in progress" template which gives info about what to do if not working (something like "This authentication method is only supported by computers running Windows. If login does not occur within a reasonable timeframe, please contact your system administrator")
      • If OpenID, Gitea will redirect to IdP instead of prompt for password.
  • User complete authentication challenge, which logs them in using existing functionality.

A good example of this would be https://accounts.zoho.com/signin. What do others think?

@pboguslawski
Copy link
Contributor

I think a good first step to this would be to only show username/email field on login page for first render

In case of reverse proxy auth/header auth/certificate auth no login form is used and should not be rendered nor available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/summary This issue aggregates a bunch of other issues
Projects
None yet
Development

No branches or pull requests

3 participants