warden-github 0.0.9 → 0.1.0
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.
- data/.gitignore +2 -0
- data/lib/warden-github/strategy.rb +12 -1
- data/lib/warden-github/version.rb +1 -1
- data/spec/app.rb +5 -0
- data/warden-github.gemspec +1 -1
- metadata +4 -4
data/.gitignore
CHANGED
@@ -15,6 +15,7 @@ Warden::Strategies.add(:github) do
|
|
15
15
|
%(<p>Outdated ?code=#{params['code']}:</p><p>#{$!}</p><p><a href="/auth/github">Retry</a></p>)
|
16
16
|
end
|
17
17
|
else
|
18
|
+
env['rack.session']['return_to'] = env['REQUEST_URI']
|
18
19
|
throw(:halt, [ 302, {'Location' => authorize_url}, [ ]])
|
19
20
|
end
|
20
21
|
end
|
@@ -41,7 +42,7 @@ Warden::Strategies.add(:github) do
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def callback_url
|
44
|
-
|
45
|
+
absolute_url(request, env['warden'].config[:github_callback_url])
|
45
46
|
end
|
46
47
|
|
47
48
|
def absolute_url(request, suffix = nil)
|
@@ -54,3 +55,13 @@ Warden::Strategies.add(:github) do
|
|
54
55
|
"#{request.scheme}://#{request.host}#{port_part}#{suffix}"
|
55
56
|
end
|
56
57
|
end
|
58
|
+
|
59
|
+
Warden::Manager.after_authentication do |user, proxy, opts|
|
60
|
+
redirect_to = proxy.env['rack.session']['return_to']
|
61
|
+
proxy.env['rack.session'].delete('return_to')
|
62
|
+
if redirect_to
|
63
|
+
response = Rack::Response.new
|
64
|
+
response.redirect redirect_to
|
65
|
+
throw :warden, response.finish
|
66
|
+
end
|
67
|
+
end
|
data/spec/app.rb
CHANGED
data/warden-github.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warden-github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.9
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Corey Donohoe
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-22 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|