module JWT::Claims
JWT
Claim verifications datatracker.ietf.org/doc/html/rfc7519#section-4
Verification is supported for the following claims: exp nbf iss iat jti aud sub required numeric
Constants
- Error
-
Represents a claim verification error
- VerificationContext
-
Context class to contain the data passed to individual claim validators
@api private
Public Class Methods
Source
# File lib/jwt/claims.rb, line 69 def payload_errors(payload, *options) Verifier.errors(VerificationContext.new(payload: payload), *options) end
Returns the errors in the claims of the JWT
token.
@param options [Array] the options for verifying the claims. @return [Array<JWT::Claims::Error>] the errors in the claims of the JWT
Source
# File lib/jwt/claims.rb, line 61 def valid_payload?(payload, *options) payload_errors(payload, *options).empty? end
Checks if the claims in the JWT
payload are valid.
@param payload [Hash] the JWT
payload. @param options [Array] the options for verifying the claims. @return [Boolean] true if the claims are valid, false otherwise
Source
# File lib/jwt/claims.rb, line 37 def verify!(payload, options) Deprecations.warning('The ::JWT::Claims.verify! method is deprecated will be removed in the next major version of ruby-jwt') DecodeVerifier.verify!(payload, options) end
@deprecated Use {verify_payload!} instead. Will be removed in the next major version of ruby-jwt.
Source
# File lib/jwt/claims.rb, line 52 def verify_payload!(payload, *options) Verifier.verify!(VerificationContext.new(payload: payload), *options) end
Checks if the claims in the JWT
payload are valid. @example
::JWT::Claims.verify_payload!({"exp" => Time.now.to_i + 10}, :exp) ::JWT::Claims.verify_payload!({"exp" => Time.now.to_i - 10}, exp: { leeway: 11})
@param payload [Hash] the JWT
payload. @param options [Array] the options for verifying the claims. @return [void] @raise [JWT::DecodeError] if any claim is invalid.