oa-openid 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/omniauth/openid.rb +51 -0
- data/lib/omniauth/strategies/open_id.rb +13 -1
- metadata +7 -8
- data/README.rdoc +0 -37
data/lib/omniauth/openid.rb
CHANGED
@@ -1,6 +1,57 @@
|
|
1
1
|
require 'omniauth/core'
|
2
2
|
|
3
3
|
module OmniAuth
|
4
|
+
# OmniAuth::OpenID provides strategies for authenticating to providers
|
5
|
+
# using the OpenID standard.
|
6
|
+
#
|
7
|
+
# # Installation
|
8
|
+
#
|
9
|
+
# To get just OpenID functionality:
|
10
|
+
#
|
11
|
+
# gem install oa-openid
|
12
|
+
#
|
13
|
+
# For the full auth suite:
|
14
|
+
#
|
15
|
+
# gem install omniauth
|
16
|
+
#
|
17
|
+
# # Stand-Alone Example
|
18
|
+
#
|
19
|
+
# Use the strategy as a middleware in your application:
|
20
|
+
#
|
21
|
+
# require 'omniauth/openid'
|
22
|
+
# require 'openid/store/filesystem'
|
23
|
+
#
|
24
|
+
# use Rack::Session::Cookie
|
25
|
+
# use OmniAuth::Strategies::OpenID, OpenID::Store::Filesystem.new('/tmp')
|
26
|
+
#
|
27
|
+
# Then simply direct users to '/auth/open_id' to prompt them for their OpenID identifier. You may also pre-set the identifier by passing an <tt>identifier</tt> parameter to the URL (Example: <tt>/auth/open_id?openid_url=yahoo.com</tt>).
|
28
|
+
#
|
29
|
+
# A list of all OpenID stores is available at http://github.com/openid/ruby-openid/tree/master/lib/openid/store/
|
30
|
+
#
|
31
|
+
# # OmniAuth Builder
|
32
|
+
#
|
33
|
+
# If OpenID is one of several authentication strategies, use the OmniAuth Builder:
|
34
|
+
#
|
35
|
+
# require 'omniauth/openid'
|
36
|
+
# require 'omniauth/basic' # for Campfire
|
37
|
+
# require 'openid/store/filesystem'
|
38
|
+
#
|
39
|
+
# use OmniAuth::Builder do
|
40
|
+
# provider :open_id, OpenID::Store::Filesystem.new('/tmp')
|
41
|
+
# provider :campfire
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# # Configured Identifiers
|
45
|
+
#
|
46
|
+
# You may pre-configure an OpenID identifier. For example, to use Google's main OpenID endpoint:
|
47
|
+
#
|
48
|
+
# use OmniAuth::Builder do
|
49
|
+
# provider :open_id, nil, :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# Note the use of nil, which will trigger ruby-openid's default Memory Store.
|
53
|
+
module OpenID; end
|
54
|
+
|
4
55
|
module Strategies
|
5
56
|
autoload :OpenID, 'omniauth/strategies/open_id'
|
6
57
|
autoload :GoogleApps, 'omniauth/strategies/google_apps'
|
@@ -4,6 +4,8 @@ require 'omniauth/openid'
|
|
4
4
|
|
5
5
|
module OmniAuth
|
6
6
|
module Strategies
|
7
|
+
# OmniAuth strategy for connecting via OpenID. This allows for connection
|
8
|
+
# to a wide variety of sites, some of which are listed [on the OpenID website](http://openid.net/get-an-openid/).
|
7
9
|
class OpenID
|
8
10
|
include OmniAuth::Strategy
|
9
11
|
|
@@ -23,14 +25,24 @@ module OmniAuth
|
|
23
25
|
:image => 'http://axschema.org/media/image/aspect11'
|
24
26
|
}
|
25
27
|
|
28
|
+
# @param app [Rack Application] Standard Rack middleware application argument.
|
29
|
+
# @param store [OpenID Store] The [OpenID Store](http://github.com/openid/ruby-openid/tree/master/lib/openid/store/)
|
30
|
+
# you wish to use. Defaults to OpenID::MemoryStore.
|
31
|
+
# @option options [Array] :required The identity fields that are required for the OpenID
|
32
|
+
# request. May be an ActiveExchange schema URL or an sreg identifier.
|
33
|
+
# @option options [Array] :optional The optional attributes for the OpenID request. May
|
34
|
+
# be ActiveExchange or sreg.
|
35
|
+
# @option options [Symbol, :open_id] :name The URL segment name for this provider.
|
26
36
|
def initialize(app, store = nil, options = {})
|
27
|
-
super(app, options
|
37
|
+
super(app, options[:name] || :open_id)
|
28
38
|
@options = options
|
29
39
|
@options[:required] ||= [AX[:email], AX[:first_name], AX[:last_name], 'email', 'fullname']
|
30
40
|
@options[:optional] ||= [AX[:nickname], AX[:city], AX[:state], AX[:website], AX[:image], 'postcode', 'nickname']
|
31
41
|
@store = store
|
32
42
|
end
|
33
43
|
|
44
|
+
protected
|
45
|
+
|
34
46
|
def dummy_app
|
35
47
|
lambda{|env| [401, {"WWW-Authenticate" => Rack::OpenID.build_header(
|
36
48
|
:identifier => identifier,
|
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:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
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-
|
18
|
+
date: 2010-10-19 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:
|
27
|
+
hash: 17
|
28
28
|
segments:
|
29
29
|
- 0
|
30
30
|
- 1
|
31
|
-
-
|
32
|
-
version: 0.1.
|
31
|
+
- 5
|
32
|
+
version: 0.1.5
|
33
33
|
requirement: *id001
|
34
34
|
name: oa-core
|
35
35
|
prerelease: false
|
@@ -171,7 +171,6 @@ files:
|
|
171
171
|
- lib/omniauth/openid.rb
|
172
172
|
- lib/omniauth/strategies/google_apps.rb
|
173
173
|
- lib/omniauth/strategies/open_id.rb
|
174
|
-
- README.rdoc
|
175
174
|
- LICENSE.rdoc
|
176
175
|
- CHANGELOG.rdoc
|
177
176
|
has_rdoc: true
|
data/README.rdoc
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
= OmniAuth::OpenID
|
2
|
-
|
3
|
-
OpenID strategies for the OmniAuth gem.
|
4
|
-
|
5
|
-
== Installation
|
6
|
-
|
7
|
-
To get just OpenID functionality:
|
8
|
-
|
9
|
-
gem install oa-openid
|
10
|
-
|
11
|
-
For the full auth suite:
|
12
|
-
|
13
|
-
gem install omniauth
|
14
|
-
|
15
|
-
== Stand-Alone Example
|
16
|
-
|
17
|
-
Use the strategy as a middleware in your application:
|
18
|
-
|
19
|
-
require 'omniauth/openid'
|
20
|
-
require 'openid/store/filesystem'
|
21
|
-
|
22
|
-
use OmniAuth::Strategies::OpenID, OpenID::Store::Filesystem.new('/tmp')
|
23
|
-
|
24
|
-
Then simply direct users to '/auth/open_id' to prompt them for their OpenID identifier. You may also pre-set the identifier by passing an <tt>identifier</tt> parameter to the URL (Example: <tt>/auth/open_id?openid_url=google.com</tt>).
|
25
|
-
|
26
|
-
== OmniAuth Builder
|
27
|
-
|
28
|
-
If OpenID is one of several authentication strategies, use the OmniAuth Builder:
|
29
|
-
|
30
|
-
require 'omniauth/openid'
|
31
|
-
require 'omniauth/basic' # for Campfire
|
32
|
-
require 'openid/store/filesystem'
|
33
|
-
|
34
|
-
use OmniAuth::Builder do
|
35
|
-
provider :open_id, OpenID::Store::Filesystem.new('/tmp')
|
36
|
-
provider :campfire
|
37
|
-
end
|