2019-01-05 22:44:33 +00:00
|
|
|
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"
|
2019-01-05 22:44:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// MethodNoAuth is used to identify no auth.
|
2023-08-05 12:32:43 +00:00
|
|
|
const MethodNoAuth = "noauth"
|
2019-01-05 22:44:33 +00:00
|
|
|
|
|
|
|
// NoAuth is no auth implementation of auther.
|
2019-01-07 20:34:44 +00:00
|
|
|
type NoAuth struct{}
|
2019-01-05 22:44:33 +00:00
|
|
|
|
|
|
|
// 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))
|
2019-01-05 22:44:33 +00:00
|
|
|
}
|
2019-02-15 12:58:45 +00:00
|
|
|
|
|
|
|
// LoginPage tells that no auth doesn't require a login page.
|
|
|
|
func (a NoAuth) LoginPage() bool {
|
|
|
|
return false
|
|
|
|
}
|