errors.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*-
  2. * Copyright 2016 Zbigniew Mandziejewicz
  3. * Copyright 2016 Square, Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package jwt
  18. import "errors"
  19. // ErrUnmarshalAudience indicates that aud claim could not be unmarshalled.
  20. var ErrUnmarshalAudience = errors.New("square/go-jose/jwt: expected string or array value to unmarshal to Audience")
  21. // ErrUnmarshalNumericDate indicates that JWT NumericDate could not be unmarshalled.
  22. var ErrUnmarshalNumericDate = errors.New("square/go-jose/jwt: expected number value to unmarshal NumericDate")
  23. // ErrInvalidClaims indicates that given claims have invalid type.
  24. var ErrInvalidClaims = errors.New("square/go-jose/jwt: expected claims to be value convertible into JSON object")
  25. // ErrInvalidIssuer indicates invalid iss claim.
  26. var ErrInvalidIssuer = errors.New("square/go-jose/jwt: validation failed, invalid issuer claim (iss)")
  27. // ErrInvalidSubject indicates invalid sub claim.
  28. var ErrInvalidSubject = errors.New("square/go-jose/jwt: validation failed, invalid subject claim (sub)")
  29. // ErrInvalidAudience indicated invalid aud claim.
  30. var ErrInvalidAudience = errors.New("square/go-jose/jwt: validation failed, invalid audience claim (aud)")
  31. // ErrInvalidID indicates invalid jti claim.
  32. var ErrInvalidID = errors.New("square/go-jose/jwt: validation failed, invalid ID claim (jti)")
  33. // ErrNotValidYet indicates that token is used before time indicated in nbf claim.
  34. var ErrNotValidYet = errors.New("square/go-jose/jwt: validation failed, token not valid yet (nbf)")
  35. // ErrExpired indicates that token is used after expiry time indicated in exp claim.
  36. var ErrExpired = errors.New("square/go-jose/jwt: validation failed, token is expired (exp)")
  37. // ErrInvalidContentType indicated that token requires JWT cty header.
  38. var ErrInvalidContentType = errors.New("square/go-jose/jwt: expected content type to be JWT (cty header)")