feat: hook authentication method

This commit is contained in:
Ramires Viana
2021-09-13 13:47:06 +00:00
committed by Oleg Lobanov
parent f80b016ef0
commit dda9a389f3
12 changed files with 340 additions and 14 deletions

View File

@@ -18,9 +18,9 @@ type ProxyAuth struct {
}
// Auth authenticates the user via an HTTP header.
func (a ProxyAuth) Auth(r *http.Request, sto users.Store, root string) (*users.User, error) {
func (a ProxyAuth) Auth(r *http.Request, usr users.Store, stg *settings.Settings, srv *settings.Server) (*users.User, error) {
username := r.Header.Get(a.Header)
user, err := sto.Get(root, username)
user, err := usr.Get(srv.Root, username)
if err == errors.ErrNotExist {
return nil, os.ErrPermission
}