mirror of
https://github.com/1f349/mjwt.git
synced 2024-12-22 07:24:05 +00:00
Properly validate registered claims
This commit is contained in:
parent
9a859eb2d7
commit
994bb4e478
3
mjwt.go
3
mjwt.go
@ -63,6 +63,9 @@ func (b *BaseTypeClaims[T]) init() *BaseTypeClaims[T] {
|
|||||||
|
|
||||||
// Valid checks the InternalClaimType matches and the type claim type
|
// Valid checks the InternalClaimType matches and the type claim type
|
||||||
func (b *BaseTypeClaims[T]) Valid() error {
|
func (b *BaseTypeClaims[T]) Valid() error {
|
||||||
|
if err := b.RegisteredClaims.Valid(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if b.ClaimType != b.InternalClaimType() {
|
if b.ClaimType != b.InternalClaimType() {
|
||||||
return ErrClaimTypeMismatch
|
return ErrClaimTypeMismatch
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user