ruby-mojeid 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/examples/README +7 -23
- data/examples/rails_openid/Gemfile +1 -1
- data/examples/rails_openid/Gemfile.lock +1 -1
- data/examples/rails_openid/README +5 -152
- data/examples/rails_openid/app/controllers/consumer_controller.rb +14 -4
- data/examples/rails_openid/app/views/consumer/index.rhtml +2 -2
- data/lib/available_attributes.rb +1 -1
- data/lib/ruby-mojeid.rb +62 -8
- data/ruby-mojeid.gemspec +2 -3
- metadata +4 -5
- data/examples/rails_openid/app/views/layouts/server.rhtml +0 -68
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/examples/README
CHANGED
@@ -1,32 +1,16 @@
|
|
1
|
-
This directory contains
|
2
|
-
|
3
|
-
before running the
|
4
|
-
start in integrating
|
1
|
+
This directory contains example that demonstrate use of the
|
2
|
+
ruby-mojeID library. Make sure you have properly installed the library
|
3
|
+
before running the example. These example are a great place to
|
4
|
+
start in integrating ruby-mojeID into your application.
|
5
5
|
|
6
6
|
==Rails example
|
7
7
|
|
8
|
-
|
9
|
-
party, and acts as a starting point for implementing your own
|
10
|
-
production rails server. You'll need the latest version of Ruby on
|
11
|
-
Rails installed, and then:
|
8
|
+
You'll need the Ruby on Rails 2.3.9 installed, and then:
|
12
9
|
|
13
10
|
cd rails_openid
|
14
11
|
./script/server
|
15
12
|
|
16
|
-
Open a web browser to http://localhost:3000/ and
|
13
|
+
Open a web browser to http://localhost:3000/ and try to get data or store data.
|
17
14
|
|
18
|
-
The relevant code to work from when writing your Rails OpenID Relying
|
19
|
-
Party is:
|
20
|
-
rails_openid/app/controllers/consumer_controller.rb
|
21
|
-
If you are working on an OpenID provider, check out
|
22
|
-
rails_openid/app/controllers/server_controller.rb
|
23
15
|
|
24
|
-
|
25
|
-
copy-and-paste.
|
26
|
-
|
27
|
-
==Rails ActiveRecord OpenIDStore plugin
|
28
|
-
|
29
|
-
For various reasons you may want or need to deploy your ruby openid
|
30
|
-
consumer/server using an SQL based store. The active_record_openid_store
|
31
|
-
is a plugin that makes using an SQL based store simple. Follow the
|
32
|
-
README inside the plugin's dir for usage.
|
16
|
+
For more examples how to use ruby-OpenID, please look at https://github.com/openid/ruby-openid
|
@@ -1,153 +1,6 @@
|
|
1
|
-
|
1
|
+
This app contains 2 examples how to manipulate with ruby-mojeID library.
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
for inserting pre-built data in between HTML tags. The model contains the
|
8
|
-
"smart" domain objects (such as Account, Product, Person, Post) that holds all
|
9
|
-
the business logic and knows how to persist themselves to a database. The
|
10
|
-
controller handles the incoming requests (such as Save New Account, Update
|
11
|
-
Product, Show Post) by manipulating the model and directing data to the view.
|
12
|
-
|
13
|
-
In Rails, the model is handled by what's called an object-relational mapping
|
14
|
-
layer entitled Active Record. This layer allows you to present the data from
|
15
|
-
database rows as objects and embellish these data objects with business logic
|
16
|
-
methods. You can read more about Active Record in
|
17
|
-
link:files/vendor/rails/activerecord/README.html.
|
18
|
-
|
19
|
-
The controller and view are handled by the Action Pack, which handles both
|
20
|
-
layers by its two parts: Action View and Action Controller. These two layers
|
21
|
-
are bundled in a single package due to their heavy interdependence. This is
|
22
|
-
unlike the relationship between the Active Record and Action Pack that is much
|
23
|
-
more separate. Each of these packages can be used independently outside of
|
24
|
-
Rails. You can read more about Action Pack in
|
25
|
-
link:files/vendor/rails/actionpack/README.html.
|
26
|
-
|
27
|
-
|
28
|
-
== Getting started
|
29
|
-
|
30
|
-
1. Run the WEBrick servlet: <tt>ruby script/server</tt> (run with --help for options)
|
31
|
-
...or if you have lighttpd installed: <tt>ruby script/lighttpd</tt> (it's faster)
|
32
|
-
2. Go to http://localhost:3000/ and get "Congratulations, you've put Ruby on Rails!"
|
33
|
-
3. Follow the guidelines on the "Congratulations, you've put Ruby on Rails!" screen
|
34
|
-
|
35
|
-
|
36
|
-
== Example for Apache conf
|
37
|
-
|
38
|
-
<VirtualHost *:80>
|
39
|
-
ServerName rails
|
40
|
-
DocumentRoot /path/application/public/
|
41
|
-
ErrorLog /path/application/log/server.log
|
42
|
-
|
43
|
-
<Directory /path/application/public/>
|
44
|
-
Options ExecCGI FollowSymLinks
|
45
|
-
AllowOverride all
|
46
|
-
Allow from all
|
47
|
-
Order allow,deny
|
48
|
-
</Directory>
|
49
|
-
</VirtualHost>
|
50
|
-
|
51
|
-
NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI
|
52
|
-
should be on and ".cgi" should respond. All requests from 127.0.0.1 go
|
53
|
-
through CGI, so no Apache restart is necessary for changes. All other requests
|
54
|
-
go through FCGI (or mod_ruby), which requires a restart to show changes.
|
55
|
-
|
56
|
-
|
57
|
-
== Debugging Rails
|
58
|
-
|
59
|
-
Have "tail -f" commands running on both the server.log, production.log, and
|
60
|
-
test.log files. Rails will automatically display debugging and runtime
|
61
|
-
information to these files. Debugging info will also be shown in the browser
|
62
|
-
on requests from 127.0.0.1.
|
63
|
-
|
64
|
-
|
65
|
-
== Breakpoints
|
66
|
-
|
67
|
-
Breakpoint support is available through the script/breakpointer client. This
|
68
|
-
means that you can break out of execution at any point in the code, investigate
|
69
|
-
and change the model, AND then resume execution! Example:
|
70
|
-
|
71
|
-
class WeblogController < ActionController::Base
|
72
|
-
def index
|
73
|
-
@posts = Post.find_all
|
74
|
-
breakpoint "Breaking out from the list"
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
So the controller will accept the action, run the first line, then present you
|
79
|
-
with a IRB prompt in the breakpointer window. Here you can do things like:
|
80
|
-
|
81
|
-
Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
|
82
|
-
|
83
|
-
>> @posts.inspect
|
84
|
-
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
85
|
-
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
86
|
-
>> @posts.first.title = "hello from a breakpoint"
|
87
|
-
=> "hello from a breakpoint"
|
88
|
-
|
89
|
-
...and even better is that you can examine how your runtime objects actually work:
|
90
|
-
|
91
|
-
>> f = @posts.first
|
92
|
-
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
93
|
-
>> f.
|
94
|
-
Display all 152 possibilities? (y or n)
|
95
|
-
|
96
|
-
Finally, when you're ready to resume execution, you press CTRL-D
|
97
|
-
|
98
|
-
|
99
|
-
== Console
|
100
|
-
|
101
|
-
You can interact with the domain model by starting the console through script/console.
|
102
|
-
Here you'll have all parts of the application configured, just like it is when the
|
103
|
-
application is running. You can inspect domain models, change values, and save to the
|
104
|
-
database. Starting the script without arguments will launch it in the development environment.
|
105
|
-
Passing an argument will specify a different environment, like <tt>console production</tt>.
|
106
|
-
|
107
|
-
|
108
|
-
== Description of contents
|
109
|
-
|
110
|
-
app
|
111
|
-
Holds all the code that's specific to this particular application.
|
112
|
-
|
113
|
-
app/controllers
|
114
|
-
Holds controllers that should be named like weblog_controller.rb for
|
115
|
-
automated URL mapping. All controllers should descend from
|
116
|
-
ActionController::Base.
|
117
|
-
|
118
|
-
app/models
|
119
|
-
Holds models that should be named like post.rb.
|
120
|
-
Most models will descend from ActiveRecord::Base.
|
121
|
-
|
122
|
-
app/views
|
123
|
-
Holds the template files for the view that should be named like
|
124
|
-
weblog/index.rhtml for the WeblogController#index action. All views use eRuby
|
125
|
-
syntax. This directory can also be used to keep stylesheets, images, and so on
|
126
|
-
that can be symlinked to public.
|
127
|
-
|
128
|
-
app/helpers
|
129
|
-
Holds view helpers that should be named like weblog_helper.rb.
|
130
|
-
|
131
|
-
config
|
132
|
-
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
133
|
-
|
134
|
-
components
|
135
|
-
Self-contained mini-applications that can bundle together controllers, models, and views.
|
136
|
-
|
137
|
-
lib
|
138
|
-
Application specific libraries. Basically, any kind of custom code that doesn't
|
139
|
-
belong under controllers, models, or helpers. This directory is in the load path.
|
140
|
-
|
141
|
-
public
|
142
|
-
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
143
|
-
and javascripts. Also contains the dispatchers and the default HTML files.
|
144
|
-
|
145
|
-
script
|
146
|
-
Helper scripts for automation and generation.
|
147
|
-
|
148
|
-
test
|
149
|
-
Unit and functional tests along with fixtures.
|
150
|
-
|
151
|
-
vendor
|
152
|
-
External libraries that the application depends on. Also includes the plugins subdirectory.
|
153
|
-
This directory is in the load path.
|
3
|
+
1) How to retrieve data form user mojeID account
|
4
|
+
- controller actions named: "start_get_data" and "complete_get_data"
|
5
|
+
2) How to post data to user mojeID account
|
6
|
+
- controller actions named: "start_update_data" and "complete_update_data"
|
@@ -2,23 +2,29 @@ class ConsumerController < ApplicationController
|
|
2
2
|
layout nil
|
3
3
|
|
4
4
|
def index
|
5
|
-
# render an openid form
|
6
5
|
end
|
7
6
|
|
8
7
|
|
9
|
-
#
|
8
|
+
# Example how to retrieve data from mojeID
|
10
9
|
def start_get_data
|
11
10
|
begin
|
12
11
|
identifier = params[:openid_identifier].to_s + params[:openid_domain].to_s
|
12
|
+
|
13
|
+
# First, try to create request to mojeID server with user identifier
|
13
14
|
@moje_id = MojeID.fetch_request(consumer, identifier)
|
14
15
|
rescue OpenID::OpenIDError => e
|
15
16
|
flash[:error] = "Discovery failed for #{identifier}: #{e}"
|
16
17
|
return redirect_to :action => 'index'
|
17
18
|
end
|
18
|
-
|
19
|
+
|
20
|
+
# Next you can add to your request all attributes, you would like to get.
|
19
21
|
@moje_id.add_attributes(MojeIDAttributes::AVAILABLE_ATTRIBUTES[0..3])
|
22
|
+
|
23
|
+
# Setup your realm and return_to path.
|
20
24
|
@moje_id.return_to = url_for(:action => 'complete_get_data', :only_path => false)
|
21
25
|
@moje_id.realm = url_for(:action => 'index', :id => nil, :only_path => false)
|
26
|
+
|
27
|
+
# Redirect to generated url
|
22
28
|
redirect_to @moje_id.redirect_url
|
23
29
|
end
|
24
30
|
|
@@ -30,7 +36,7 @@ class ConsumerController < ApplicationController
|
|
30
36
|
end
|
31
37
|
|
32
38
|
|
33
|
-
#
|
39
|
+
# Example how to update data to mojeID
|
34
40
|
def start_update_data
|
35
41
|
begin
|
36
42
|
identifier = params[:openid_identifier]
|
@@ -53,6 +59,10 @@ class ConsumerController < ApplicationController
|
|
53
59
|
render :action => 'index'
|
54
60
|
end
|
55
61
|
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
56
66
|
private
|
57
67
|
|
58
68
|
require 'openid/store/memcache'
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
|
-
<title>Rails
|
3
|
+
<title>Rails mojeID Example</title>
|
4
4
|
</head>
|
5
5
|
<style type="text/css">
|
6
6
|
* {
|
@@ -41,7 +41,7 @@
|
|
41
41
|
table tr th {background: #dddddd; text-align: left;}
|
42
42
|
</style>
|
43
43
|
<body>
|
44
|
-
<h1>Rails
|
44
|
+
<h1>Rails mojeID Example</h1>
|
45
45
|
<% if flash[:alert] %>
|
46
46
|
<div class='alert'>
|
47
47
|
<%= h(flash[:alert]) %>
|
data/lib/available_attributes.rb
CHANGED
data/lib/ruby-mojeid.rb
CHANGED
@@ -5,6 +5,22 @@ require 'available_attributes'
|
|
5
5
|
class MojeID
|
6
6
|
attr_accessor :moje_id_request, :moje_id_response, :fetch_request, :fetch_response, :realm, :return_to
|
7
7
|
|
8
|
+
# Prepare request for openid server
|
9
|
+
#
|
10
|
+
# openid_identifier is user identifier like fullname.mojeid.cz
|
11
|
+
# consumer is object of OpenID::Consumer class.
|
12
|
+
#
|
13
|
+
# here is example how to create consumer
|
14
|
+
# * store = OpenID::Store::Memcache.new(MemCache.new('localhost:11211'))
|
15
|
+
# * @consumer = OpenID::Consumer.new(session, store)
|
16
|
+
#
|
17
|
+
# You can choose if you will be read data or store data by request_type param
|
18
|
+
# * request_type == :get mean that you will be read data about user
|
19
|
+
# * request_type == :put mean that you will be store data about user
|
20
|
+
#
|
21
|
+
# here is example how to create MojeID fetch request
|
22
|
+
# * @moje_id = MojeID.fetch_request(@consumer, 'fullname.mojeid.cz')
|
23
|
+
|
8
24
|
def self.fetch_request(consumer, openid_identifier, request_type = :get)
|
9
25
|
moje_id = MojeID.new
|
10
26
|
moje_id.moje_id_request = consumer.begin(openid_identifier)
|
@@ -12,6 +28,17 @@ class MojeID
|
|
12
28
|
moje_id
|
13
29
|
end
|
14
30
|
|
31
|
+
# Get response from openid server
|
32
|
+
#
|
33
|
+
# * consumer is object of OpenID::Consumer class, like in the fetch_request method
|
34
|
+
# * params are a params from request which openid server send to you
|
35
|
+
# * request is a request object from controller. It is necessary to remove dirty params
|
36
|
+
# * current_url is url of action which recieve the openid server response
|
37
|
+
# * with request_type you say, if this response become from get request or put request
|
38
|
+
#
|
39
|
+
# here is example how to create MojeID fetch response
|
40
|
+
# * @moje_id = MojeID.fetch_response(@consumer, params, request, url_for(:action => 'complete_update_data', :only_path => false), :put)
|
41
|
+
|
15
42
|
def self.fetch_response(consumer, params, request, current_url, request_type = :get)
|
16
43
|
moje_id = MojeID.new
|
17
44
|
parameters = params.reject{|k,v| request.path_parameters[k]}
|
@@ -20,51 +47,75 @@ class MojeID
|
|
20
47
|
moje_id
|
21
48
|
end
|
22
49
|
|
50
|
+
|
51
|
+
# Return the status of openid server response
|
52
|
+
# the statuses are :
|
53
|
+
# * OpenID::Consumer::FAILURE
|
54
|
+
# * OpenID::Consumer::SUCCESS
|
55
|
+
# * OpenID::Consumer::SETUP_NEEDED
|
56
|
+
# * OpenID::Consumer::CANCEL
|
57
|
+
|
23
58
|
def response_status
|
24
59
|
fetch_response.status
|
25
60
|
end
|
26
61
|
|
62
|
+
# Return the openid identifier like fullname.mojeid.cz
|
27
63
|
def identifier
|
28
64
|
fetch_response.display_identifier
|
29
65
|
end
|
30
66
|
|
67
|
+
# Return the response message
|
31
68
|
def message
|
32
|
-
fetch_response.
|
69
|
+
fetch_response.message
|
33
70
|
end
|
34
71
|
|
72
|
+
# Return data parsed to Hash, if it is a "fetch_response" with request_type == :get, else return blank Hash
|
35
73
|
def data
|
36
74
|
(!moje_id_response.nil? && moje_id_response.respond_to?('data') ) ? moje_id_response.data : {}
|
37
75
|
end
|
38
76
|
|
77
|
+
# Add attributes you would like to read about user, to request.
|
78
|
+
# You can pass attribute as array and change options like ns_alias or require.
|
79
|
+
# * example: @moje_id.add_attributes(['http://axschema.org/namePerson', nil, false])
|
80
|
+
# * or simple : @moje_id.add_attributes('http://axschema.org/namePerson')
|
39
81
|
def add_attributes(attributes = [])
|
40
|
-
attributes.each{ |attribute| add_attribute(attribute)}
|
82
|
+
attributes.each{ |attribute| attribute.is_a?(Array) ? add_attribute(attribute[0], attribute[1], attribute[2]) : add_attribute(attribute)}
|
41
83
|
end
|
42
|
-
|
84
|
+
|
85
|
+
# Add attributes and they values which you would like to update user profile, to request.
|
86
|
+
# Accept hash like {'http://axschema.org/namePerson' => 'my new great name'}
|
43
87
|
def update_attributes(data = {})
|
44
|
-
data.each{ |attribute,value| set_attribute(attribute, value)}
|
88
|
+
data.each{ |attribute, value| set_attribute(attribute, value)}
|
45
89
|
end
|
46
90
|
|
91
|
+
# Add additional data to request
|
92
|
+
# Accept hash like {'is_this_my_request' => 'yes'}
|
47
93
|
def add_additional_data(data = {})
|
48
94
|
data.each{|k,v| moje_id_request.return_to_args[k.to_s] = v}
|
49
95
|
bundle_to_request
|
50
96
|
end
|
51
|
-
|
97
|
+
|
98
|
+
# Should this OpenID authentication request be sent as a HTTP redirect or as a POST (form submission)?
|
52
99
|
def send_redirect?(immediate = false)
|
53
100
|
moje_id_request.send_redirect?(realm, return_to, immediate)
|
54
101
|
end
|
55
102
|
|
103
|
+
# Return the url you have to redirect after you compose your request
|
56
104
|
def redirect_url(immediate = false)
|
57
105
|
moje_id_request.redirect_url(realm, return_to, immediate)
|
58
106
|
end
|
59
107
|
|
108
|
+
# Get a complete HTML document that autosubmits the request to the IDP with javascript.
|
60
109
|
def html_markup(realm, return_to, immediate = false, form_tag_attrs = {})
|
61
110
|
moje_id_request.html_markup(realm, return_to, immediate, form_tag_attrs)
|
62
111
|
end
|
63
112
|
|
113
|
+
# Return a value of attribute, when you recieve a data from openid server
|
64
114
|
def get_attribute_value(attribute)
|
65
115
|
data[attribute]
|
66
116
|
end
|
67
117
|
|
118
|
+
|
68
119
|
def set_fetch_request_by_type(request_type)
|
69
120
|
self.fetch_request = case request_type
|
70
121
|
when :get then OpenID::AX::FetchRequest.new
|
@@ -84,14 +135,16 @@ class MojeID
|
|
84
135
|
def bundle_to_request
|
85
136
|
moje_id_request.add_extension(fetch_request)
|
86
137
|
end
|
87
|
-
|
88
|
-
|
138
|
+
|
139
|
+
# Pack attribute to request when you would like to get attribute
|
140
|
+
def add_attribute(attribute, ns_alais = nil, required = false)
|
89
141
|
if MojeID.is_attribute_available?(attribute)
|
90
|
-
fetch_request.add(OpenID::AX::AttrInfo.new(attribute))
|
142
|
+
fetch_request.add(OpenID::AX::AttrInfo.new(attribute, ns_alais, required))
|
91
143
|
bundle_to_request
|
92
144
|
end
|
93
145
|
end
|
94
146
|
|
147
|
+
# Pack attribute and his value to request when you would like to store attribute
|
95
148
|
def set_attribute(attribute, value)
|
96
149
|
if MojeID.is_attribute_available?(attribute)
|
97
150
|
fetch_request.set_values(attribute, value)
|
@@ -99,6 +152,7 @@ class MojeID
|
|
99
152
|
end
|
100
153
|
end
|
101
154
|
|
155
|
+
# Check if the attribute is available. You can find full list of attributes in lib/available_attributes.rb
|
102
156
|
def self.is_attribute_available?(attribute)
|
103
157
|
MojeIDAttributes::AVAILABLE_ATTRIBUTES.include?(attribute) ? true : raise("#{attribute} is not available")
|
104
158
|
end
|
data/ruby-mojeid.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruby-mojeid}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Robin Bortlik"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-31}
|
13
13
|
s.description = %q{This gem extend ruby-openid gem}
|
14
14
|
s.email = %q{robinbortlik@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -32,7 +32,6 @@ Gem::Specification.new do |s|
|
|
32
32
|
"examples/rails_openid/app/controllers/application_controller.rb",
|
33
33
|
"examples/rails_openid/app/controllers/consumer_controller.rb",
|
34
34
|
"examples/rails_openid/app/views/consumer/index.rhtml",
|
35
|
-
"examples/rails_openid/app/views/layouts/server.rhtml",
|
36
35
|
"examples/rails_openid/config/boot.rb",
|
37
36
|
"examples/rails_openid/config/database.sample.yml",
|
38
37
|
"examples/rails_openid/config/environment.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-mojeid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Robin Bortlik
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-31 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -135,7 +135,6 @@ files:
|
|
135
135
|
- examples/rails_openid/app/controllers/application_controller.rb
|
136
136
|
- examples/rails_openid/app/controllers/consumer_controller.rb
|
137
137
|
- examples/rails_openid/app/views/consumer/index.rhtml
|
138
|
-
- examples/rails_openid/app/views/layouts/server.rhtml
|
139
138
|
- examples/rails_openid/config/boot.rb
|
140
139
|
- examples/rails_openid/config/database.sample.yml
|
141
140
|
- examples/rails_openid/config/environment.rb
|
@@ -1,68 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head><title>OpenID Server Example</title></head>
|
3
|
-
<style type="text/css">
|
4
|
-
* {
|
5
|
-
font-family: verdana,sans-serif;
|
6
|
-
}
|
7
|
-
body {
|
8
|
-
width: 50em;
|
9
|
-
margin: 1em;
|
10
|
-
}
|
11
|
-
div {
|
12
|
-
padding: .5em;
|
13
|
-
}
|
14
|
-
table {
|
15
|
-
margin: none;
|
16
|
-
padding: none;
|
17
|
-
}
|
18
|
-
.notice {
|
19
|
-
border: 1px solid #60964f;
|
20
|
-
background: #b3dca7;
|
21
|
-
}
|
22
|
-
.error {
|
23
|
-
border: 1px solid #ff0000;
|
24
|
-
background: #ffaaaa;
|
25
|
-
}
|
26
|
-
#login-form {
|
27
|
-
border: 1px solid #777777;
|
28
|
-
background: #dddddd;
|
29
|
-
margin-top: 1em;
|
30
|
-
padding-bottom: 0em;
|
31
|
-
}
|
32
|
-
table {
|
33
|
-
padding: 1em;
|
34
|
-
}
|
35
|
-
li {margin-bottom: .5em;}
|
36
|
-
span.openid:before {
|
37
|
-
content: url(<%= @base_url %>images/openid_login_bg.gif) ;
|
38
|
-
}
|
39
|
-
span.openid {
|
40
|
-
font-size: smaller;
|
41
|
-
}
|
42
|
-
</style>
|
43
|
-
<body>
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
<% if session[:username] %>
|
48
|
-
<div style="float:right;">
|
49
|
-
Welcome, <%= session[:username] %> | <%= link_to('Log out', :controller => 'login', :action => 'logout') %><br />
|
50
|
-
<span class="openid"><%= @base_url %>user/<%= session[:username] %></span>
|
51
|
-
</div>
|
52
|
-
<% end %>
|
53
|
-
|
54
|
-
<h3>Ruby OpenID Server Example</h3>
|
55
|
-
|
56
|
-
<hr/>
|
57
|
-
|
58
|
-
<% if flash[:notice] or flash[:error] %>
|
59
|
-
<div class="<%= flash[:notice].nil? ? 'error' : 'notice' %>">
|
60
|
-
<%= flash[:error] or flash[:notice] %>
|
61
|
-
</div>
|
62
|
-
<% end %>
|
63
|
-
|
64
|
-
<%= @content_for_layout %>
|
65
|
-
|
66
|
-
|
67
|
-
</body>
|
68
|
-
</html>
|