mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-26 11:59:48 +01:00
Add authorization to new API
This commit is contained in:
parent
960415ed95
commit
8e03d7d013
7 changed files with 91 additions and 49 deletions
|
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/go-chi/chi/v5"
|
||||
"github.com/navidrome/navidrome/consts"
|
||||
"github.com/navidrome/navidrome/model"
|
||||
"github.com/navidrome/navidrome/server"
|
||||
)
|
||||
|
||||
var spec = func() *openapi3.T {
|
||||
|
|
@ -25,6 +26,8 @@ var spec = func() *openapi3.T {
|
|||
func New(ds model.DataStore) *Router {
|
||||
r := &Router{ds: ds}
|
||||
mux := chi.NewRouter()
|
||||
mux.Use(server.Authenticator(ds))
|
||||
mux.Use(server.JWTRefresher)
|
||||
mux.Use(middleware.OapiRequestValidatorWithOptions(spec, &middleware.Options{
|
||||
ErrorHandler: validationErrorHandler,
|
||||
}))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue