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

Let web and API routes have different auth methods group #19168

Merged
merged 6 commits into from
Mar 28, 2022

Conversation

lunny
Copy link
Member

@lunny lunny commented Mar 22, 2022

Web routes and API routes should have different auth methods group.

@lunny lunny added the type/refactoring Existing code has been cleaned up. There should be no new functionality. label Mar 22, 2022
@lunny lunny added this to the 1.17.0 milestone Mar 22, 2022
@lunny lunny force-pushed the lunny/smale_refactor_auth branch 3 times, most recently from 9f777b6 to efe610e Compare March 23, 2022 06:36
Copy link
Member

@delvh delvh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can understand the changes in this PR.
However, I do not like that the code has to be present two times, once for the web and once for the API.
For now, however, refactoring that is out of scope for this PR.

routers/web/web.go Show resolved Hide resolved
services/auth/auth.go Outdated Show resolved Hide resolved
webauthn.Init()
}

// Free should be called exactly once when the application is terminating to allow Auth plugins
// to release necessary resources
func Free() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was that simply unused, or why can't I find a replacement for it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't find any reference for this function. It's wired.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 23, 2022
@lunny lunny force-pushed the lunny/smale_refactor_auth branch from efe610e to 9900b1d Compare March 25, 2022 01:12
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 28, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 28, 2022
@wxiaoguang
Copy link
Contributor

Should use a meaningful title to merge, current title remove the global methods but create dynamiclly is very vague

@lunny lunny changed the title remove the global methods but create dynamiclly Let web and API routes have different auth methods group Mar 28, 2022
@lunny lunny merged commit 6526733 into go-gitea:main Mar 28, 2022
@lunny lunny deleted the lunny/smale_refactor_auth branch March 28, 2022 04:46
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
)

* remove the global methods but create dynamiclly

* Fix lint

* Fix windows lint

* Fix windows lint

* some improvements

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 30, 2022
* giteaoffical/main: (31 commits)
  Add Package Registry (go-gitea#16510)
  Show messages for users if the ROOT_URL is wrong, show JavaScript errors (go-gitea#18971)
  [skip ci] Updated translations via Crowdin
  Make git.OpenRepository accept Context (go-gitea#19260)
  Use full output of git show-ref --tags to get tags for PushUpdateAddTag (go-gitea#19235)
  When conflicts have been previously detected ensure that they can be resolved (go-gitea#19247)
  More commit info from API (go-gitea#19252)
  Move some issue methods as functions (go-gitea#19255)
  Move project files into models/project sub package (go-gitea#17704)
  Granular webhook events in editHook (go-gitea#19251)
  Provide configuration to allow camo-media proxying (go-gitea#12802)
  Move init repository related functions to modules (go-gitea#19159)
  Move organization related structs into sub package (go-gitea#18518)
  Refactor repo clone button and repo clone links, fix JS error on empty repo page (go-gitea#19208)
  Show last cron messages on monitor page (go-gitea#19223)
  Allow API to create file on empty repo (go-gitea#19224)
  Use goproxy.io instead of goproxy.cn (go-gitea#19242)
  New cron task: delete old system notices (go-gitea#19219)
  Let web and API routes have different auth methods group (go-gitea#19168)
  Only send webhook events to active system webhooks and only deliver to active hooks (go-gitea#19234)
  ...
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants