gitea/routers/repo
zeripath 17c5c654a5
Prevent double-login for Git HTTP and LFS and simplify login (#15303)
* Prevent double-login for Git HTTP and LFS and simplify login

There are a number of inconsistencies with our current methods for
logging in for git and lfs. The first is that there is a double login
process. This is particularly evident in 1.13 where there are no less
than 4 hash checks for basic authentication due to the previous
IsPasswordSet behaviour.

This duplicated code had individual inconsistencies that were not
helpful and caused confusion.

This PR does the following:

* Remove the specific login code from the git and lfs handlers except
for the lfs special bearer token
* Simplify the meaning of DisableBasicAuthentication to allow Token and
Oauth2 sign-in.
* The removal of the specific code from git and lfs means that these
both now have the same login semantics and can - if not
DisableBasicAuthentication - login from external services. Further it
allows Oauth2 token authentication as per our standard mechanisms.
* The change in the recovery handler prevents the service from
re-attempting to login - primarily because this could easily cause a
further panic and it is wasteful.

* add test

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
2021-05-15 17:32:09 +02:00
..
activity.go [refactor] replace int with httpStatusCodes (#15282) 2021-04-05 11:30:52 -04:00
attachment.go Add ETag header (#15370) 2021-04-12 10:49:26 -04:00
blame.go [refactor] replace int with httpStatusCodes (#15282) 2021-04-05 11:30:52 -04:00
branch.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00
commit.go [refactor] replace int with httpStatusCodes (#15282) 2021-04-05 11:30:52 -04:00
compare.go Add selecting tags on the compare page (#15723) 2021-05-07 23:10:05 +02:00
download.go Add mimetype mapping settings (#15133) 2021-05-10 16:38:08 -04:00
editor_test.go Add Close() method to gogitRepository (#8901) 2019-11-13 07:01:19 +00:00
editor.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00
http.go Prevent double-login for Git HTTP and LFS and simplify login (#15303) 2021-05-15 17:32:09 +02:00
issue_dependency.go Fix wrong permissions check when issues/prs shared operations (#9885) 2020-01-20 13:00:32 +01:00
issue_label_test.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00
issue_label.go Unified link creation. (#15619) 2021-04-30 19:25:13 +02:00
issue_lock.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00
issue_stopwatch.go Display current stopwatch in navbar (#14122) 2021-01-21 15:51:52 +01:00
issue_test.go Fix bug when combine label comments (#14894) 2021-03-05 16:17:32 +01:00
issue_timetrack.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00
issue_watch.go [refactor] replace int with httpStatusCodes (#15282) 2021-04-05 11:30:52 -04:00
issue.go Ensure that ctx.Written is checked after issues(...) calls (#15797) 2021-05-09 10:33:49 +08:00
lfs.go Refactor renders (#15175) 2021-04-19 18:25:08 -04:00
main_test.go Unit tests for wiki routers (#3022) 2017-11-30 17:52:15 +02:00
middlewares.go Add gitea-vet (#10948) 2020-04-05 07:20:50 +01:00
migrate.go Unified link creation. (#15619) 2021-04-30 19:25:13 +02:00
milestone.go Refactor renders (#15175) 2021-04-19 18:25:08 -04:00
projects_test.go KanBan: be able to set default board (#14147) 2021-01-15 22:29:32 +02:00
projects.go Refactor renders (#15175) 2021-04-19 18:25:08 -04:00
pull_review.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00
pull.go Unified link creation. (#15619) 2021-04-30 19:25:13 +02:00
release_test.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00
release.go fix some ui bug about draft release (#15137) 2021-05-06 05:12:50 +02:00
repo.go Unified link creation. (#15619) 2021-04-30 19:25:13 +02:00
search.go fix wrong file link in code search page (#15466) 2021-04-14 17:59:42 +02:00
setting_protected_branch.go Code Formats, Nits & Unused Func/Var deletions (#15286) 2021-04-09 09:40:34 +02:00
setting.go Close the gitrepo when deleting the repository (#15876) 2021-05-14 21:19:38 +01:00
settings_test.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00
topic.go [refactor] replace int with httpStatusCodes (#15282) 2021-04-05 11:30:52 -04:00
view.go Fix readme render bug (#15649) 2021-04-28 22:22:54 +02:00
webhook.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00
wiki_test.go Move modules/forms to services/forms (#15305) 2021-04-06 20:44:05 +01:00
wiki.go Refactor renders (#15175) 2021-04-19 18:25:08 -04:00