mirror of
https://github.com/restic/rest-server.git
synced 2025-11-01 13:50:59 +00:00
19 lines
300 B
Go
19 lines
300 B
Go
package main
|
|
|
|
import (
|
|
"errors"
|
|
"net/http"
|
|
)
|
|
|
|
func Authorize(r *http.Request) error {
|
|
username, password, ok := r.BasicAuth()
|
|
if !ok {
|
|
return errors.New("malformed basic auth credentials")
|
|
}
|
|
|
|
if username != "user" || password != "pass" {
|
|
return errors.New("unknown user")
|
|
}
|
|
|
|
return nil
|
|
}
|