Class: IMS::LTI::Services::MessageAuthenticator
- Inherits:
-
Object
- Object
- IMS::LTI::Services::MessageAuthenticator
- Defined in:
- lib/ims/lti/services/message_authenticator.rb
Instance Attribute Summary collapse
-
#consumer_key ⇒ Object
readonly
Returns the value of attribute consumer_key.
-
#launch_url ⇒ Object
readonly
Returns the value of attribute launch_url.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
-
#simple_oauth_header ⇒ Object
readonly
Returns the value of attribute simple_oauth_header.
Instance Method Summary collapse
- #base_string ⇒ Object
-
#initialize(launch_url, params, secret) ⇒ MessageAuthenticator
constructor
A new instance of MessageAuthenticator.
- #signed_params ⇒ Object
- #valid_signature? ⇒ Boolean
Constructor Details
#initialize(launch_url, params, secret) ⇒ MessageAuthenticator
Returns a new instance of MessageAuthenticator.
6 7 8 9 10 11 12 13 |
# File 'lib/ims/lti/services/message_authenticator.rb', line 6 def initialize(launch_url, params, secret) @launch_url = launch_url @params = params @options, @parsed_params = parse_params(params) @consumer_key = @options[:consumer_key] @signature = @parsed_params.delete(:oauth_signature) @secret = secret end |
Instance Attribute Details
#consumer_key ⇒ Object (readonly)
Returns the value of attribute consumer_key.
4 5 6 |
# File 'lib/ims/lti/services/message_authenticator.rb', line 4 def consumer_key @consumer_key end |
#launch_url ⇒ Object (readonly)
Returns the value of attribute launch_url.
4 5 6 |
# File 'lib/ims/lti/services/message_authenticator.rb', line 4 def launch_url @launch_url end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/ims/lti/services/message_authenticator.rb', line 4 def @message end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
4 5 6 |
# File 'lib/ims/lti/services/message_authenticator.rb', line 4 def params @params end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
4 5 6 |
# File 'lib/ims/lti/services/message_authenticator.rb', line 4 def signature @signature end |
#simple_oauth_header ⇒ Object (readonly)
Returns the value of attribute simple_oauth_header.
4 5 6 |
# File 'lib/ims/lti/services/message_authenticator.rb', line 4 def simple_oauth_header @simple_oauth_header end |
Instance Method Details
#base_string ⇒ Object
44 45 46 |
# File 'lib/ims/lti/services/message_authenticator.rb', line 44 def base_string simple_oauth_header.send(:signature_base) end |
#signed_params ⇒ Object
48 49 50 |
# File 'lib/ims/lti/services/message_authenticator.rb', line 48 def signed_params simple_oauth_header.signed_attributes.merge(@parsed_params) end |
#valid_signature? ⇒ Boolean
16 17 18 |
# File 'lib/ims/lti/services/message_authenticator.rb', line 16 def valid_signature? .jwt ? valid_jwt? : simple_oauth_header.valid?(signature: signature) end |