Module: JwtClaims::Claim::Aud

Defined in:
lib/jwt_claims/claim/aud.rb

Overview

Audience

Class Method Summary collapse

Class Method Details

.reject?(aud, options = {}) ⇒ true, false

Returns whether to reject the claim.

Parameters:

  • aud (Array, String)

    the intended recipients of the JWT

  • options (Hash) (defaults to: {})

    (key aud:) expected audience (or recipient) to match with claim

Returns:

  • (true, false)

    whether to reject the claim



14
15
16
17
18
# File 'lib/jwt_claims/claim/aud.rb', line 14

def reject?(aud, options = {})
  audience = aud.is_a?(Array) ? aud : [aud]
  expected_recipient = options.fetch(:aud, nil)
  !present_and_member?(audience, expected_recipient)
end