rack-jive-signed_request 0.1.2 → 0.1.3

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: 9642a95014b328f8f8e43512ed6186eb85c94729
4
- data.tar.gz: e20d6a056432191cd43571c036db86ef743525e6
3
+ metadata.gz: d6a80ac7ca19c95f6e85dab57d66aa5f1a0ec21b
4
+ data.tar.gz: 5382742cfd32c1f7b02a8b5235303ebc88d65c16
5
5
  SHA512:
6
- metadata.gz: aa924164532d4c5a3d67408faf60bcc69c5cdce3e7b70b881bb8ee16f57660052c410310885690acf41bef9cfd3738bfcd6ac5e30a55ffcfa286bee6360d05a6
7
- data.tar.gz: 69a703aea48749c75173bc9a27c0c7266a8dce62122d018e67b03941f1f69647c8dc8d60ca6a9f2240c607049ad11477506c2026c8217b56079cf9551d423741
6
+ metadata.gz: bd07d4df5a28398191f83926584e2e17eb70be330f08fed50aa384885e262408e04a664c9b0f24603acda85463a3b3e66f4f14a6c0e2f3666080e6af816439e4
7
+ data.tar.gz: ef3f46cc664f615a79f4017c3ef86200d59fcbf3ac2b3c1c060701e576703f9e4117ddca21df5ab88326df71b220c2850d9952de034014369fd357bf71987d6f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rack-jive-signed_request (0.1.2)
4
+ rack-jive-signed_request (0.1.3)
5
5
  jive-signed_request
6
6
  rack (>= 1.1)
7
7
 
data/README.md CHANGED
@@ -58,6 +58,10 @@ end
58
58
 
59
59
  `request.env['jive.user_id']` will be populated with the authenticated users Jive ID
60
60
 
61
+ `request.env['jive.email']` will be populated with the authenticated users Jive Email
62
+
63
+ `request.env['jive.errors.signed_request']` will be populated if there was an error authenticating the signed request
64
+
61
65
  ## Development
62
66
 
63
67
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -27,18 +27,18 @@ module Rack
27
27
  auth_header_params = ::CGI.parse env["HTTP_AUTHORIZATION"].gsub(/^JiveEXTN\s/,'')
28
28
 
29
29
  begin
30
- unless ::Jive::SignedRequest.authenticate(env["HTTP_AUTHORIZATION"], @secret.call(auth_header_params))
31
- return [401, {"Content-Type" => "text/html"}, ["Invalid"]]
30
+ if ::Jive::SignedRequest.authenticate(env["HTTP_AUTHORIZATION"], @secret.call(auth_header_params))
31
+ env["jive.user_id"] = env["HTTP_X_JIVE_USER_ID"]
32
+ env["jive.email"] = env["HTTP_X_JIVE_USER_EMAIL"]
33
+ env["jive.external"] = (env["HTTP_X_JIVE_USER_EXTERNAL"] === "true")
34
+ else
35
+ env["jive.errors.signed_request"] = "Could not authenticate"
32
36
  end
33
37
  rescue ArgumentError => $e
34
- return [401, {"Content-Type" => "text/html"}, [$e.message]]
38
+ env["jive.errors.signed_request"] = $e.message
35
39
  end
36
40
  end
37
41
 
38
- env["jive.user_id"] = env["HTTP_X_JIVE_USER_ID"]
39
- env["jive.email"] = env["HTTP_X_JIVE_USER_EMAIL"]
40
- env["jive.external"] = (env["HTTP_X_JIVE_USER_EXTERNAL"] === "true")
41
-
42
42
  @app.call(env)
43
43
  end
44
44
 
@@ -1,7 +1,7 @@
1
1
  module Rack
2
2
  module Jive
3
3
  class SignedRequest
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-jive-signed_request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Butch Marshall
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-06 00:00:00.000000000 Z
11
+ date: 2015-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler