rack-openid 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rack/openid.rb +4 -3
  2. metadata +2 -2
data/lib/rack/openid.rb CHANGED
@@ -20,8 +20,8 @@ module Rack
20
20
 
21
21
  def self.parse_header(str)
22
22
  params = {}
23
- if str =~ /^OpenID/
24
- str = str.gsub(/^OpenID /, '')
23
+ if str =~ AUTHENTICATE_REGEXP
24
+ str = str.gsub(/#{AUTHENTICATE_REGEXP}\s+/, '')
25
25
  str.split(', ').each { |pair|
26
26
  key, *value = pair.split('=')
27
27
  value = value.join('=')
@@ -47,6 +47,7 @@ module Rack
47
47
 
48
48
  RESPONSE = "rack.openid.response".freeze
49
49
  AUTHENTICATE_HEADER = "WWW-Authenticate".freeze
50
+ AUTHENTICATE_REGEXP = /^OpenID/.freeze
50
51
 
51
52
 
52
53
  def initialize(app, store = nil)
@@ -64,7 +65,7 @@ module Rack
64
65
  status, headers, body = @app.call(env)
65
66
 
66
67
  qs = headers[AUTHENTICATE_HEADER]
67
- if status.to_i == 401 && qs
68
+ if status.to_i == 401 && qs && qs.match(AUTHENTICATE_REGEXP)
68
69
  begin_authentication(env, qs)
69
70
  else
70
71
  [status, headers, body]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-openid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Peek
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-21 00:00:00 -06:00
12
+ date: 2010-02-06 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency