snap/auth/noauth.go

30 lines
581 B
Go
Raw Normal View History

package auth
import "net/http"
2023-05-23 14:09:57 +00:00
// ----------------------------------------------------------------------------------------------------------------------
type NoAuth struct {
User AuthData
}
func (a *NoAuth) DoAuth(w http.ResponseWriter, r *http.Request) (*AuthData, int) {
return &a.User, http.StatusOK
}
func (a *NoAuth) AddUser(user string, group string, password string) error {
return nil
}
func (a *NoAuth) DeleteUser(user string) error {
return nil
}
func NewNoAuth() AuthManager {
return &NoAuth{
User: AuthData{
User: "admin",
Group: "admin",
},
}
}