oa-openid 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,32 @@
1
+ require 'openid/consumer'
2
+ require 'gapps_openid'
3
+
4
+ module OpenID
5
+ # Because gapps_openid changes the discovery order
6
+ # (looking first for Google Apps, then anything else),
7
+ # we need to monkeypatch it to make it play nicely
8
+ # with others.
9
+ def self.discover(uri)
10
+ discovered = self.default_discover(uri)
11
+
12
+ if discovered.last.empty?
13
+ info = discover_google_apps(uri)
14
+ return info if info
15
+ end
16
+
17
+ return discovered
18
+ rescue OpenID::DiscoveryFailure => e
19
+ info = discover_google_apps(uri)
20
+
21
+ if info.nil?
22
+ raise e
23
+ else
24
+ return info
25
+ end
26
+ end
27
+
28
+ def self.discover_google_apps(uri)
29
+ discovery = GoogleDiscovery.new
30
+ discovery.perform_discovery(uri)
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  require 'rack/openid'
2
- require 'gapps_openid'
2
+ require 'omniauth/openid/gapps'
3
3
  require 'omniauth/openid'
4
4
 
5
5
  module OmniAuth
@@ -24,7 +24,7 @@ module OmniAuth
24
24
  }
25
25
 
26
26
  def initialize(app, store = nil, options = {})
27
- super(app, options[:name] || :open_id)
27
+ super(app, options.delete(:name) || :open_id)
28
28
  @options = options
29
29
  @options[:required] ||= [AX[:email], AX[:first_name], AX[:last_name], 'email', 'fullname']
30
30
  @options[:optional] ||= [AX[:nickname], AX[:city], AX[:state], AX[:website], AX[:image], 'postcode', 'nickname']
@@ -47,7 +47,7 @@ module OmniAuth
47
47
  end
48
48
 
49
49
  def identifier
50
- request[IDENTIFIER_URL_PARAMETER]
50
+ options[:identifier] || request[IDENTIFIER_URL_PARAMETER]
51
51
  end
52
52
 
53
53
  def request_phase
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: 29
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
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-11 00:00:00 -05:00
18
+ date: 2010-10-12 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: 29
27
+ hash: 19
28
28
  segments:
29
29
  - 0
30
30
  - 1
31
- - 3
32
- version: 0.1.3
31
+ - 4
32
+ version: 0.1.4
33
33
  requirement: *id001
34
34
  name: oa-core
35
35
  prerelease: false
@@ -167,6 +167,7 @@ extensions: []
167
167
  extra_rdoc_files: []
168
168
 
169
169
  files:
170
+ - lib/omniauth/openid/gapps.rb
170
171
  - lib/omniauth/openid.rb
171
172
  - lib/omniauth/strategies/google_apps.rb
172
173
  - lib/omniauth/strategies/open_id.rb