mirror of
https://github.com/kataras/iris.git
synced 2026-01-09 04:51:56 +00:00
add a jwt tutorial + go client
This commit is contained in:
@@ -80,6 +80,13 @@ type Verifier struct {
|
||||
// Get the context user:
|
||||
// username, err := ctx.User().GetUsername()
|
||||
func NewVerifier(signatureAlg Alg, signatureKey interface{}, validators ...TokenValidator) *Verifier {
|
||||
if signatureAlg == HS256 {
|
||||
// A tiny helper if the end-developer uses string instead of []byte for hmac keys.
|
||||
if k, ok := signatureKey.(string); ok {
|
||||
signatureKey = []byte(k)
|
||||
}
|
||||
}
|
||||
|
||||
return &Verifier{
|
||||
Alg: signatureAlg,
|
||||
Key: signatureKey,
|
||||
|
||||
Reference in New Issue
Block a user