feat: hook authentication method

This commit is contained in:
Ramires Viana authored and Oleg Lobanov committed 2022-07-20 16:40:49 +02:00
1 parent f80b016ef0
commit dda9a389f3
12 files changed
+340 -14

No files matched your search

+2 -2
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
}