lint fixes
This commit is contained in:
parent
edf16121db
commit
618d8691d3
13
auth/jwt.go
13
auth/jwt.go
@ -2,13 +2,13 @@ package auth
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
nerrors "errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/coreos/go-oidc/v3/oidc"
|
"github.com/coreos/go-oidc/v3/oidc"
|
||||||
fberrors "github.com/filebrowser/filebrowser/v2/errors"
|
"github.com/filebrowser/filebrowser/v2/errors"
|
||||||
"github.com/filebrowser/filebrowser/v2/settings"
|
"github.com/filebrowser/filebrowser/v2/settings"
|
||||||
"github.com/filebrowser/filebrowser/v2/users"
|
"github.com/filebrowser/filebrowser/v2/users"
|
||||||
)
|
)
|
||||||
@ -51,10 +51,13 @@ func (a *JWTAuth) Auth(r *http.Request, usr users.Store, stg *settings.Settings,
|
|||||||
}
|
}
|
||||||
|
|
||||||
payload := map[string]string{}
|
payload := map[string]string{}
|
||||||
token.Claims(&payload)
|
err = token.Claims(&payload)
|
||||||
|
if err != nil {
|
||||||
|
return nil, os.ErrPermission
|
||||||
|
}
|
||||||
|
|
||||||
user, err := usr.Get(srv.Root, payload[a.UsernameClaim])
|
user, err := usr.Get(srv.Root, payload[a.UsernameClaim])
|
||||||
if errors.Is(err, fberrors.ErrNotExist) {
|
if nerrors.Is(err, errors.ErrNotExist) {
|
||||||
return nil, os.ErrPermission
|
return nil, os.ErrPermission
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +65,6 @@ func (a *JWTAuth) Auth(r *http.Request, usr users.Store, stg *settings.Settings,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LoginPage tells that proxy auth doesn't require a login page.
|
// LoginPage tells that proxy auth doesn't require a login page.
|
||||||
func (a JWTAuth) LoginPage() bool {
|
func (a *JWTAuth) LoginPage() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user