2019-01-06 06:44:33 +08:00
|
|
|
package auth
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/filebrowser/filebrowser/v2/settings"
|
|
|
|
"github.com/filebrowser/filebrowser/v2/users"
|
|
|
|
)
|
|
|
|
|
|
|
|
// MethodNoAuth is used to identify no auth.
|
|
|
|
const MethodNoAuth settings.AuthMethod = "noauth"
|
|
|
|
|
|
|
|
// NoAuth is no auth implementation of auther.
|
2019-01-08 04:34:44 +08:00
|
|
|
type NoAuth struct{}
|
2019-01-06 06:44:33 +08:00
|
|
|
|
|
|
|
// Auth uses authenticates user 1.
|
2021-03-02 19:00:18 +08:00
|
|
|
func (a NoAuth) Auth(r *http.Request, sto users.Store, root string) (*users.User, error) {
|
2019-01-09 02:43:04 +08:00
|
|
|
return sto.Get(root, uint(1))
|
2019-01-06 06:44:33 +08:00
|
|
|
}
|
2019-02-15 20:58:45 +08:00
|
|
|
|
|
|
|
// LoginPage tells that no auth doesn't require a login page.
|
|
|
|
func (a NoAuth) LoginPage() bool {
|
|
|
|
return false
|
|
|
|
}
|