canvas_sync 0.27.3 → 0.27.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 737cc77b1803668c25294c6b0a0c669183e9a3e4d18ce315cb6833637787d6b4
|
|
4
|
+
data.tar.gz: 7fb94e9a30ab33104f2298710097a25c47366baf8fa62b87ac8d8e139bcf7e11
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 895e11f4343aa7f6448c714ef952478a68329f9aa3c673f665443c27a744081f350f5cfe5d9be77f14c477bb9e7a41f2c70f4f0fb7c0c7268d5d9593c534ab6d
|
|
7
|
+
data.tar.gz: 79460516a9f5cc75627702d1b2b67e790350e9703adc1c2f5da33ba97b92c3b6ed1066bb1231fe009dbfacbd7b5795db01b29576472f5a49bee4325414fb645b
|
|
@@ -46,7 +46,9 @@ module CanvasSync::Api
|
|
|
46
46
|
event = JSON.parse(request.raw_post) rescue nil
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
jwt = params[:_json] || request.raw_post
|
|
50
|
+
jwt = jwt.strip.gsub(/^"(.*)"$/, '\1') if jwt.is_a?(String) # Strip quotes if quoted
|
|
51
|
+
event ||= JSON::JWT.decode(jwt, dataservices_jwks)
|
|
50
52
|
event = event.to_h.with_indifferent_access
|
|
51
53
|
|
|
52
54
|
Rails.logger.debug("Processing event type: #{event['metadata']['event_name']}")
|
data/lib/canvas_sync/version.rb
CHANGED
|
@@ -50,5 +50,21 @@ RSpec.describe CanvasSync::Api::V1::LiveEventsController, type: :controller do
|
|
|
50
50
|
post :process_event, params: { "_json" => event.to_json }
|
|
51
51
|
expect(response).to_not be_successful
|
|
52
52
|
end
|
|
53
|
+
|
|
54
|
+
it "supports application/jwt" do
|
|
55
|
+
expect(controller).to receive(:dispatch_event)
|
|
56
|
+
expect(controller).to receive(:validate_tenant!)
|
|
57
|
+
request.headers['Content-Type'] = 'application/jwt'
|
|
58
|
+
post :process_event, body: JSON::JWT.new(event).sign(jwk).to_s
|
|
59
|
+
expect(response).to be_successful
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it "supports application/jwt (quoted)" do
|
|
63
|
+
expect(controller).to receive(:dispatch_event)
|
|
64
|
+
expect(controller).to receive(:validate_tenant!)
|
|
65
|
+
request.headers['Content-Type'] = 'application/jwt'
|
|
66
|
+
post :process_event, body: %["#{JSON::JWT.new(event).sign(jwk).to_s}"]
|
|
67
|
+
expect(response).to be_successful
|
|
68
|
+
end
|
|
53
69
|
end
|
|
54
70
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -7,6 +7,9 @@ Bundler.require :default, :development
|
|
|
7
7
|
Combustion::Application.configure do
|
|
8
8
|
config.enable_reloading = true # Required for with_model
|
|
9
9
|
end
|
|
10
|
+
|
|
11
|
+
# Register application/jwt MIME type for testing
|
|
12
|
+
Mime::Type.register "application/jwt", :jwt
|
|
10
13
|
Combustion.initialize! :active_record, :active_job
|
|
11
14
|
|
|
12
15
|
require 'rspec/rails'
|