MCPcopy
hub / github.com/filebrowser/filebrowser / Auth

Method Auth

auth/proxy.go:21–28  ·  view source on GitHub ↗

Auth authenticates the user via an HTTP header.

(r *http.Request, usr users.Store, setting *settings.Settings, srv *settings.Server)

Source from the content-addressed store, hash-verified

19
20// Auth authenticates the user via an HTTP header.
21func (a ProxyAuth) Auth(r *http.Request, usr users.Store, setting *settings.Settings, srv *settings.Server) (*users.User, error) {
22 username := r.Header.Get(a.Header)
23 user, err := usr.Get(srv.Root, srv.FollowExternalSymlinks, username)
24 if errors.Is(err, fberrors.ErrNotExist) {
25 return a.createUser(usr, setting, srv, username)
26 }
27 return user, err
28}
29
30func (a ProxyAuth) createUser(usr users.Store, setting *settings.Settings, srv *settings.Server, username string) (*users.User, error) {
31 const randomPasswordLength = settings.DefaultMinimumPasswordLength + 10

Calls 2

createUserMethod · 0.95
GetMethod · 0.65

Tested by 1