oa-openid 0.1.5 → 0.1.6

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/omniauth/strategies/open_id.rb +12 -7
  2. metadata +11 -11
@@ -25,6 +25,8 @@ module OmniAuth
25
25
  :image => 'http://axschema.org/media/image/aspect11'
26
26
  }
27
27
 
28
+ # Initialize the strategy as a Rack Middleware.
29
+ #
28
30
  # @param app [Rack Application] Standard Rack middleware application argument.
29
31
  # @param store [OpenID Store] The [OpenID Store](http://github.com/openid/ruby-openid/tree/master/lib/openid/store/)
30
32
  # you wish to use. Defaults to OpenID::MemoryStore.
@@ -36,7 +38,7 @@ module OmniAuth
36
38
  def initialize(app, store = nil, options = {})
37
39
  super(app, options[:name] || :open_id)
38
40
  @options = options
39
- @options[:required] ||= [AX[:email], AX[:first_name], AX[:last_name], 'email', 'fullname']
41
+ @options[:required] ||= [AX[:email], AX[:name], AX[:first_name], AX[:last_name], 'email', 'fullname']
40
42
  @options[:optional] ||= [AX[:nickname], AX[:city], AX[:state], AX[:website], AX[:image], 'postcode', 'nickname']
41
43
  @store = store
42
44
  end
@@ -48,7 +50,8 @@ module OmniAuth
48
50
  :identifier => identifier,
49
51
  :return_to => callback_url,
50
52
  :required => @options[:required],
51
- :optional => @options[:optional]
53
+ :optional => @options[:optional],
54
+ :method => 'post'
52
55
  )}, []]}
53
56
  end
54
57
 
@@ -122,11 +125,13 @@ module OmniAuth
122
125
  ax = ::OpenID::AX::FetchResponse.from_success_response(response)
123
126
  return {} unless ax
124
127
  {
125
- 'email' => ax[AX[:email]],
126
- 'name' => ax[AX[:name]],
127
- 'location' => ("#{ax[AX[:city]]}, #{ax[AX[:state]]}" if Array(ax[AX[:city]]).any? && Array(ax[AX[:state]]).any?),
128
- 'nickname' => ax[AX[:nickname]],
129
- 'urls' => ({'Website' => Array(ax[AX[:website]]).first} if Array(ax[AX[:website]]).any?)
128
+ 'email' => ax.get_single(AX[:email]),
129
+ 'first_name' => ax.get_single(AX[:first_name]),
130
+ 'last_name' => ax.get_single(AX[:last_name]),
131
+ 'name' => (ax.get_single(AX[:name]) || [ax.get_single(AX[:first_name]), ax.get_single(AX[:last_name])].join(' ')),
132
+ 'location' => ("#{ax.get_single(AX[:city])}, #{ax.get_single(AX[:state])}" if Array(ax.get_single(AX[:city])).any? && Array(ax.get_single(AX[:state])).any?),
133
+ 'nickname' => ax.get_single(AX[:nickname]),
134
+ 'urls' => ({'Website' => Array(ax.get_single(AX[:website])).first} if Array(ax.get_single(AX[:website])).any?)
130
135
  }.inject({}){|h,(k,v)| h[k] = Array(v).first; h}.reject{|k,v| v.nil? || v == ''}
131
136
  end
132
137
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oa-openid
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Bleigh
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-19 00:00:00 -05:00
18
+ date: 2010-10-25 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,12 +24,12 @@ dependencies:
24
24
  requirements:
25
25
  - - "="
26
26
  - !ruby/object:Gem::Version
27
- hash: 17
27
+ hash: 23
28
28
  segments:
29
29
  - 0
30
30
  - 1
31
- - 5
32
- version: 0.1.5
31
+ - 6
32
+ version: 0.1.6
33
33
  requirement: *id001
34
34
  name: oa-core
35
35
  prerelease: false
@@ -40,12 +40,12 @@ dependencies:
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- hash: 17
43
+ hash: 31
44
44
  segments:
45
45
  - 1
46
- - 1
47
- - 1
48
- version: 1.1.1
46
+ - 2
47
+ - 0
48
+ version: 1.2.0
49
49
  requirement: *id002
50
50
  name: rack-openid
51
51
  prerelease: false