ruby-mojeid 0.2.0

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 (59) hide show
  1. data/.document +5 -0
  2. data/Gemfile +13 -0
  3. data/Gemfile.lock +22 -0
  4. data/LICENSE.txt +20 -0
  5. data/README.rdoc +19 -0
  6. data/Rakefile +53 -0
  7. data/VERSION +1 -0
  8. data/examples/README +32 -0
  9. data/examples/rails_openid/Gemfile +7 -0
  10. data/examples/rails_openid/Gemfile.lock +41 -0
  11. data/examples/rails_openid/README +153 -0
  12. data/examples/rails_openid/Rakefile +10 -0
  13. data/examples/rails_openid/app/controllers/application_controller.rb +4 -0
  14. data/examples/rails_openid/app/controllers/consumer_controller.rb +79 -0
  15. data/examples/rails_openid/app/views/consumer/index.rhtml +88 -0
  16. data/examples/rails_openid/app/views/layouts/server.rhtml +68 -0
  17. data/examples/rails_openid/config/boot.rb +125 -0
  18. data/examples/rails_openid/config/database.sample.yml +14 -0
  19. data/examples/rails_openid/config/environment.rb +56 -0
  20. data/examples/rails_openid/config/environments/development.rb +16 -0
  21. data/examples/rails_openid/config/environments/production.rb +19 -0
  22. data/examples/rails_openid/config/environments/test.rb +19 -0
  23. data/examples/rails_openid/config/preinitializer.rb +20 -0
  24. data/examples/rails_openid/config/routes.rb +19 -0
  25. data/examples/rails_openid/public/.htaccess +40 -0
  26. data/examples/rails_openid/public/404.html +8 -0
  27. data/examples/rails_openid/public/500.html +8 -0
  28. data/examples/rails_openid/public/dispatch.cgi +12 -0
  29. data/examples/rails_openid/public/dispatch.fcgi +26 -0
  30. data/examples/rails_openid/public/dispatch.rb +12 -0
  31. data/examples/rails_openid/public/favicon.ico +0 -0
  32. data/examples/rails_openid/public/images/openid_login_bg.gif +0 -0
  33. data/examples/rails_openid/public/javascripts/controls.js +750 -0
  34. data/examples/rails_openid/public/javascripts/dragdrop.js +584 -0
  35. data/examples/rails_openid/public/javascripts/effects.js +854 -0
  36. data/examples/rails_openid/public/javascripts/prototype.js +1785 -0
  37. data/examples/rails_openid/public/robots.txt +1 -0
  38. data/examples/rails_openid/script/about +3 -0
  39. data/examples/rails_openid/script/breakpointer +3 -0
  40. data/examples/rails_openid/script/console +3 -0
  41. data/examples/rails_openid/script/destroy +3 -0
  42. data/examples/rails_openid/script/generate +3 -0
  43. data/examples/rails_openid/script/performance/benchmarker +3 -0
  44. data/examples/rails_openid/script/performance/profiler +3 -0
  45. data/examples/rails_openid/script/plugin +3 -0
  46. data/examples/rails_openid/script/process/reaper +3 -0
  47. data/examples/rails_openid/script/process/spawner +3 -0
  48. data/examples/rails_openid/script/process/spinner +3 -0
  49. data/examples/rails_openid/script/runner +3 -0
  50. data/examples/rails_openid/script/server +3 -0
  51. data/examples/rails_openid/test/functional/login_controller_test.rb +18 -0
  52. data/examples/rails_openid/test/functional/server_controller_test.rb +18 -0
  53. data/examples/rails_openid/test/test_helper.rb +28 -0
  54. data/lib/available_attributes.rb +69 -0
  55. data/lib/ruby-mojeid.rb +106 -0
  56. data/ruby-mojeid.gemspec +130 -0
  57. data/test/helper.rb +18 -0
  58. data/test/test_ruby-mojeid.rb +7 -0
  59. metadata +230 -0
