subbarao-sinatra-openid 0.3.3 → 0.3.4

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.
Files changed (2) hide show
  1. data/lib/sinatra/openid.rb +13 -1
  2. metadata +1 -1
@@ -19,10 +19,17 @@ module Sinatra
19
19
  def authorize!
20
20
  redirect '/login' unless authorized?
21
21
  end
22
+
22
23
  def logout!
23
24
  session[:authorized] = false
24
25
  end
25
26
 
27
+ def verify_user( logged_in_user )
28
+ options.admin_urls.find do | user |
29
+ user == logged_in_user
30
+ end
31
+ end
32
+
26
33
  end
27
34
 
28
35
  def self.registered(app)
@@ -46,7 +53,12 @@ module Sinatra
46
53
  post '/login' do
47
54
  if resp = request.env["rack.openid.response"]
48
55
  if resp.status == :success
49
- session[:authorized] = true
56
+ if verify_user(resp.identity_url)
57
+ session[:authorized] = true
58
+ redirect '/'
59
+ else
60
+ "unable to verify user: #{resp.identity_url}"
61
+ end
50
62
  else
51
63
  "Error: #{resp.status}"
52
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subbarao-sinatra-openid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - SubbaRao Pasupuleti