rack-jive-signed_request 0.1.0 → 0.1.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/lib/rack/jive/signed_request.rb +8 -6
- data/lib/rack/jive/signed_request/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c1e5d12872f53f0d220590ff065e87d60c4cfa1
|
4
|
+
data.tar.gz: e7333566f7c0767eb1737aa7e9ec80d514c83685
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69c340d0d22e93874e4125a8c4ceb0f0013e45aba741065b32f78149a319883fb4257e6da3aa6e07640c0047a05dcb1c35d26a9b618174f3c247cb028a52e243
|
7
|
+
data.tar.gz: 0a15ed523095c97aeb615de7e13473c17ba218cfca4361f8e844a3ec9de1869bdc18e54edb8dff1f00573fece631e173deac9016ef4abe80460ba970b5f166d0
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -54,6 +54,10 @@ module ExampleApp
|
|
54
54
|
end
|
55
55
|
```
|
56
56
|
|
57
|
+
# Usage
|
58
|
+
|
59
|
+
`request.env['jive.user_id']` will be populated with the authenticated users Jive ID
|
60
|
+
|
57
61
|
## Development
|
58
62
|
|
59
63
|
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.
|
@@ -22,14 +22,12 @@ module Rack
|
|
22
22
|
def call(env)
|
23
23
|
request = Request.new(env)
|
24
24
|
|
25
|
-
status, headers, body = @app.call(env)
|
26
|
-
|
27
25
|
# Only bother authenticating if the request is identifying itself as signed
|
28
|
-
if
|
29
|
-
auth_header_params = ::CGI.parse
|
26
|
+
if env["X-Shindig-AuthType"] === "signed" || env["Authorization"].to_s.match(/^JiveEXTN/)
|
27
|
+
auth_header_params = ::CGI.parse env["Authorization"].gsub(/^JiveEXTN\s/,'')
|
30
28
|
|
31
29
|
begin
|
32
|
-
unless ::Jive::SignedRequest.authenticate(
|
30
|
+
unless ::Jive::SignedRequest.authenticate(env["Authorization"], @secret.call(auth_header_params))
|
33
31
|
return [401, {"Content-Type" => "text/html"}, ["Invalid"]]
|
34
32
|
end
|
35
33
|
rescue ArgumentError => $e
|
@@ -37,7 +35,11 @@ module Rack
|
|
37
35
|
end
|
38
36
|
end
|
39
37
|
|
40
|
-
[
|
38
|
+
env["jive.user_id"] = env["X-Jive-User-ID"]
|
39
|
+
env["jive.email"] = env["X-Jive-User-Email"]
|
40
|
+
env["jive.external"] = (env["X-Jive-User-External"] === "true")
|
41
|
+
|
42
|
+
@app.call(env)
|
41
43
|
end
|
42
44
|
|
43
45
|
def secret(&block)
|