mirror of
https://forgejo.merr.is/annika/jwtauth.git
synced 2025-12-13 20:37:43 -05:00
Vendor jwt-go at v2.7.0
This commit is contained in:
parent
c97496f7ab
commit
e8c0a67e4d
16 changed files with 1225 additions and 0 deletions
24
vendor/github.com/dgrijalva/jwt-go/signing_method.go
generated
vendored
Normal file
24
vendor/github.com/dgrijalva/jwt-go/signing_method.go
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package jwt
|
||||
|
||||
var signingMethods = map[string]func() SigningMethod{}
|
||||
|
||||
// Implement SigningMethod to add new methods for signing or verifying tokens.
|
||||
type SigningMethod interface {
|
||||
Verify(signingString, signature string, key interface{}) error // Returns nil if signature is valid
|
||||
Sign(signingString string, key interface{}) (string, error) // Returns encoded signature or error
|
||||
Alg() string // returns the alg identifier for this method (example: 'HS256')
|
||||
}
|
||||
|
||||
// Register the "alg" name and a factory function for signing method.
|
||||
// This is typically done during init() in the method's implementation
|
||||
func RegisterSigningMethod(alg string, f func() SigningMethod) {
|
||||
signingMethods[alg] = f
|
||||
}
|
||||
|
||||
// Get a signing method from an "alg" string
|
||||
func GetSigningMethod(alg string) (method SigningMethod) {
|
||||
if methodF, ok := signingMethods[alg]; ok {
|
||||
method = methodF()
|
||||
}
|
||||
return
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue