ruby-openid 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ruby-openid might be problematic. Click here for more details.
- data/examples/consumer.rb +7 -3
- data/examples/openid-store/associations/http-www.myopenid.com_2Fserver-ZFp96P4qV1FjqgGt2rtZBvRJWic +6 -0
- data/examples/rails_active_record_store/README +2 -2
- data/examples/rails_active_record_store/models/openid_association.rb +6 -1
- data/examples/rails_active_record_store/openid_helper.rb +7 -1
- data/examples/rails_openid_login_generator/templates/controller.rb +7 -10
- data/examples/rails_server/app/controllers/server_controller.rb +7 -2
- data/examples/rails_server/log/development.log +25 -0
- data/lib/openid.rb +5 -0
- data/lib/openid/discovery.rb +1 -1
- metadata +5 -3
data/examples/consumer.rb
CHANGED
@@ -6,9 +6,13 @@ require "pathname"
|
|
6
6
|
require "webrick"
|
7
7
|
include WEBrick
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
require "
|
9
|
+
# load the openid library, first trying rubygems
|
10
|
+
begin
|
11
|
+
require "rubygems"
|
12
|
+
require_gem "ruby-openid", ">= 1.0"
|
13
|
+
rescue LoadError
|
14
|
+
require "openid"
|
15
|
+
end
|
12
16
|
|
13
17
|
################ start config ##########################
|
14
18
|
# use your desired store implementation here
|
@@ -4,7 +4,7 @@ A store is required by an OpenID server and optionally by the consumer to
|
|
4
4
|
store associations, nonces, and auth key information across requests and
|
5
5
|
threads. This directory contains code useful in implementing an
|
6
6
|
ActiveRecord based store as an alternative to using the standard
|
7
|
-
OpenID::
|
7
|
+
OpenID::FilesystemStore in Ruby on Rails applications.
|
8
8
|
|
9
9
|
==Setting up your database
|
10
10
|
|
@@ -36,7 +36,7 @@ openid_setting.rb into the app/models dir of your rails app.
|
|
36
36
|
You'll probably have controller for handling openid operations in your
|
37
37
|
application (see the other examples). The control flow of the store
|
38
38
|
is handled in a helper. Look at OpenidHelper in openid_helper.rb,
|
39
|
-
which implements the OpenID::
|
39
|
+
which implements the OpenID::Store interface.
|
40
40
|
|
41
41
|
Copy the openid_helper.rb into your app/helpers and then include the
|
42
42
|
OpenidHelper module in your openid controller. When instantiating
|
@@ -1,8 +1,13 @@
|
|
1
1
|
require "pathname"
|
2
2
|
require "cgi"
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
# load the openid library
|
5
|
+
begin
|
6
|
+
require "rubygems"
|
7
|
+
require_gem "ruby-openid", ">= 1.0"
|
8
|
+
rescue LoadError
|
9
|
+
require "openid"
|
10
|
+
end
|
6
11
|
|
7
12
|
class <%= class_name %>Controller < ApplicationController
|
8
13
|
layout 'scaffold'
|
@@ -15,19 +20,13 @@ class <%= class_name %>Controller < ApplicationController
|
|
15
20
|
if @request.post?
|
16
21
|
request = consumer.begin(openid_url)
|
17
22
|
|
18
|
-
p 'XXX', request
|
19
|
-
|
20
23
|
case request.status
|
21
24
|
when OpenID::SUCCESS
|
22
25
|
return_to = url_for(:action=> 'complete')
|
23
26
|
trust_root = url_for(:controller=>'')
|
24
27
|
|
25
28
|
url = request.redirect_url(trust_root, return_to)
|
26
|
-
p 'REDIRECTURL', url
|
27
|
-
|
28
29
|
redirect_to(url)
|
29
|
-
|
30
|
-
p 'REDIRECT SENT', @session
|
31
30
|
return
|
32
31
|
|
33
32
|
when OpenID::FAILURE
|
@@ -40,8 +39,6 @@ class <%= class_name %>Controller < ApplicationController
|
|
40
39
|
end
|
41
40
|
end
|
42
41
|
|
43
|
-
p 'Done'
|
44
|
-
|
45
42
|
end
|
46
43
|
|
47
44
|
# handle the openid server response
|
@@ -1,7 +1,12 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# load the openid library, first trying rubygems
|
4
|
+
begin
|
5
|
+
require "rubygems"
|
6
|
+
require_gem "ruby-openid", ">= 1.0"
|
7
|
+
rescue LoadError
|
8
|
+
require "openid"
|
9
|
+
end
|
5
10
|
|
6
11
|
class ServerController < ApplicationController
|
7
12
|
|
@@ -6057,3 +6057,28 @@ Processing ServerController#index (for 127.0.0.1 at 2006-05-09 14:00:54) [GET]
|
|
6057
6057
|
Parameters: {"openid.return_to"=>"http://localhost:2000/complete?&nonce=vh0B1ozF", "openid.mode"=>"checkid_setup", "action"=>"index", "controller"=>"server", "openid.identity"=>"http://localhost:3000/user/x", "openid.trust_root"=>"http://localhost:2000/", "openid.assoc_handle"=>"{HMAC-SHA1}{44610305}{DjH4ig==}"}
|
6058
6058
|
Redirected to http://localhost:2000/complete?&nonce=vh0B1ozF&openid.sig=QbSO14Ca39098XwN38yXb%2BNgiDc%3D&openid.mode=id_res&openid.return_to=http%3A%2F%2Flocalhost%3A2000%2Fcomplete%3F%26nonce%3Dvh0B1ozF&openid.identity=http%3A%2F%2Flocalhost%3A3000%2Fuser%2Fx&openid.signed=identity%2Creturn_to%2Cmode&openid.assoc_handle=%7BHMAC-SHA1%7D%7B44610305%7D%7BDjH4ig%3D%3D%7D
|
6059
6059
|
Completed in 0.00412 (242 reqs/sec) | 302 Found [http://localhost/server?openid.mode=checkid_setup&openid.return_to=http%3A%2F%2Flocalhost%3A2000%2Fcomplete%3F%26nonce%3Dvh0B1ozF&openid.trust_root=http%3A%2F%2Flocalhost%3A2000%2F&openid.identity=http%3A%2F%2Flocalhost%3A3000%2Fuser%2Fx&openid.assoc_handle=%7BHMAC-SHA1%7D%7B44610305%7D%7BDjH4ig%3D%3D%7D]
|
6060
|
+
|
6061
|
+
|
6062
|
+
Processing LoginController#index (for 127.0.0.1 at 2006-05-11 11:01:05) [GET]
|
6063
|
+
Parameters: {"action"=>"index", "controller"=>"login"}
|
6064
|
+
Rendering within layouts/server
|
6065
|
+
Rendering login/index
|
6066
|
+
Completed in 0.00734 (136 reqs/sec) | Rendering: 0.00612 (83%) | 200 OK [http://localhost/]
|
6067
|
+
|
6068
|
+
|
6069
|
+
Processing LoginController#submit (for 127.0.0.1 at 2006-05-11 11:01:08) [GET]
|
6070
|
+
Parameters: {"username"=>"b", "action"=>"submit", "controller"=>"login"}
|
6071
|
+
Redirected to http://localhost:3000/
|
6072
|
+
Completed in 0.00144 (692 reqs/sec) | 302 Found [http://localhost/login/submit?username=b]
|
6073
|
+
|
6074
|
+
|
6075
|
+
Processing LoginController#index (for 127.0.0.1 at 2006-05-11 11:01:09) [GET]
|
6076
|
+
Parameters: {"action"=>"index", "controller"=>"login"}
|
6077
|
+
Rendering within layouts/server
|
6078
|
+
Rendering login/index
|
6079
|
+
Completed in 0.00211 (474 reqs/sec) | Rendering: 0.00098 (46%) | 200 OK [http://localhost/]
|
6080
|
+
|
6081
|
+
|
6082
|
+
Processing ServerController#index (for 127.0.0.1 at 2006-05-11 11:01:18) [GET]
|
6083
|
+
Parameters: {"action"=>"index", "controller"=>"server"}
|
6084
|
+
Completed in 0.00290 (344 reqs/sec) | 200 OK [http://localhost/server]
|
data/lib/openid.rb
ADDED
data/lib/openid/discovery.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-openid
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
7
|
-
date: 2006-05-
|
6
|
+
version: 1.0.1
|
7
|
+
date: 2006-05-11 00:00:00 -07:00
|
8
8
|
summary: A library for consuming and serving OpenID identities.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -12,7 +12,7 @@ email: brian@janrian.com
|
|
12
12
|
homepage: http://www.openidenabled.com/openid/libraries/ruby
|
13
13
|
rubyforge_project:
|
14
14
|
description:
|
15
|
-
autorequire:
|
15
|
+
autorequire: openid
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
18
18
|
has_rdoc: true
|
@@ -156,12 +156,14 @@ files:
|
|
156
156
|
- examples/openid-store/temp
|
157
157
|
- examples/openid-store/auth_key
|
158
158
|
- examples/openid-store/associations/http-localhost_3A3000_2Fserver-EMQbAy3NnHVzA.s0u5KAcplKGzo
|
159
|
+
- examples/openid-store/associations/http-www.myopenid.com_2Fserver-ZFp96P4qV1FjqgGt2rtZBvRJWic
|
159
160
|
- lib/openid
|
160
161
|
- lib/hmac-sha2.rb
|
161
162
|
- lib/hmac.rb
|
162
163
|
- lib/hmac-sha1.rb
|
163
164
|
- lib/hmac-rmd160.rb
|
164
165
|
- lib/hmac-md5.rb
|
166
|
+
- lib/openid.rb
|
165
167
|
- lib/openid/consumer.rb
|
166
168
|
- lib/openid/dh.rb
|
167
169
|
- lib/openid/fetchers.rb
|