forked from forgejo/forgejo
[GITEA] Revert "Deprecate query string auth tokens (#28390)"
It shows warnings although the setting is not set, this will surely be fixed later but there is no sense in spaming the users right now. This revert can be discarded when another fix lands in v1.21. su -c "forgejo admin user generate-access-token -u root --raw --scopes 'all,sudo'" git 2023/12/12 15:54:45 .../setting/security.go:166:loadSecurityFrom() [W] Enabling Query API Auth tokens is not recommended. DISABLE_QUERY_AUTH_TOKEN will default to true in gitea 1.23 and will be removed in gitea 1.24. This reverts commit4e879fed90
. Conflicts: routers/api/v1/api.go trivial context conflict (cherry picked from commitdec6f80559
) (cherry picked from commit807b6d9066
)
This commit is contained in:
parent
2262654cd7
commit
37e21a0c17
5 changed files with 7 additions and 39 deletions
|
@ -35,12 +35,10 @@
|
|||
// type: apiKey
|
||||
// name: token
|
||||
// in: query
|
||||
// description: This authentication option is deprecated for removal in Gitea 1.23. Please use AuthorizationHeaderToken instead.
|
||||
// AccessToken:
|
||||
// type: apiKey
|
||||
// name: access_token
|
||||
// in: query
|
||||
// description: This authentication option is deprecated for removal in Gitea 1.23. Please use AuthorizationHeaderToken instead.
|
||||
// AuthorizationHeaderToken:
|
||||
// type: apiKey
|
||||
// name: Authorization
|
||||
|
@ -808,13 +806,6 @@ func individualPermsChecker(ctx *context.APIContext) {
|
|||
}
|
||||
}
|
||||
|
||||
// check for and warn against deprecated authentication options
|
||||
func checkDeprecatedAuthMethods(ctx *context.APIContext) {
|
||||
if ctx.FormString("token") != "" || ctx.FormString("access_token") != "" {
|
||||
ctx.Resp.Header().Set("Warning", "token and access_token API authentication is deprecated and will be removed in gitea 1.23. Please use AuthorizationHeaderToken instead. Existing queries will continue to work but without authorization.")
|
||||
}
|
||||
}
|
||||
|
||||
// Routes registers all v1 APIs routes to web application.
|
||||
func Routes() *web.Route {
|
||||
m := web.NewRoute()
|
||||
|
@ -831,8 +822,6 @@ func Routes() *web.Route {
|
|||
}
|
||||
m.Use(context.APIContexter())
|
||||
|
||||
m.Use(checkDeprecatedAuthMethods)
|
||||
|
||||
// Get user from session if logged in.
|
||||
m.Use(apiAuth(buildAuthGroup()))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue