Class: AppleAuth::JWTConditions

Inherits:
Object
  • Object
show all
Includes:
Conditions
Defined in:
lib/apple_auth/helpers/jwt_conditions.rb

Constant Summary collapse

CONDITIONS =
[
  AudCondition,
  ExpCondition,
  IatCondition,
  IssCondition
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_identity, decoded_jwt) ⇒ JWTConditions

Returns a new instance of JWTConditions.



16
17
18
19
# File 'lib/apple_auth/helpers/jwt_conditions.rb', line 16

def initialize(user_identity, decoded_jwt)
  @user_identity = user_identity
  @decoded_jwt = decoded_jwt
end

Instance Attribute Details

#decoded_jwtObject (readonly)

Returns the value of attribute decoded_jwt.



14
15
16
# File 'lib/apple_auth/helpers/jwt_conditions.rb', line 14

def decoded_jwt
  @decoded_jwt
end

#user_identityObject (readonly)

Returns the value of attribute user_identity.



14
15
16
# File 'lib/apple_auth/helpers/jwt_conditions.rb', line 14

def user_identity
  @user_identity
end

Instance Method Details

#validate!Object



21
22
23
24
25
# File 'lib/apple_auth/helpers/jwt_conditions.rb', line 21

def validate!
  JWT::ClaimsValidator.new(decoded_jwt).validate! && validate_sub! && jwt_conditions_validate!
rescue JWT::InvalidPayload => e
  raise JWTValidationError, e.message
end