@@ -0,0 +1,125 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
66
+ exit 1
67
+ end
68
+
69
+ class << self
70
+ def rubygems_version
71
+ Gem::RubyGemsVersion rescue nil
72
+ end
73
+
74
+ def gem_version
75
+ if defined? RAILS_GEM_VERSION
76
+ RAILS_GEM_VERSION
77
+ elsif ENV.include?('RAILS_GEM_VERSION')
78
+ ENV['RAILS_GEM_VERSION']
79
+ else
80
+ parse_gem_version(read_environment_rb)
81
+ end
82
+ end
83
+
84
+ def load_rubygems
85
+ min_version = '1.3.2'
86
+ require 'rubygems'
87
+ unless rubygems_version >= min_version
88
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
+ exit 1
90
+ end
91
+
92
+ rescue LoadError
93
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94
+ exit 1
95
+ end
96
+
97
+ def parse_gem_version(text)
98
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99
+ end
100
+
101
+ private
102
+ def read_environment_rb
103
+ File.read("#{RAILS_ROOT}/config/environment.rb")
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ class Rails::Boot
110
+ def run
111
+ load_initializer
112
+
113
+ Rails::Initializer.class_eval do
114
+ def load_gems
115
+ @bundler_loaded ||= Bundler.require :default, Rails.env
116
+ end
117
+ end
118
+
119
+ Rails::Initializer.run(:set_load_path)
120
+ end
121
+ end
122
+
123
+
124
+ # All that for this:
125
+ Rails.boot!
@@ -0,0 +1,14 @@
1
+ # MySQL (default setup). Versions 4.1 and 5.0 are recommended.
2
+ #
3
+ # Get the fast C bindings:
4
+ # gem install mysql
5
+ # (on OS X: gem install mysql -- --include=/usr/local/lib)
6
+ # And be sure to use new-style password hashing:
7
+ # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
8
+ development:
9
+ adapter: mysql
10
+ database: openid
11
+ user: root
12
+ password:
13
+
14
+
@@ -0,0 +1,56 @@
1
+ # Be sure to restart your web server when you modify this file.
2
+
3
+ # Uncomment below to force Rails into production mode when
4
+ # you don't control web/app server and can't set it the proper way
5
+ # ENV['RAILS_ENV'] ||= 'production'
6
+
7
+ RAILS_GEM_VERSION = '2.3.9' unless defined? RAILS_GEM_VERSION
8
+
9
+ # Bootstrap the Rails environment, frameworks, and default configuration
10
+ require File.join(File.dirname(__FILE__), 'boot')
11
+
12
+ Rails::Initializer.run do |config|
13
+ # Settings in config/environments/* take precedence those specified here
14
+
15
+ # Skip frameworks you're not going to use
16
+ # config.frameworks -= [ :action_web_service, :action_mailer ]
17
+
18
+ # Add additional load paths for your own custom dirs
19
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
20
+
21
+ # Force all environments to use the same logger level
22
+ # (by default production uses :info, the others :debug)
23
+ # config.log_level = :debug
24
+
25
+ # Use the database for sessions instead of the file system
26
+ # (create the session table with 'rake create_sessions_table')
27
+ config.action_controller.session_store = :mem_cache_store
28
+
29
+ # Enable page/fragment caching by setting a file-based store
30
+ # (remember to create the caching directory and make it readable to the application)
31
+ # config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/cache"
32
+
33
+ # Activate observers that should always be running
34
+ # config.active_record.observers = :cacher, :garbage_collector
35
+
36
+ # Make Active Record use UTC-base instead of local time
37
+ # config.active_record.default_timezone = :utc
38
+
39
+ # Use Active Record's schema dumper instead of SQL when creating the test database
40
+ # (enables use of different database adapters for development and test environments)
41
+ # config.active_record.schema_format = :ruby
42
+
43
+ # See Rails::Configuration for more options
44
+ config.action_controller.session = { :key => "_my_openid_session", :secret => "264623e35408bffeda903507b309ba44" }
45
+ end
46
+
47
+ # Add new inflection rules using the following format
48
+ # (all these examples are active by default):
49
+ # Inflector.inflections do |inflect|
50
+ # inflect.plural /^(ox)$/i, '\1en'
51
+ # inflect.singular /^(ox)en/i, '\1'
52
+ # inflect.irregular 'person', 'people'
53
+ # inflect.uncountable %w( fish sheep )
54
+ # end
55
+
56
+ # Include your application configuration below
@@ -0,0 +1,16 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # In the development environment your application's code is reloaded on
4
+ # every request. This slows down response time but is perfect for development
5
+ # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
7
+
8
+ # Log error messages when you accidentally call methods on nil.
9
+ config.whiny_nils = true
10
+
11
+ # Show full error reports and disable caching
12
+ config.action_controller.consider_all_requests_local = true
13
+ config.action_controller.perform_caching = false
14
+
15
+ # Don't care if the mailer can't send
16
+ config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,19 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The production environment is meant for finished, "live" apps.
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+
7
+ # Use a different logger for distributed setups
8
+ # config.logger = SyslogLogger.new
9
+
10
+
11
+ # Full error reports are disabled and caching is turned on
12
+ config.action_controller.consider_all_requests_local = false
13
+ config.action_controller.perform_caching = true
14
+
15
+ # Enable serving of images, stylesheets, and javascripts from an asset server
16
+ # config.action_controller.asset_host = "http://assets.example.com"
17
+
18
+ # Disable delivery errors if you bad email addresses should just be ignored
19
+ # config.action_mailer.raise_delivery_errors = false
@@ -0,0 +1,19 @@
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # The test environment is used exclusively to run your application's
4
+ # test suite. You never need to work with it otherwise. Remember that
5
+ # your test database is "scratch space" for the test suite and is wiped
6
+ # and recreated between test runs. Don't rely on the data there!
7
+ config.cache_classes = true
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.action_controller.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Tell ActionMailer not to deliver emails to the real world.
17
+ # The :test delivery method accumulates sent emails in the
18
+ # ActionMailer::Base.deliveries array.
19
+ config.action_mailer.delivery_method = :test
@@ -0,0 +1,20 @@
1
+ begin
2
+ require "rubygems"
3
+ require "bundler"
4
+ rescue LoadError
5
+ raise "Could not load the bundler gem. Install it with `gem install bundler`."
6
+ end
7
+
8
+ if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
9
+ raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
10
+ "Run `gem install bundler` to upgrade."
11
+ end
12
+
13
+ begin
14
+ # Set up load paths for all bundled gems
15
+ ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
16
+ Bundler.setup
17
+ rescue Bundler::GemNotFound
18
+ raise RuntimeError, "Bundler couldn't find some gems." +
19
+ "Did you run `bundle install`?"
20
+ end
@@ -0,0 +1,19 @@
1
+ ActionController::Routing::Routes.draw do |map|
2
+ # Add your own custom routes here.
3
+ # The priority is based upon order of creation: first created -> highest priority.
4
+
5
+ # Here's a sample route:
6
+ # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7
+ # Keep in mind you can assign values other than :controller and :action
8
+
9
+ # You can have the root of your site routed by hooking up ''
10
+ # -- just remember to delete public/index.html.
11
+ # map.connect '', :controller => "welcome"
12
+
13
+ map.connect '', :controller => 'consumer'
14
+
15
+ # Allow downloading Web Service WSDL as a file with an extension
16
+ # instead of a file named 'wsdl'
17
+ # Install the default route as the lowest priority.
18
+ map.connect ':controller/:action/:id'
19
+ end
@@ -0,0 +1,40 @@
1
+ # General Apache options
2
+ AddHandler fastcgi-script .fcgi
3
+ AddHandler cgi-script .cgi
4
+ Options +FollowSymLinks +ExecCGI
5
+
6
+ # If you don't want Rails to look in certain directories,
7
+ # use the following rewrite rules so that Apache won't rewrite certain requests
8
+ #
9
+ # Example:
10
+ # RewriteCond %{REQUEST_URI} ^/notrails.*
11
+ # RewriteRule .* - [L]
12
+
13
+ # Redirect all requests not available on the filesystem to Rails
14
+ # By default the cgi dispatcher is used which is very slow
15
+ #
16
+ # For better performance replace the dispatcher with the fastcgi one
17
+ #
18
+ # Example:
19
+ # RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
20
+ RewriteEngine On
21
+
22
+ # If your Rails application is accessed via an Alias directive,
23
+ # then you MUST also set the RewriteBase in this htaccess file.
24
+ #
25
+ # Example:
26
+ # Alias /myrailsapp /path/to/myrailsapp/public
27
+ # RewriteBase /myrailsapp
28
+
29
+ RewriteRule ^$ index.html [QSA]
30
+ RewriteRule ^([^.]+)$ $1.html [QSA]
31
+ RewriteCond %{REQUEST_FILENAME} !-f
32
+ RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
33
+
34
+ # In case Rails experiences terminal errors
35
+ # Instead of displaying this message you can supply a file here which will be rendered instead
36
+ #
37
+ # Example:
38
+ # ErrorDocument 500 /500.html
39
+
40
+ ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"
@@ -0,0 +1,8 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <body>
5
+ <h1>File not found</h1>
6
+ <p>Change this error message for pages not found in public/404.html</p>
7
+ </body>
8
+ </html>
@@ -0,0 +1,8 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <body>
5
+ <h1>Application error (Apache)</h1>
6
+ <p>Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code) in public/500.html</p>
7
+ </body>
8
+ </html>
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/ruby1.8
2
+
3
+ #!/usr/local/bin/ruby
4
+
5
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
6
+
7
+ # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
8
+ # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
9
+ require "dispatcher"
10
+
11
+ ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
12
+ Dispatcher.dispatch
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/ruby1.8
2
+
3
+ #!/usr/local/bin/ruby
4
+ #
5
+ # You may specify the path to the FastCGI crash log (a log of unhandled
6
+ # exceptions which forced the FastCGI instance to exit, great for debugging)
7
+ # and the number of requests to process before running garbage collection.
8
+ #
9
+ # By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
10
+ # and the GC period is nil (turned off). A reasonable number of requests
11
+ # could range from 10-100 depending on the memory footprint of your app.
12
+ #
13
+ # Example:
14
+ # # Default log path, normal GC behavior.
15
+ # RailsFCGIHandler.process!
16
+ #
17
+ # # Default log path, 50 requests between GC.
18
+ # RailsFCGIHandler.process! nil, 50
19
+ #
20
+ # # Custom log path, normal GC behavior.
21
+ # RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
22
+ #
23
+ require File.dirname(__FILE__) + "/../config/environment"
24
+ require 'fcgi_handler'
25
+
26
+ RailsFCGIHandler.process!
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/ruby1.8
2
+
3
+ #!/usr/local/bin/ruby
4
+
5
+ require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
6
+
7
+ # If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
8
+ # "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
9
+ require "dispatcher"
10
+
11
+ ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
12
+ Dispatcher.dispatch
File without changes