etherpad_canvas 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67f5f0cb905c70a4b4452adc39b461034fd17961
4
- data.tar.gz: 67d3b594e5674551fc36abdd862a8d4423103818
3
+ metadata.gz: ccb6dcf3c4924ddaa7bdde322c1d6964a3f2570a
4
+ data.tar.gz: 59285dce7becc30a79e03f108fcc7090ec60ef06
5
5
  SHA512:
6
- metadata.gz: aa05534a12385563b3114f49f8668e71827dbafd8158e92c0eff1af7f43f60fd7b23ad7b5e35d3ad75135b3104f0c3974d2e0e070f94d613512246f678895b0c
7
- data.tar.gz: 89f74afa0e8de8e36f906b73e2c53d638dcb64e85b3866a58c1d1fcf314750699b27aa0fb54c4aefe87e9541e377167f5d4056c21effd2d73bac59999b66360a
6
+ metadata.gz: 52cd53f87601f4a230814ebb1ca6c5d7a28230e7c2442a2b0f2603080aa6e6861a8d945e366e921d29fec81ea4517c6fa8ff5d6b1df060a397aca51f2b639753
7
+ data.tar.gz: f4d67a544a432fbbba732ae10ad787a28f63bddf383df7d8505883a2b77fadaa7edb86387b3515ba41a12b378b03e4d841118752547c936edfdf420e58732d80
data/README.rdoc CHANGED
@@ -17,10 +17,9 @@ Installation
17
17
  sysadmin@appserver:~$ cd /path/to/canvas/gems/plugins
18
18
  sysadmin@appserver:/path/to/canvas/gems/plugins$ git clone https://github.com/atomicjolt/etherpad_canvas.git
19
19
 
20
- Add RSA Private Key through Canvas settings and then
21
- create a public_key.pem file that corresponds with
22
- the private key to add to the Etherpad Plugin for
23
- verification.
20
+ Run rake:secret and add the generated secret through
21
+ Canvas settings and save that secret for utilization
22
+ with the Etherpad Plugin for verification.
24
23
 
25
24
  ===================================================
26
25
  Usage
@@ -21,31 +21,32 @@ class EtherpadCollaboration
21
21
 
22
22
  def self.sign_url(user, collaboration)
23
23
  plugin = PluginSetting.find_by(name: "etherpad_canvas")
24
+ etherpad_plugin = PluginSetting.find_by(name: "etherpad")
25
+ domain = etherpad_plugin.split("/")
26
+
24
27
  if !plugin.disabled
25
- key_pem = plugin.settings[:key]
26
- key = OpenSSL::PKey::RSA.new(key_pem)
27
- timestamp = (Time.now.to_f * 1000).to_i
28
- query = {
29
- timestamp: timestamp,
30
- user_id: user.id,
31
- username: user.name,
32
- }.to_query
33
- if collaboration.url.include?("?")
34
- url = collaboration.url.split("?")
35
- url[1] = signing(key, query)
36
- collaboration.url = url.join
37
- else
38
- collaboration.url += signing(key, query)
39
- end
40
-
41
- collaboration.url
28
+ key = plugin.settings[:key]
29
+
30
+ url = generate_url user, collaboration
31
+
32
+ url_sans_http = url.split(domain)[0]
33
+
34
+ digest = OpenSSL::Digest.new("sha1")
35
+
36
+ hmac = OpenSSL::HMAC.hexdigest(digest, key, url_sans_http)
37
+
38
+ "#{url}&signature=#{hmac}"
42
39
  end
43
40
  end
44
41
 
45
- def signing(key, query)
46
- digest = OpenSSL::Digest::SHA256.new
47
- signature = key.sign digest, query
48
- encoded_signature = CGI.escape(Base64.strict_encode64(signature))
49
- "?#{query}&signature=#{encoded_signature}"
42
+ def self.generate_url(user, collaboration)
43
+ timestamp = (Time.now.to_f * 1000).to_i
44
+ query = {
45
+ timestamp: timestamp,
46
+ user_id: user.id,
47
+ username: user.name,
48
+ }.to_query
49
+
50
+ "#{collaboration.url}?#{query}"
50
51
  end
51
52
  end
@@ -14,5 +14,5 @@
14
14
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
15
 
16
16
  module EtherpadCanvas
17
- VERSION = "1.0.3".freeze
17
+ VERSION = "1.1.0".freeze
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etherpad_canvas
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Durr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-09 00:00:00.000000000 Z
11
+ date: 2017-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails