mirror of
https://forgejo.merr.is/annika/jwtauth.git
synced 2025-12-11 13:47:41 -05:00
Move Verifier method to pkg-level func to accept *jwtauth.JwtAuth
This commit is contained in:
parent
a5d0d75313
commit
6444fb9aef
5 changed files with 24 additions and 7 deletions
|
|
@ -66,12 +66,14 @@ func NewWithParser(alg string, parser *jwt.Parser, signKey []byte, verifyKey []b
|
|||
// be the generic `jwtauth.Authenticator` middleware or your own custom handler
|
||||
// which checks the request context jwt token and error to prepare a custom
|
||||
// http response.
|
||||
func (ja *JwtAuth) Verifier(next http.Handler) http.Handler {
|
||||
return ja.Verify("")(next)
|
||||
func Verifier(ja *JwtAuth) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
return Verify(ja, "")(next)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: explain
|
||||
func (ja *JwtAuth) Verify(paramAliases ...string) func(http.Handler) http.Handler {
|
||||
func Verify(ja *JwtAuth, paramAliases ...string) func(http.Handler) http.Handler {
|
||||
return func(next http.Handler) http.Handler {
|
||||
hfn := func(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue