mirror of
https://github.com/1f349/mjwt.git
synced 2024-12-21 23:14:04 +00:00
Add SignJwt to Provider
This commit is contained in:
parent
c1712f1c1d
commit
b859e3a63a
1
mjwt.go
1
mjwt.go
@ -12,6 +12,7 @@ var ErrClaimTypeMismatch = errors.New("claim type mismatch")
|
||||
|
||||
type Provider interface {
|
||||
GenerateJwt(sub, id string, dur time.Duration, claims Claims) (string, error)
|
||||
SignJwt(claims jwt.Claims) (string, error)
|
||||
VerifyJwt(token string, claims baseTypeClaim) (*jwt.Token, error)
|
||||
Issuer() string
|
||||
}
|
||||
|
@ -45,6 +45,10 @@ func (d *defaultMJwtVerifier) GenerateJwt(_, _ string, _ time.Duration, _ Claims
|
||||
return "", ErrCannotGenerateMJwtToken
|
||||
}
|
||||
|
||||
func (d *defaultMJwtVerifier) SignJwt(_ jwt.Claims) (string, error) {
|
||||
return "", ErrCannotGenerateMJwtToken
|
||||
}
|
||||
|
||||
func (d *defaultMJwtVerifier) VerifyJwt(token string, claims baseTypeClaim) (*jwt.Token, error) {
|
||||
withClaims, err := jwt.ParseWithClaims(token, claims, func(token *jwt.Token) (interface{}, error) {
|
||||
return d.pub, nil
|
||||
|
Loading…
Reference in New Issue
Block a user