1
0
Fork 0
forked from forgejo/forgejo

Extract constant names out for the ReverseProxy and Basic authentication methods (#17735)

In order to reduce load on the GC extract out the constant names of the Basic and ReverseProxy methods.

As mentioned in https://github.com/go-gitea/gitea/pull/15119#discussion_r730352176

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath 2021-11-20 15:33:18 +00:00 committed by GitHub
parent 931d0cf854
commit f8ec43dbc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 5 deletions

View file

@ -24,6 +24,9 @@ var (
_ Named = &ReverseProxy{}
)
// ReverseProxyMethodName is the constant name of the ReverseProxy authentication method
const ReverseProxyMethodName = "reverse_proxy"
// ReverseProxy implements the Auth interface, but actually relies on
// a reverse proxy for authentication of users.
// On successful authentication the proxy is expected to populate the username in the
@ -43,7 +46,7 @@ func (r *ReverseProxy) getUserName(req *http.Request) string {
// Name represents the name of auth method
func (r *ReverseProxy) Name() string {
return "reverse_proxy"
return ReverseProxyMethodName
}
// Verify extracts the username from the "setting.ReverseProxyAuthUser" header