0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-21 23:11:05 +01:00

Fix comments

This commit is contained in:
Lunny Xiao 2024-10-01 21:17:51 -07:00
parent 162ff1a110
commit f6cbb4ead7
No known key found for this signature in database
GPG key ID: C3B7C91B632F738A

View file

@ -28,11 +28,11 @@ const ReverseProxyMethodName = "reverse_proxy"
// ReverseProxy implements the Auth interface, but actually relies on // ReverseProxy implements the Auth interface, but actually relies on
// a reverse proxy for authentication of users. // a reverse proxy for authentication of users.
// On successful authentication the proxy is expected to populate the username in the // On successful authentication the proxy is expected to populate the username in the
// "setting.ReverseProxyAuthUser" header. Optionally it can also populate the email of the // "setting.ReverseProxyAuth.ReverseProxyAuthUser" header. Optionally it can also populate the email of the
// user in the "setting.ReverseProxyAuthEmail" header. // user in the "setting.ReverseProxyAuthEmail" header.
type ReverseProxy struct{} type ReverseProxy struct{}
// getUserName extracts the username from the "setting.ReverseProxyAuthUser" header // getUserName extracts the username from the "setting.ReverseProxyAuth.ReverseProxyAuthUser" header
func (r *ReverseProxy) getUserName(req *http.Request) string { func (r *ReverseProxy) getUserName(req *http.Request) string {
return strings.TrimSpace(req.Header.Get(setting.ReverseProxyAuth.ReverseProxyAuthUser)) return strings.TrimSpace(req.Header.Get(setting.ReverseProxyAuth.ReverseProxyAuthUser))
} }
@ -42,11 +42,11 @@ func (r *ReverseProxy) Name() string {
return ReverseProxyMethodName return ReverseProxyMethodName
} }
// getUserFromAuthUser extracts the username from the "setting.ReverseProxyAuthUser" header // getUserFromAuthUser extracts the username from the "setting.ReverseProxyAuth.ReverseProxyAuthUser" header
// of the request and returns the corresponding user object for that name. // of the request and returns the corresponding user object for that name.
// Verification of header data is not performed as it should have already been done by // Verification of header data is not performed as it should have already been done by
// the reverse proxy. // the reverse proxy.
// If a username is available in the "setting.ReverseProxyAuthUser" header an existing // If a username is available in the "setting.ReverseProxyAuth.ReverseProxyAuthUser" header an existing
// user object is returned (populated with username or email found in header). // user object is returned (populated with username or email found in header).
// Returns nil if header is empty. // Returns nil if header is empty.
func (r *ReverseProxy) getUserFromAuthUser(req *http.Request) (*user_model.User, error) { func (r *ReverseProxy) getUserFromAuthUser(req *http.Request) (*user_model.User, error) {