@@ -28,13 +28,13 @@ type ClaimsValidator interface {
2828 Validate () error
2929}
3030
31- // validator is the core of the new Validation API. It is automatically used by
31+ // Validator is the core of the new Validation API. It is automatically used by
3232// a [Parser] during parsing and can be modified with various parser options.
3333//
3434// Note: This struct is intentionally not exported (yet) as we want to
3535// internally finalize its API. In the future, we might make it publicly
3636// available.
37- type validator struct {
37+ type Validator struct {
3838 // leeway is an optional leeway that can be provided to account for clock skew.
3939 leeway time.Duration
4040
@@ -64,14 +64,14 @@ type validator struct {
6464
6565// NewValidator can be used to create a stand-alone validator with the supplied
6666// options. This validator can then be used to validate already parsed claims.
67- func NewValidator (opts ... ParserOption ) * validator {
67+ func NewValidator (opts ... ParserOption ) * Validator {
6868 p := NewParser (opts ... )
6969 return p .validator
7070}
7171
7272// Validate validates the given claims. It will also perform any custom
7373// validation if claims implements the [ClaimsValidator] interface.
74- func (v * validator ) Validate (claims Claims ) error {
74+ func (v * Validator ) Validate (claims Claims ) error {
7575 var (
7676 now time.Time
7777 errs []error = make ([]error , 0 , 6 )
@@ -149,7 +149,7 @@ func (v *validator) Validate(claims Claims) error {
149149//
150150// Additionally, if any error occurs while retrieving the claim, e.g., when its
151151// the wrong type, an ErrTokenUnverifiable error will be returned.
152- func (v * validator ) verifyExpiresAt (claims Claims , cmp time.Time , required bool ) error {
152+ func (v * Validator ) verifyExpiresAt (claims Claims , cmp time.Time , required bool ) error {
153153 exp , err := claims .GetExpirationTime ()
154154 if err != nil {
155155 return err
@@ -170,7 +170,7 @@ func (v *validator) verifyExpiresAt(claims Claims, cmp time.Time, required bool)
170170//
171171// Additionally, if any error occurs while retrieving the claim, e.g., when its
172172// the wrong type, an ErrTokenUnverifiable error will be returned.
173- func (v * validator ) verifyIssuedAt (claims Claims , cmp time.Time , required bool ) error {
173+ func (v * Validator ) verifyIssuedAt (claims Claims , cmp time.Time , required bool ) error {
174174 iat , err := claims .GetIssuedAt ()
175175 if err != nil {
176176 return err
@@ -191,7 +191,7 @@ func (v *validator) verifyIssuedAt(claims Claims, cmp time.Time, required bool)
191191//
192192// Additionally, if any error occurs while retrieving the claim, e.g., when its
193193// the wrong type, an ErrTokenUnverifiable error will be returned.
194- func (v * validator ) verifyNotBefore (claims Claims , cmp time.Time , required bool ) error {
194+ func (v * Validator ) verifyNotBefore (claims Claims , cmp time.Time , required bool ) error {
195195 nbf , err := claims .GetNotBefore ()
196196 if err != nil {
197197 return err
@@ -211,7 +211,7 @@ func (v *validator) verifyNotBefore(claims Claims, cmp time.Time, required bool)
211211//
212212// Additionally, if any error occurs while retrieving the claim, e.g., when its
213213// the wrong type, an ErrTokenUnverifiable error will be returned.
214- func (v * validator ) verifyAudience (claims Claims , cmp string , required bool ) error {
214+ func (v * Validator ) verifyAudience (claims Claims , cmp string , required bool ) error {
215215 aud , err := claims .GetAudience ()
216216 if err != nil {
217217 return err
@@ -247,7 +247,7 @@ func (v *validator) verifyAudience(claims Claims, cmp string, required bool) err
247247//
248248// Additionally, if any error occurs while retrieving the claim, e.g., when its
249249// the wrong type, an ErrTokenUnverifiable error will be returned.
250- func (v * validator ) verifyIssuer (claims Claims , cmp string , required bool ) error {
250+ func (v * Validator ) verifyIssuer (claims Claims , cmp string , required bool ) error {
251251 iss , err := claims .GetIssuer ()
252252 if err != nil {
253253 return err
@@ -267,7 +267,7 @@ func (v *validator) verifyIssuer(claims Claims, cmp string, required bool) error
267267//
268268// Additionally, if any error occurs while retrieving the claim, e.g., when its
269269// the wrong type, an ErrTokenUnverifiable error will be returned.
270- func (v * validator ) verifySubject (claims Claims , cmp string , required bool ) error {
270+ func (v * Validator ) verifySubject (claims Claims , cmp string , required bool ) error {
271271 sub , err := claims .GetSubject ()
272272 if err != nil {
273273 return err
0 commit comments