rack-openid 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +1 -1
  2. data/lib/rack/openid.rb +16 -8
  3. metadata +11 -10
@@ -53,7 +53,7 @@ On competition, the OpenID response is automatically verified and assigned to
53
53
  end
54
54
  end
55
55
 
56
- use_in_file_templates!
56
+ enable :inline_templates
57
57
 
58
58
  __END__
59
59
 
@@ -115,15 +115,16 @@ module Rack #:nodoc:
115
115
  raise RuntimeError, "Rack::OpenID requires a session"
116
116
  end
117
117
 
118
- consumer = ::OpenID::Consumer.new(session, @store)
118
+ consumer = ::OpenID::Consumer.new(session, @store)
119
119
  identifier = params['identifier'] || params['identity']
120
+ immediate = params['immediate'] == 'true'
120
121
 
121
122
  begin
122
123
  oidreq = consumer.begin(identifier)
123
124
  add_simple_registration_fields(oidreq, params)
124
125
  add_attribute_exchange_fields(oidreq, params)
125
126
  add_oauth_fields(oidreq, params)
126
- url = open_id_redirect_url(req, oidreq, params["trust_root"], params["return_to"], params["method"])
127
+ url = open_id_redirect_url(req, oidreq, params["trust_root"], params["return_to"], params["method"], immediate)
127
128
  return redirect_to(url)
128
129
  rescue ::OpenID::OpenIDError, Timeout::Error => e
129
130
  env[RESPONSE] = MissingResponse.new
@@ -204,7 +205,7 @@ module Rack #:nodoc:
204
205
  [303, {"Content-Type" => "text/html", "Location" => url}, []]
205
206
  end
206
207
 
207
- def open_id_redirect_url(req, oidreq, trust_root = nil, return_to = nil, method = nil)
208
+ def open_id_redirect_url(req, oidreq, trust_root, return_to, method, immediate)
208
209
  request_url = request_url(req)
209
210
 
210
211
  if return_to
@@ -216,7 +217,7 @@ module Rack #:nodoc:
216
217
 
217
218
  method = method.to_s.downcase
218
219
  oidreq.return_to_args['_method'] = method unless method == "get"
219
- oidreq.redirect_url(trust_root || realm_url(req), return_to || request_url)
220
+ oidreq.redirect_url(trust_root || realm_url(req), return_to || request_url, immediate)
220
221
  end
221
222
 
222
223
  def add_simple_registration_fields(oidreq, fields)
@@ -238,12 +239,19 @@ module Rack #:nodoc:
238
239
  axreq = ::OpenID::AX::FetchRequest.new
239
240
 
240
241
  required = Array(fields['required']).select(&URL_FIELD_SELECTOR)
241
- required.each { |field| axreq.add(::OpenID::AX::AttrInfo.new(field, nil, true)) }
242
-
243
242
  optional = Array(fields['optional']).select(&URL_FIELD_SELECTOR)
244
- optional.each { |field| axreq.add(::OpenID::AX::AttrInfo.new(field, nil, false)) }
245
243
 
246
- oidreq.add_extension(axreq)
244
+ if required.any? || optional.any?
245
+ required.each do |field|
246
+ axreq.add(::OpenID::AX::AttrInfo.new(field, nil, true))
247
+ end
248
+
249
+ optional.each do |field|
250
+ axreq.add(::OpenID::AX::AttrInfo.new(field, nil, false))
251
+ end
252
+
253
+ oidreq.add_extension(axreq)
254
+ end
247
255
  end
248
256
 
249
257
  def add_oauth_fields(oidreq, fields)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-openid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 1.2.0
10
+ version: 1.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Peek
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-08 00:00:00 -05:00
18
+ date: 2011-02-25 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -50,18 +50,19 @@ dependencies:
50
50
  version: 2.1.8
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
- description: Provides a more HTTPish API around the ruby-openid library
53
+ description: " Provides a more HTTPish API around the ruby-openid library\n"
54
54
  email: josh@joshpeek.com
55
55
  executables: []
56
56
 
57
57
  extensions: []
58
58
 
59
- extra_rdoc_files:
60
- - LICENSE
61
- - README.rdoc
59
+ extra_rdoc_files: []
60
+
62
61
  files:
63
62
  - lib/rack/openid.rb
64
63
  - lib/rack/openid/simple_auth.rb
64
+ - LICENSE
65
+ - README.rdoc
65
66
  has_rdoc: true
66
67
  homepage: http://github.com/josh/rack-openid
67
68
  licenses: []
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  requirements: []
93
94
 
94
95
  rubyforge_project:
95
- rubygems_version: 1.3.7
96
+ rubygems_version: 1.5.2
96
97
  signing_key:
97
98
  specification_version: 3
98
99
  summary: Provides a more HTTPish API around the ruby-openid library