mirror of
https://forgejo.merr.is/annika/jwtauth.git
synced 2025-12-11 12:43:14 -05:00
Add ErrNoTokenFound verify error
This commit is contained in:
parent
47cdb657f2
commit
ca8a698a9c
1 changed files with 4 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ var (
|
||||||
var (
|
var (
|
||||||
ErrUnauthorized = errors.New("jwtauth: token is unauthorized")
|
ErrUnauthorized = errors.New("jwtauth: token is unauthorized")
|
||||||
ErrExpired = errors.New("jwtauth: token is expired")
|
ErrExpired = errors.New("jwtauth: token is expired")
|
||||||
|
ErrNoTokenFound = errors.New("jwtauth: no token found")
|
||||||
)
|
)
|
||||||
|
|
||||||
type JWTAuth struct {
|
type JWTAuth struct {
|
||||||
|
|
@ -97,6 +98,9 @@ func VerifyRequest(ja *JWTAuth, r *http.Request, findTokenFns ...func(r *http.Re
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if tokenStr == "" {
|
||||||
|
return nil, ErrNoTokenFound
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: what other kinds of validations should we do / error messages?
|
// TODO: what other kinds of validations should we do / error messages?
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue