From 2281dd9079b9cabc4879364fc0e4a5e74dfbbdde Mon Sep 17 00:00:00 2001 From: Christian Banse Date: Wed, 26 Oct 2022 19:11:37 +0200 Subject: [PATCH] exported CustomClaims --- validator.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/validator.go b/validator.go index faaea87..2e41133 100644 --- a/validator.go +++ b/validator.go @@ -30,7 +30,9 @@ type Validator struct { expectedAud string } -type customValidationType interface { +// CustomClaims represents a custom claims interface, which can be built upon the integrated +// claim types, such as map claims or registered claims. +type CustomClaims interface { // CustomValidation can be implemented by a user-specific claim to support // additional validation steps in addition to the regular validation. CustomValidation() error @@ -84,7 +86,7 @@ func (v *Validator) Validate(claims Claims) error { // Finally, we want to give the claim itself some possibility to do some // additional custom validation based on their custom claims - cvt, ok := claims.(customValidationType) + cvt, ok := claims.(CustomClaims) if ok { if err := cvt.CustomValidation(); err != nil { vErr.Inner = err