sinatra-google-auth 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,12 @@ module Sinatra
6
6
  module Helpers
7
7
  def authenticate
8
8
  unless session["user"]
9
- redirect to "/auth/google"
9
+ session['google-auth-redirect'] = request.path
10
+ if settings.absolute_redirect?
11
+ redirect "/auth/google"
12
+ else
13
+ redirect to "/auth/google"
14
+ end
10
15
  end
11
16
  end
12
17
 
@@ -17,7 +22,8 @@ module Sinatra
17
22
  session["user"] = Array(user_info.email).first.downcase
18
23
  end
19
24
 
20
- redirect to "/"
25
+ url = session['google-auth-redirect'] || to("/")
26
+ redirect url
21
27
  end
22
28
  end
23
29
 
@@ -30,6 +36,7 @@ module Sinatra
30
36
  app.helpers GoogleAuth::Helpers
31
37
  app.use ::Rack::Session::Cookie, :secret => secret
32
38
  app.use ::OmniAuth::Strategies::OpenID, :name => "google", :identifier => ENV['GOOGLE_AUTH_URL']
39
+ app.set :absolute_redirect, false
33
40
 
34
41
  app.get "/auth/:provider/callback" do
35
42
  handle_authentication_callback
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module GoogleAuth
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.6'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-google-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-24 00:00:00.000000000Z
12
+ date: 2012-06-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-openid
16
- requirement: &70220182353020 !ruby/object:Gem::Requirement
16
+ requirement: &70096299813860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70220182353020
24
+ version_requirements: *70096299813860
25
25
  description: Drop-in google auth for sinatra apps
26
26
  email:
27
27
  - christopher.continanza@gmail.com