filebrowser/backend/auth/none.go

25 lines
575 B
Go
Raw Permalink Normal View History

package auth
import (
"net/http"
2025-01-05 19:05:33 +00:00
"github.com/gtsteffaniak/filebrowser/backend/files"
2024-12-17 00:01:55 +00:00
"github.com/gtsteffaniak/filebrowser/backend/users"
)
// MethodNoAuth is used to identify no auth.
2023-08-05 12:32:43 +00:00
const MethodNoAuth = "noauth"
// NoAuth is no auth implementation of auther.
type NoAuth struct{}
// Auth uses authenticates user 1.
2024-11-21 00:15:30 +00:00
func (a NoAuth) Auth(r *http.Request, usr *users.Storage) (*users.User, error) {
2025-01-05 19:05:33 +00:00
return usr.Get(files.RootPaths["default"], uint(1))
}
// LoginPage tells that no auth doesn't require a login page.
func (a NoAuth) LoginPage() bool {
return false
}