├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── CHANGES-2.0.0
├── CHANGES-2.1.0
├── Gemfile
├── INSTALL.md
├── LICENSE
├── NOTICE
├── README.md
├── Rakefile
├── UPGRADE.md
├── admin
├── build-docs
├── fixperms
├── gettlds.py
├── graph-require.sh
├── library-name
├── mkassoc
├── prepare-release
└── runtests
├── contrib
└── google
│ ├── ruby-openid-apps-discovery-1.0.gem
│ └── ruby-openid-apps-discovery-1.01.gem
├── examples
├── README.md
├── active_record_openid_store
│ ├── README
│ ├── XXX_add_open_id_store_to_db.rb
│ ├── XXX_upgrade_open_id_store.rb
│ ├── init.rb
│ ├── lib
│ │ ├── association.rb
│ │ ├── nonce.rb
│ │ ├── open_id_setting.rb
│ │ └── openid_ar_store.rb
│ └── test
│ │ └── store_test.rb
├── discover
└── rails_openid
│ ├── Gemfile
│ ├── README
│ ├── README.rdoc
│ ├── Rakefile
│ ├── app
│ ├── assets
│ │ ├── images
│ │ │ └── rails.png
│ │ ├── javascripts
│ │ │ └── application.js
│ │ └── stylesheets
│ │ │ └── application.css
│ ├── controllers
│ │ ├── application_controller.rb
│ │ ├── consumer_controller.rb
│ │ ├── login_controller.rb
│ │ └── server_controller.rb
│ ├── helpers
│ │ ├── application_helper.rb
│ │ ├── login_helper.rb
│ │ └── server_helper.rb
│ ├── mailers
│ │ └── .gitkeep
│ ├── models
│ │ └── .gitkeep
│ └── views
│ │ ├── consumer
│ │ └── index.html.erb
│ │ ├── layouts
│ │ └── server.html.erb
│ │ ├── login
│ │ └── index.html.erb
│ │ └── server
│ │ └── decide.html.erb
│ ├── config.ru
│ ├── config
│ ├── application.rb
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ │ ├── development.rb
│ │ ├── production.rb
│ │ └── test.rb
│ ├── initializers
│ │ ├── backtrace_silencers.rb
│ │ ├── inflections.rb
│ │ ├── mime_types.rb
│ │ ├── rails_root.rb
│ │ ├── secret_token.rb
│ │ ├── session_store.rb
│ │ └── wrap_parameters.rb
│ ├── locales
│ │ └── en.yml
│ └── routes.rb
│ ├── db
│ ├── development.sqlite3
│ └── seeds.rb
│ ├── doc
│ └── README_FOR_APP
│ ├── lib
│ ├── assets
│ │ └── .gitkeep
│ └── tasks
│ │ └── .gitkeep
│ ├── log
│ ├── .gitkeep
│ └── development.log
│ ├── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── dispatch.cgi
│ ├── dispatch.fcgi
│ ├── dispatch.rb
│ ├── favicon.ico
│ ├── images
│ │ └── openid_login_bg.gif
│ ├── javascripts
│ │ ├── application.js
│ │ ├── controls.js
│ │ ├── dragdrop.js
│ │ ├── effects.js
│ │ └── prototype.js
│ └── robots.txt
│ ├── script
│ └── rails
│ └── test
│ ├── fixtures
│ └── .gitkeep
│ ├── functional
│ ├── .gitkeep
│ ├── login_controller_test.rb
│ └── server_controller_test.rb
│ ├── integration
│ └── .gitkeep
│ ├── performance
│ └── browsing_test.rb
│ ├── test_helper.rb
│ └── unit
│ └── .gitkeep
├── lib
├── hmac
│ ├── hmac.rb
│ ├── sha1.rb
│ └── sha2.rb
├── openid.rb
├── openid
│ ├── association.rb
│ ├── consumer.rb
│ ├── consumer
│ │ ├── associationmanager.rb
│ │ ├── checkid_request.rb
│ │ ├── discovery.rb
│ │ ├── discovery_manager.rb
│ │ ├── html_parse.rb
│ │ ├── idres.rb
│ │ ├── responses.rb
│ │ └── session.rb
│ ├── cryptutil.rb
│ ├── dh.rb
│ ├── extension.rb
│ ├── extensions
│ │ ├── ax.rb
│ │ ├── oauth.rb
│ │ ├── pape.rb
│ │ ├── sreg.rb
│ │ └── ui.rb
│ ├── fetchers.rb
│ ├── kvform.rb
│ ├── kvpost.rb
│ ├── message.rb
│ ├── protocolerror.rb
│ ├── server.rb
│ ├── store
│ │ ├── filesystem.rb
│ │ ├── interface.rb
│ │ ├── memcache.rb
│ │ ├── memory.rb
│ │ └── nonce.rb
│ ├── trustroot.rb
│ ├── urinorm.rb
│ ├── util.rb
│ ├── version.rb
│ └── yadis
│ │ ├── accept.rb
│ │ ├── constants.rb
│ │ ├── discovery.rb
│ │ ├── filters.rb
│ │ ├── htmltokenizer.rb
│ │ ├── parsehtml.rb
│ │ ├── services.rb
│ │ ├── xrds.rb
│ │ ├── xri.rb
│ │ └── xrires.rb
└── ruby-openid.rb
├── ruby-openid.gemspec
├── setup.rb
└── test
├── data
├── accept.txt
├── dh.txt
├── example-xrds.xml
├── linkparse.txt
├── n2b64
├── test1-discover.txt
├── test1-parsehtml.txt
├── test_discover
│ ├── malformed_meta_tag.html
│ ├── openid.html
│ ├── openid2.html
│ ├── openid2_xrds.xml
│ ├── openid2_xrds_no_local_id.xml
│ ├── openid_1_and_2.html
│ ├── openid_1_and_2_xrds.xml
│ ├── openid_1_and_2_xrds_bad_delegate.xml
│ ├── openid_and_yadis.html
│ ├── openid_no_delegate.html
│ ├── openid_utf8.html
│ ├── yadis_0entries.xml
│ ├── yadis_2_bad_local_id.xml
│ ├── yadis_2entries_delegate.xml
│ ├── yadis_2entries_idp.xml
│ ├── yadis_another_delegate.xml
│ ├── yadis_idp.xml
│ ├── yadis_idp_delegate.xml
│ └── yadis_no_delegate.xml
├── test_xrds
│ ├── =j3h.2007.11.14.xrds
│ ├── README
│ ├── delegated-20060809-r1.xrds
│ ├── delegated-20060809-r2.xrds
│ ├── delegated-20060809.xrds
│ ├── no-xrd.xml
│ ├── not-xrds.xml
│ ├── prefixsometimes.xrds
│ ├── ref.xrds
│ ├── sometimesprefix.xrds
│ ├── spoof1.xrds
│ ├── spoof2.xrds
│ ├── spoof3.xrds
│ ├── status222.xrds
│ ├── subsegments.xrds
│ └── valid-populated-xrds.xml
├── trustroot.txt
└── urinorm.txt
├── discoverdata.rb
├── test_accept.rb
├── test_association.rb
├── test_associationmanager.rb
├── test_ax.rb
├── test_checkid_request.rb
├── test_consumer.rb
├── test_cryptutil.rb
├── test_dh.rb
├── test_discover.rb
├── test_discovery_manager.rb
├── test_extension.rb
├── test_fetchers.rb
├── test_filters.rb
├── test_idres.rb
├── test_kvform.rb
├── test_kvpost.rb
├── test_linkparse.rb
├── test_message.rb
├── test_nonce.rb
├── test_oauth.rb
├── test_openid_yadis.rb
├── test_pape.rb
├── test_parsehtml.rb
├── test_responses.rb
├── test_server.rb
├── test_sreg.rb
├── test_stores.rb
├── test_trustroot.rb
├── test_ui.rb
├── test_urinorm.rb
├── test_util.rb
├── test_xrds.rb
├── test_xri.rb
├── test_xrires.rb
├── test_yadis_discovery.rb
├── testutil.rb
└── util.rb
/.gitignore:
--------------------------------------------------------------------------------
1 | *.gem
2 | *.rbc
3 | .bundle
4 | .config
5 | .yardoc
6 | Gemfile.lock
7 | InstalledFiles
8 | _yardoc
9 | coverage
10 | doc/
11 | lib/bundler/man
12 | pkg
13 | rdoc
14 | spec/reports
15 | test/tmp
16 | test/version_tmp
17 | tmp
18 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: ruby
2 | sudo: required
3 | dist: trusty
4 | script: rake
5 | rvm:
6 | - "1.9"
7 | - "2.0"
8 | - "2.1"
9 | - "2.2"
10 | - "2.3"
11 | - "2.4"
12 | - "2.5"
13 | - "2.6"
14 | - ruby-head
15 | - jruby
16 | - jruby-head
17 | - jruby-19mode
18 | - rubinius-3
19 |
20 | before_install:
21 | - "gem install bundler || gem install bundler --version '< 2'"
22 |
23 | matrix:
24 | allow_failures:
25 | - rvm: "ruby-head"
26 | - rvm: "jruby-head"
27 |
--------------------------------------------------------------------------------
/CHANGES-2.0.0:
--------------------------------------------------------------------------------
1 |
2 | * API Changes
3 | * PAPE (Provider Authentication Policy Extension) module
4 | * Updated extension for specification draft 2
5 | * PAPE::Request::from_success_response returns nil if PAPE
6 | response arguments were not signed
7 | * Added functions to generate request/response HTML forms with
8 | auto-submission javascript
9 | * Consumer (relying party) API:
10 | Auth_OpenID_AuthRequest::htmlMarkup
11 | * Server API: Auth_OpenID_OpenIDResponse::toHTML
12 | * Removed Rails login generator
13 | * SReg::Response::from_success_response returns nil when no signed
14 | arguments were found
15 |
16 | * New Features
17 | * Fetchers now only read/request first megabyte of response
18 |
19 | * Bug fixes
20 | * NOT NULL constraints to tables created by ActiveRecordStore
21 | * check_authentication requests: copy entire response, not just
22 | signed fields. Fixes missing namespace in check_authentication
23 | requests
24 | * OpenID 1 association requests no longer explicitly set
25 | no-encryption session type
26 | * Improved HTML parsing
27 | * AssociationRequest::answer: include session_type in
28 | no-encryption assoc responses
29 | * normalize return_to URL before performing return_to verification
30 | * OpenID::Consumer::IdResHandler.verify_discovery_results_openid1:
31 | fall back to OpenID 1.0 type if 1.1 endpoint cannot be found
32 | * StandardFetcher now includes a timeout setting
33 | * Handle blank content types in
34 | OpenID::Yadis::DiscoveryResult.where_is_yadis?
35 | * Properly convert timestamps to ints before storing in DB, and vise
36 | versa
37 |
--------------------------------------------------------------------------------
/CHANGES-2.1.0:
--------------------------------------------------------------------------------
1 |
2 | * API Changes
3 | * PAPE (Provider Authentication Policy Extension) module
4 | * Updated extension for specification draft 2
5 | * PAPE::Request::from_success_response returns nil if PAPE
6 | response arguments were not signed
7 | * Added functions to generate request/response HTML forms with
8 | auto-submission javascript
9 | * Consumer (relying party) API:
10 | Auth_OpenID_AuthRequest::htmlMarkup
11 | * Server API: Auth_OpenID_OpenIDResponse::toHTML
12 | * Removed Rails login generator
13 | * SReg::Response::from_success_response returns nil when no signed
14 | arguments were found
15 |
16 | * New Features
17 | * Fetchers now only read/request first megabyte of response
18 |
19 | * Bug fixes
20 | * NOT NULL constraints to tables created by ActiveRecordStore
21 | * check_authentication requests: copy entire response, not just
22 | signed fields. Fixes missing namespace in check_authentication
23 | requests
24 | * OpenID 1 association requests no longer explicitly set
25 | no-encryption session type
26 | * Improved HTML parsing
27 | * AssociationRequest::answer: include session_type in
28 | no-encryption assoc responses
29 | * normalize return_to URL before performing return_to verification
30 | * OpenID::Consumer::IdResHandler.verify_discovery_results_openid1:
31 | fall back to OpenID 1.0 type if 1.1 endpoint cannot be found
32 | * StandardFetcher now includes a timeout setting
33 | * Handle blank content types in
34 | OpenID::Yadis::DiscoveryResult.where_is_yadis?
35 | * Properly convert timestamps to ints before storing in DB, and vise
36 | versa
37 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # Specify your gem's dependencies in ruby-openid.gemspec
4 | gemspec
5 |
6 | gem 'rake'
7 |
--------------------------------------------------------------------------------
/INSTALL.md:
--------------------------------------------------------------------------------
1 | # Ruby OpenID Library Installation
2 |
3 | ## Install as a gem
4 |
5 | `ruby-openid` is distributed on [RubyGems](https://rubygems.org/).
6 | Install it:
7 |
8 | gem install ruby-openid
9 |
10 | This is probably what you need.
11 |
12 | ## Manual Installation
13 |
14 | Unpack the archive and run `setup.rb` to install:
15 |
16 | ruby setup.rb
17 |
18 | `setup.rb` installs the library into your system ruby. If don't want to
19 | add openid to you system ruby, you may instead add the `lib` directory of
20 | the extracted tarball to your `RUBYLIB` environment variable:
21 |
22 | $ export RUBYLIB=${RUBYLIB}:/path/to/ruby-openid/lib
23 |
24 | ## Testing the Installation
25 |
26 | Make sure everything installed ok:
27 |
28 | $> irb
29 | irb$> require "openid"
30 | => true
31 |
32 | ## Run the test suite
33 |
34 | Go into the test directory and execute the `runtests.rb` script.
35 |
36 | ## Next steps
37 |
38 | * Run `consumer.rb` in the `examples/` directory.
39 | * Get started writing your own consumer using `OpenID::Consumer`
40 | * Write your own server with `OpenID::Server`
41 | * Use the `OpenIDLoginGenerator`! Read `examples/README.md` for more info.
42 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | This product includes software developed by JanRain,
2 | available from http://github.com/openid/ruby-openid
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Ruby OpenID
2 |
3 | A Ruby library for verifying and serving OpenID identities.
4 |
5 | [](http://travis-ci.org/openid/ruby-openid)
6 |
7 | ## Features
8 |
9 | * Easy to use API for verifying OpenID identites - OpenID::Consumer
10 | * Support for serving OpenID identites - OpenID::Server
11 | * Does not depend on underlying web framework
12 | * Supports multiple storage mechanisms (Filesystem, ActiveRecord, Memory)
13 | * Example code to help you get started, including:
14 | * Ruby on Rails based consumer and server
15 | * OpenIDLoginGenerator for quickly getting creating a rails app that uses
16 | OpenID for authentication
17 | * ActiveRecordOpenIDStore plugin
18 | * Comprehensive test suite
19 | * Supports both OpenID 1 and OpenID 2 transparently
20 |
21 | ## Installing
22 |
23 | Before running the examples or writing your own code you'll need to install
24 | the library. See the INSTALL file or use rubygems:
25 |
26 | gem install ruby-openid
27 |
28 | Check the installation:
29 |
30 | $ irb
31 | irb> require 'rubygems'
32 | => false
33 | irb> gem 'ruby-openid'
34 | => true
35 |
36 | The library is known to work with Ruby 1.9.2 and above on Unix, Max OS X and Win32.
37 |
38 | ## Getting Started
39 |
40 | The best way to start is to look at the rails_openid example.
41 | You can run it with:
42 |
43 | cd examples/rails_openid
44 | script/server
45 |
46 | If you are writing an OpenID Relying Party, a good place to start is:
47 | `examples/rails_openid/app/controllers/consumer_controller.rb`
48 |
49 | And if you are writing an OpenID provider:
50 | `examples/rails_openid/app/controllers/server_controller.rb`
51 |
52 | The library code is quite well documented, so don't be squeamish, and
53 | look at the library itself if there's anything you don't understand in
54 | the examples.
55 |
56 | ## Homepage
57 |
58 | * GitHub repository: [openid/ruby-openid](http://github.com/openid/ruby-openid)
59 | * Homepage: [OpenID.net](http://openid.net/)
60 |
61 | ## Community
62 |
63 | Discussion regarding the Ruby OpenID library and other JanRain OpenID
64 | libraries takes place on the [OpenID mailing list](http://openid.net/developers/dev-mailing-lists/).
65 |
66 | Please join this list to discuss, ask implementation questions, report
67 | bugs, etc. Also check out the openid channel on the freenode IRC
68 | network.
69 |
70 | If you have a bugfix or feature you'd like to contribute, don't
71 | hesitate to send it to us: [How to contribute](http://openidenabled.com/contribute/).
72 |
73 | ## Author
74 |
75 | Copyright 2006-2012, JanRain, Inc.
76 |
77 | Contact openid@janrain.com.
78 |
79 | ## License
80 |
81 | Apache Software License. For more information see the LICENSE file.
82 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env rake
2 | require 'bundler/gem_tasks'
3 |
4 | require 'rake/testtask'
5 |
6 | desc "Run tests"
7 | Rake::TestTask.new('test') do |t|
8 | t.libs << 'lib'
9 | t.libs << 'test'
10 | t.test_files = FileList["test/**/test_*.rb"]
11 | t.verbose = false
12 | end
13 |
14 | task :default => :test
15 |
--------------------------------------------------------------------------------
/admin/build-docs:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | #
3 | # Build the HTML documentation for the JanRain PHP OpenID library
4 | #
5 | # Usage:
6 | # build-docs
7 | #
8 | # Must be run from the base of the repository
9 |
10 | RDOC_FILES="README INSTALL LICENSE UPGRADE lib/openid examples/README"
11 | MAIN=README
12 | rdoc --main="$MAIN" $RDOC_FILES
--------------------------------------------------------------------------------
/admin/fixperms:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | cat < Welcome to the Ruby OpenID example. This code is a starting point
17 | for developers wishing to implement an OpenID provider or relying
18 | party. We've used the Rails
19 | platform to demonstrate, but the library code is not Rails specific.
23 | The server will automatically create an identity page for
29 | you at <%= @base_url %>user/name Because WEBrick can only handle one thing at a time, you'll need to
32 | run another instance of the example on another port if you want to use
33 | a relying party to use with this example provider: (The RP needs to be able to access the provider, so unless you're
39 | running this example on a public IP, you can't use the live example
40 | at openidenabled.com on
41 | your local provider.)
Proceed to step 2 below."
31 | else
32 | flash[:error] = "Sorry, couldn't log you in. Try again."
33 | end
34 |
35 | redirect_to :action => 'index'
36 | end
37 |
38 | def logout
39 | # delete the username from the session hash
40 | session[:username] = nil
41 | session[:approvals] = nil
42 | redirect_to :action => 'index'
43 | end
44 |
45 | end
46 |
--------------------------------------------------------------------------------
/examples/rails_openid/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/examples/rails_openid/app/helpers/login_helper.rb:
--------------------------------------------------------------------------------
1 | module LoginHelper
2 | end
3 |
--------------------------------------------------------------------------------
/examples/rails_openid/app/helpers/server_helper.rb:
--------------------------------------------------------------------------------
1 |
2 | module ServerHelper
3 |
4 | def url_for_user
5 | url_for :controller => 'user', :action => session[:username]
6 | end
7 |
8 | end
9 |
10 |
--------------------------------------------------------------------------------
/examples/rails_openid/app/mailers/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openid/ruby-openid/13a88ad6442133a613d2b7d6601991a84b34630d/examples/rails_openid/app/mailers/.gitkeep
--------------------------------------------------------------------------------
/examples/rails_openid/app/models/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/openid/ruby-openid/13a88ad6442133a613d2b7d6601991a84b34630d/examples/rails_openid/app/models/.gitkeep
--------------------------------------------------------------------------------
/examples/rails_openid/app/views/consumer/index.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 | Rails OpenID Example Relying Party
43 | <% if flash[:alert] %>
44 |
52 | <%= @base_url %>user/<%= session[:username] %>
53 | Ruby OpenID Server Example
57 |
58 |
59 |
60 | <% if flash[:notice] or flash[:error] %>
61 | To use the example provider
22 |
24 |
25 |
48 |
49 |
35 |
37 |
38 | script/server --port=3001
36 |
Visit /consumer 54 | and enter your OpenID.
55 | 56 | 57 | -------------------------------------------------------------------------------- /examples/rails_openid/app/views/server/decide.html.erb: -------------------------------------------------------------------------------- 1 | 28 | -------------------------------------------------------------------------------- /examples/rails_openid/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run RailsOpenid::Application 5 | -------------------------------------------------------------------------------- /examples/rails_openid/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | if defined?(Bundler) 6 | # If you precompile assets before deploying to production, use this line 7 | Bundler.require(*Rails.groups(:assets => %w(development test))) 8 | # If you want your assets lazily compiled in production, use this line 9 | # Bundler.require(:default, :assets, Rails.env) 10 | end 11 | 12 | module RailsOpenid 13 | class Application < Rails::Application 14 | # Settings in config/environments/* take precedence over those specified here. 15 | # Application configuration should go into files in config/initializers 16 | # -- all .rb files in that directory are automatically loaded. 17 | 18 | # Custom directories with classes and modules you want to be autoloadable. 19 | # config.autoload_paths += %W(#{config.root}/extras) 20 | 21 | # Only load the plugins named here, in the order given (default is alphabetical). 22 | # :all can be used as a placeholder for all plugins not explicitly named. 23 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 24 | 25 | # Activate observers that should always be running. 26 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 27 | 28 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 29 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 30 | # config.time_zone = 'Central Time (US & Canada)' 31 | 32 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 33 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 34 | # config.i18n.default_locale = :de 35 | 36 | # Configure the default encoding used in templates for Ruby 1.9. 37 | config.encoding = "utf-8" 38 | 39 | # Configure sensitive parameters which will be filtered from the log file. 40 | config.filter_parameters += [:password] 41 | 42 | # Enable escaping HTML in JSON. 43 | config.active_support.escape_html_entities_in_json = true 44 | 45 | # Use SQL instead of Active Record's schema dumper when creating the database. 46 | # This is necessary if your schema can't be completely dumped by the schema dumper, 47 | # like if you have constraints or database-specific column types 48 | # config.active_record.schema_format = :sql 49 | 50 | # Enforce whitelist mode for mass assignment. 51 | # This will create an empty whitelist of attributes available for mass-assignment for all models 52 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible 53 | # parameters by using an attr_accessible or attr_protected declaration. 54 | config.active_record.whitelist_attributes = true 55 | 56 | # Enable the asset pipeline 57 | config.assets.enabled = true 58 | 59 | # Version of your assets, change this if you want to expire all your assets 60 | config.assets.version = '1.0' 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /examples/rails_openid/config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | -------------------------------------------------------------------------------- /examples/rails_openid/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | development: 7 | adapter: sqlite3 8 | database: db/development.sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | # Warning: The database defined as "test" will be erased and 13 | # re-generated from your development database when you run "rake". 14 | # Do not set this db to the same as development or production. 15 | test: 16 | adapter: sqlite3 17 | database: db/test.sqlite3 18 | pool: 5 19 | timeout: 5000 20 | 21 | production: 22 | adapter: sqlite3 23 | database: db/production.sqlite3 24 | pool: 5 25 | timeout: 5000 26 | -------------------------------------------------------------------------------- /examples/rails_openid/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | RailsOpenid::Application.initialize! 6 | -------------------------------------------------------------------------------- /examples/rails_openid/config/environments/development.rb: -------------------------------------------------------------------------------- 1 | RailsOpenid::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 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.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger 20 | config.active_support.deprecation = :log 21 | 22 | # Only use best-standards-support built into browsers 23 | config.action_dispatch.best_standards_support = :builtin 24 | 25 | # Raise exception on mass assignment protection for Active Record models 26 | config.active_record.mass_assignment_sanitizer = :strict 27 | 28 | # Log the query plan for queries taking more than this (works 29 | # with SQLite, MySQL, and PostgreSQL) 30 | config.active_record.auto_explain_threshold_in_seconds = 0.5 31 | 32 | # Do not compress assets 33 | config.assets.compress = false 34 | 35 | # Expands the lines which load the assets 36 | config.assets.debug = true 37 | end 38 | -------------------------------------------------------------------------------- /examples/rails_openid/config/environments/production.rb: -------------------------------------------------------------------------------- 1 | RailsOpenid::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # Code is not reloaded between requests 5 | config.cache_classes = true 6 | 7 | # Full error reports are disabled and caching is turned on 8 | config.consider_all_requests_local = false 9 | config.action_controller.perform_caching = true 10 | 11 | # Disable Rails's static asset server (Apache or nginx will already do this) 12 | config.serve_static_assets = false 13 | 14 | # Compress JavaScripts and CSS 15 | config.assets.compress = true 16 | 17 | # Don't fallback to assets pipeline if a precompiled asset is missed 18 | config.assets.compile = false 19 | 20 | # Generate digests for assets URLs 21 | config.assets.digest = true 22 | 23 | # Defaults to nil and saved in location specified by config.assets.prefix 24 | # config.assets.manifest = YOUR_PATH 25 | 26 | # Specifies the header that your server uses for sending files 27 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 28 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 29 | 30 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 31 | # config.force_ssl = true 32 | 33 | # See everything in the log (default is :info) 34 | # config.log_level = :debug 35 | 36 | # Prepend all log lines with the following tags 37 | # config.log_tags = [ :subdomain, :uuid ] 38 | 39 | # Use a different logger for distributed setups 40 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 41 | 42 | # Use a different cache store in production 43 | # config.cache_store = :mem_cache_store 44 | 45 | # Enable serving of images, stylesheets, and JavaScripts from an asset server 46 | # config.action_controller.asset_host = "http://assets.example.com" 47 | 48 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) 49 | # config.assets.precompile += %w( search.js ) 50 | 51 | # Disable delivery errors, bad email addresses will be ignored 52 | # config.action_mailer.raise_delivery_errors = false 53 | 54 | # Enable threaded mode 55 | # config.threadsafe! 56 | 57 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 58 | # the I18n.default_locale when a translation can not be found) 59 | config.i18n.fallbacks = true 60 | 61 | # Send deprecation notices to registered listeners 62 | config.active_support.deprecation = :notify 63 | 64 | # Log the query plan for queries taking more than this (works 65 | # with SQLite, MySQL, and PostgreSQL) 66 | # config.active_record.auto_explain_threshold_in_seconds = 0.5 67 | end 68 | -------------------------------------------------------------------------------- /examples/rails_openid/config/environments/test.rb: -------------------------------------------------------------------------------- 1 | RailsOpenid::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Configure static asset server for tests with Cache-Control for performance 11 | config.serve_static_assets = true 12 | config.static_cache_control = "public, max-age=3600" 13 | 14 | # Log error messages when you accidentally call methods on nil 15 | config.whiny_nils = true 16 | 17 | # Show full error reports and disable caching 18 | config.consider_all_requests_local = true 19 | config.action_controller.perform_caching = false 20 | 21 | # Raise exceptions instead of rendering exception templates 22 | config.action_dispatch.show_exceptions = false 23 | 24 | # Disable request forgery protection in test environment 25 | config.action_controller.allow_forgery_protection = false 26 | 27 | # Tell Action Mailer not to deliver emails to the real world. 28 | # The :test delivery method accumulates sent emails in the 29 | # ActionMailer::Base.deliveries array. 30 | config.action_mailer.delivery_method = :test 31 | 32 | # Raise exception on mass assignment protection for Active Record models 33 | config.active_record.mass_assignment_sanitizer = :strict 34 | 35 | # Print deprecation notices to the stderr 36 | config.active_support.deprecation = :stderr 37 | end 38 | -------------------------------------------------------------------------------- /examples/rails_openid/config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /examples/rails_openid/config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | # 12 | # These inflection rules are supported but not enabled by default: 13 | # ActiveSupport::Inflector.inflections do |inflect| 14 | # inflect.acronym 'RESTful' 15 | # end 16 | -------------------------------------------------------------------------------- /examples/rails_openid/config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /examples/rails_openid/config/initializers/rails_root.rb: -------------------------------------------------------------------------------- 1 | ::RAILS_ROOT = Rails.root 2 | -------------------------------------------------------------------------------- /examples/rails_openid/config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | # Make sure the secret is at least 30 characters and all random, 6 | # no regular words or you'll be exposed to dictionary attacks. 7 | RailsOpenid::Application.config.secret_token = '2314c4d00e3702d446505b8df2732c433379a0d61ac94c32a25f71612ab6df457bc9979eb32cae28ad6feacdd5a9ae7ac330934c5fb53877e02ce8e23ac0f494' 8 | -------------------------------------------------------------------------------- /examples/rails_openid/config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | RailsOpenid::Application.config.session_store :cookie_store, :key => '_rails_openid_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # RailsOpenid::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /examples/rails_openid/config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters :format => [:json] 9 | end 10 | 11 | # Disable root element in JSON by default. 12 | ActiveSupport.on_load(:active_record) do 13 | self.include_root_in_json = false 14 | end 15 | -------------------------------------------------------------------------------- /examples/rails_openid/config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /examples/rails_openid/config/routes.rb: -------------------------------------------------------------------------------- 1 | RailsOpenid::Application.routes.draw do 2 | root :controller => 'login', :action => :index 3 | match 'server/xrds', :controller => 'server', :action => 'idp_xrds' 4 | match 'user/:username', :controller => 'server', :action => 'user_page' 5 | match 'user/:username/xrds', :controller => 'server', :action => 'user_xrds' 6 | 7 | # Allow downloading Web Service WSDL as a file with an extension 8 | # instead of a file named 'wsdl' 9 | match ':controller/service.wsdl', :action => 'wsdl' 10 | 11 | # Install the default route as the lowest priority. 12 | match ':controller/:action/:id' 13 | 14 | 15 | # The priority is based upon order of creation: 16 | # first created -> highest priority. 17 | 18 | # Sample of regular route: 19 | # match 'products/:id' => 'catalog#view' 20 | # Keep in mind you can assign values other than :controller and :action 21 | 22 | # Sample of named route: 23 | # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase 24 | # This route can be invoked with purchase_url(:id => product.id) 25 | 26 | # Sample resource route (maps HTTP verbs to controller actions automatically): 27 | # resources :products 28 | 29 | # Sample resource route with options: 30 | # resources :products do 31 | # member do 32 | # get 'short' 33 | # post 'toggle' 34 | # end 35 | # 36 | # collection do 37 | # get 'sold' 38 | # end 39 | # end 40 | 41 | # Sample resource route with sub-resources: 42 | # resources :products do 43 | # resources :comments, :sales 44 | # resource :seller 45 | # end 46 | 47 | # Sample resource route with more complex sub-resources 48 | # resources :products do 49 | # resources :comments 50 | # resources :sales do 51 | # get 'recent', :on => :collection 52 | # end 53 | # end 54 | 55 | # Sample resource route within a namespace: 56 | # namespace :admin do 57 | # # Directs /admin/products/* to Admin::ProductsController 58 | # # (app/controllers/admin/products_controller.rb) 59 | # resources :products 60 | # end 61 | 62 | # You can have the root of your site routed with "root" 63 | # just remember to delete public/index.html. 64 | # root :to => 'welcome#index' 65 | 66 | # See how all your routes lay out with "rake routes" 67 | 68 | # This is a legacy wild controller route that's not recommended for RESTful applications. 69 | # Note: This route will make all actions in every controller accessible via GET requests. 70 | match ':controller(/:action(/:id))(.:format)' 71 | end 72 | -------------------------------------------------------------------------------- /examples/rails_openid/db/development.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/ruby-openid/13a88ad6442133a613d2b7d6601991a84b34630d/examples/rails_openid/db/development.sqlite3 -------------------------------------------------------------------------------- /examples/rails_openid/db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) 7 | # Mayor.create(:name => 'Emanuel', :city => cities.first) 8 | -------------------------------------------------------------------------------- /examples/rails_openid/doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | Use this README file to introduce your application and point to useful places in the API for learning more. 2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 3 | -------------------------------------------------------------------------------- /examples/rails_openid/lib/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/ruby-openid/13a88ad6442133a613d2b7d6601991a84b34630d/examples/rails_openid/lib/assets/.gitkeep -------------------------------------------------------------------------------- /examples/rails_openid/lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/ruby-openid/13a88ad6442133a613d2b7d6601991a84b34630d/examples/rails_openid/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /examples/rails_openid/log/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openid/ruby-openid/13a88ad6442133a613d2b7d6601991a84b34630d/examples/rails_openid/log/.gitkeep -------------------------------------------------------------------------------- /examples/rails_openid/public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |You may have mistyped the address or the page may have moved.
24 |Maybe you tried to change something you didn't have access to.
24 |