Class: PandaPal::LtiJwtValidator

Inherits:
Object
  • Object
show all
Defined in:
app/lib/panda_pal/lti_jwt_validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jwt, client_id) ⇒ LtiJwtValidator

Returns a new instance of LtiJwtValidator.



5
6
7
8
9
# File 'app/lib/panda_pal/lti_jwt_validator.rb', line 5

def initialize(jwt, client_id)
  @jwt = jwt
  @client_id = client_id
  @errors = []
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'app/lib/panda_pal/lti_jwt_validator.rb', line 3

def errors
  @errors
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
18
# File 'app/lib/panda_pal/lti_jwt_validator.rb', line 11

def valid?
  verify_audience(@jwt)
  verify_sub(@jwt)
  verify_nonce(@jwt)
  verify_issued_at(@jwt)
  verify_expiration(@jwt)
  errors.empty?
end