mongo_session_store-rails5 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.bundle/install.log +768 -0
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.travis.yml +21 -0
- data/Gemfile +67 -0
- data/README.md +133 -0
- data/Rakefile +93 -0
- data/lib/mongo_session_store-rails3.rb +1 -0
- data/lib/mongo_session_store-rails4.rb +1 -0
- data/lib/mongo_session_store-rails5.rb +1 -0
- data/lib/mongo_session_store.rb +49 -0
- data/lib/mongo_session_store/mongo_mapper_store.rb +22 -0
- data/lib/mongo_session_store/mongo_store.rb +83 -0
- data/lib/mongo_session_store/mongo_store_base.rb +98 -0
- data/lib/mongo_session_store/mongoid_store.rb +57 -0
- data/lib/mongo_session_store/version.rb +3 -0
- data/mongo_session_store-rails3.gemspec +18 -0
- data/mongo_session_store-rails4.gemspec +18 -0
- data/mongo_session_store-rails5.gemspec +20 -0
- data/perf/benchmark.rb +92 -0
- data/release.sh +6 -0
- data/spec/integration_with_devise_spec.rb +89 -0
- data/spec/mongo_store_base_spec.rb +42 -0
- data/spec/rails_3.1_app/.gitignore +5 -0
- data/spec/rails_3.1_app/README +261 -0
- data/spec/rails_3.1_app/Rakefile +7 -0
- data/spec/rails_3.1_app/app/assets/javascripts/application.js +7 -0
- data/spec/rails_3.1_app/app/assets/stylesheets/application.css +7 -0
- data/spec/rails_3.1_app/app/controllers/application_controller.rb +3 -0
- data/spec/rails_3.1_app/app/controllers/home_controller.rb +4 -0
- data/spec/rails_3.1_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_3.1_app/app/mailers/.gitkeep +0 -0
- data/spec/rails_3.1_app/app/models/.gitkeep +0 -0
- data/spec/rails_3.1_app/app/models/user.rb +6 -0
- data/spec/rails_3.1_app/app/views/devise/confirmations/new.html.erb +12 -0
- data/spec/rails_3.1_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/spec/rails_3.1_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/spec/rails_3.1_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/spec/rails_3.1_app/app/views/devise/passwords/edit.html.erb +16 -0
- data/spec/rails_3.1_app/app/views/devise/passwords/new.html.erb +12 -0
- data/spec/rails_3.1_app/app/views/devise/registrations/edit.html.erb +25 -0
- data/spec/rails_3.1_app/app/views/devise/registrations/new.html.erb +18 -0
- data/spec/rails_3.1_app/app/views/devise/sessions/new.html.erb +17 -0
- data/spec/rails_3.1_app/app/views/devise/shared/_links.erb +25 -0
- data/spec/rails_3.1_app/app/views/devise/unlocks/new.html.erb +12 -0
- data/spec/rails_3.1_app/app/views/home/index.html.erb +10 -0
- data/spec/rails_3.1_app/app/views/layouts/application.html.erb +15 -0
- data/spec/rails_3.1_app/config.ru +4 -0
- data/spec/rails_3.1_app/config/application.rb +47 -0
- data/spec/rails_3.1_app/config/boot.rb +6 -0
- data/spec/rails_3.1_app/config/database.yml +11 -0
- data/spec/rails_3.1_app/config/environment.rb +5 -0
- data/spec/rails_3.1_app/config/environments/development.rb +27 -0
- data/spec/rails_3.1_app/config/environments/production.rb +54 -0
- data/spec/rails_3.1_app/config/environments/test.rb +39 -0
- data/spec/rails_3.1_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_3.1_app/config/initializers/devise.rb +201 -0
- data/spec/rails_3.1_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_3.1_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_3.1_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails_3.1_app/config/initializers/session_store.rb +9 -0
- data/spec/rails_3.1_app/config/initializers/wrap_parameters.rb +12 -0
- data/spec/rails_3.1_app/config/locales/devise.en.yml +55 -0
- data/spec/rails_3.1_app/config/locales/en.yml +5 -0
- data/spec/rails_3.1_app/config/mongo.yml +18 -0
- data/spec/rails_3.1_app/config/mongoid.yml +13 -0
- data/spec/rails_3.1_app/config/routes.rb +4 -0
- data/spec/rails_3.1_app/db/migrate/20120222195914_create_users_table.rb +12 -0
- data/spec/rails_3.1_app/db/schema.rb +20 -0
- data/spec/rails_3.1_app/lib/tasks/.gitkeep +0 -0
- data/spec/rails_3.1_app/log/.gitkeep +0 -0
- data/spec/rails_3.1_app/public/404.html +26 -0
- data/spec/rails_3.1_app/public/422.html +26 -0
- data/spec/rails_3.1_app/public/500.html +26 -0
- data/spec/rails_3.1_app/public/favicon.ico +0 -0
- data/spec/rails_3.1_app/public/robots.txt +5 -0
- data/spec/rails_3.1_app/script/rails +6 -0
- data/spec/rails_3.1_app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/rails_3.1_app/vendor/plugins/.gitkeep +0 -0
- data/spec/rails_3.2_app/.gitignore +5 -0
- data/spec/rails_3.2_app/README +261 -0
- data/spec/rails_3.2_app/Rakefile +7 -0
- data/spec/rails_3.2_app/app/assets/javascripts/application.js +7 -0
- data/spec/rails_3.2_app/app/assets/stylesheets/application.css +7 -0
- data/spec/rails_3.2_app/app/controllers/application_controller.rb +3 -0
- data/spec/rails_3.2_app/app/controllers/home_controller.rb +4 -0
- data/spec/rails_3.2_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_3.2_app/app/mailers/.gitkeep +0 -0
- data/spec/rails_3.2_app/app/models/.gitkeep +0 -0
- data/spec/rails_3.2_app/app/models/user.rb +6 -0
- data/spec/rails_3.2_app/app/views/devise/confirmations/new.html.erb +12 -0
- data/spec/rails_3.2_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/spec/rails_3.2_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/spec/rails_3.2_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/spec/rails_3.2_app/app/views/devise/passwords/edit.html.erb +16 -0
- data/spec/rails_3.2_app/app/views/devise/passwords/new.html.erb +12 -0
- data/spec/rails_3.2_app/app/views/devise/registrations/edit.html.erb +25 -0
- data/spec/rails_3.2_app/app/views/devise/registrations/new.html.erb +18 -0
- data/spec/rails_3.2_app/app/views/devise/sessions/new.html.erb +17 -0
- data/spec/rails_3.2_app/app/views/devise/shared/_links.erb +25 -0
- data/spec/rails_3.2_app/app/views/devise/unlocks/new.html.erb +12 -0
- data/spec/rails_3.2_app/app/views/home/index.html.erb +10 -0
- data/spec/rails_3.2_app/app/views/layouts/application.html.erb +15 -0
- data/spec/rails_3.2_app/config.ru +4 -0
- data/spec/rails_3.2_app/config/application.rb +47 -0
- data/spec/rails_3.2_app/config/boot.rb +6 -0
- data/spec/rails_3.2_app/config/database.yml +11 -0
- data/spec/rails_3.2_app/config/environment.rb +5 -0
- data/spec/rails_3.2_app/config/environments/development.rb +27 -0
- data/spec/rails_3.2_app/config/environments/production.rb +54 -0
- data/spec/rails_3.2_app/config/environments/test.rb +39 -0
- data/spec/rails_3.2_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_3.2_app/config/initializers/devise.rb +203 -0
- data/spec/rails_3.2_app/config/initializers/inflections.rb +10 -0
- data/spec/rails_3.2_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_3.2_app/config/initializers/secret_token.rb +7 -0
- data/spec/rails_3.2_app/config/initializers/session_store.rb +9 -0
- data/spec/rails_3.2_app/config/initializers/wrap_parameters.rb +12 -0
- data/spec/rails_3.2_app/config/locales/devise.en.yml +55 -0
- data/spec/rails_3.2_app/config/locales/en.yml +5 -0
- data/spec/rails_3.2_app/config/mongo.yml +18 -0
- data/spec/rails_3.2_app/config/mongoid.yml +13 -0
- data/spec/rails_3.2_app/config/routes.rb +4 -0
- data/spec/rails_3.2_app/db/migrate/20120222195914_create_users_table.rb +12 -0
- data/spec/rails_3.2_app/db/schema.rb +20 -0
- data/spec/rails_3.2_app/lib/tasks/.gitkeep +0 -0
- data/spec/rails_3.2_app/log/.gitkeep +0 -0
- data/spec/rails_3.2_app/public/404.html +26 -0
- data/spec/rails_3.2_app/public/422.html +26 -0
- data/spec/rails_3.2_app/public/500.html +26 -0
- data/spec/rails_3.2_app/public/favicon.ico +0 -0
- data/spec/rails_3.2_app/public/robots.txt +5 -0
- data/spec/rails_3.2_app/script/rails +6 -0
- data/spec/rails_3.2_app/vendor/assets/stylesheets/.gitkeep +0 -0
- data/spec/rails_3.2_app/vendor/plugins/.gitkeep +0 -0
- data/spec/rails_4.0_app/.gitignore +16 -0
- data/spec/rails_4.0_app/Rakefile +6 -0
- data/spec/rails_4.0_app/app/assets/images/.keep +0 -0
- data/spec/rails_4.0_app/app/assets/javascripts/application.js +13 -0
- data/spec/rails_4.0_app/app/assets/stylesheets/application.css +13 -0
- data/spec/rails_4.0_app/app/controllers/application_controller.rb +5 -0
- data/spec/rails_4.0_app/app/controllers/concerns/.keep +0 -0
- data/spec/rails_4.0_app/app/controllers/home_controller.rb +4 -0
- data/spec/rails_4.0_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_4.0_app/app/mailers/.keep +0 -0
- data/spec/rails_4.0_app/app/models/.keep +0 -0
- data/spec/rails_4.0_app/app/models/concerns/.keep +0 -0
- data/spec/rails_4.0_app/app/models/user.rb +5 -0
- data/spec/rails_4.0_app/app/views/devise/confirmations/new.html.erb +12 -0
- data/spec/rails_4.0_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/spec/rails_4.0_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/spec/rails_4.0_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/spec/rails_4.0_app/app/views/devise/passwords/edit.html.erb +16 -0
- data/spec/rails_4.0_app/app/views/devise/passwords/new.html.erb +12 -0
- data/spec/rails_4.0_app/app/views/devise/registrations/edit.html.erb +29 -0
- data/spec/rails_4.0_app/app/views/devise/registrations/new.html.erb +18 -0
- data/spec/rails_4.0_app/app/views/devise/sessions/new.html.erb +17 -0
- data/spec/rails_4.0_app/app/views/devise/shared/_links.erb +25 -0
- data/spec/rails_4.0_app/app/views/devise/unlocks/new.html.erb +12 -0
- data/spec/rails_4.0_app/app/views/home/index.html.erb +10 -0
- data/spec/rails_4.0_app/app/views/layouts/application.html.erb +17 -0
- data/spec/rails_4.0_app/bin/bundle +3 -0
- data/spec/rails_4.0_app/bin/rails +4 -0
- data/spec/rails_4.0_app/bin/rake +4 -0
- data/spec/rails_4.0_app/config.ru +4 -0
- data/spec/rails_4.0_app/config/application.rb +26 -0
- data/spec/rails_4.0_app/config/boot.rb +4 -0
- data/spec/rails_4.0_app/config/database.yml +11 -0
- data/spec/rails_4.0_app/config/environment.rb +5 -0
- data/spec/rails_4.0_app/config/environments/development.rb +29 -0
- data/spec/rails_4.0_app/config/environments/production.rb +80 -0
- data/spec/rails_4.0_app/config/environments/test.rb +36 -0
- data/spec/rails_4.0_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_4.0_app/config/initializers/devise.rb +254 -0
- data/spec/rails_4.0_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/rails_4.0_app/config/initializers/inflections.rb +16 -0
- data/spec/rails_4.0_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_4.0_app/config/initializers/secret_token.rb +12 -0
- data/spec/rails_4.0_app/config/initializers/session_store.rb +5 -0
- data/spec/rails_4.0_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails_4.0_app/config/locales/devise.en.yml +59 -0
- data/spec/rails_4.0_app/config/locales/en.yml +23 -0
- data/spec/rails_4.0_app/config/mongo.yml +11 -0
- data/spec/rails_4.0_app/config/mongoid.yml +13 -0
- data/spec/rails_4.0_app/config/routes.rb +4 -0
- data/spec/rails_4.0_app/db/migrate/20140301171212_add_devise_users.rb +11 -0
- data/spec/rails_4.0_app/db/schema.rb +25 -0
- data/spec/rails_4.0_app/db/seeds.rb +7 -0
- data/spec/rails_4.0_app/lib/assets/.keep +0 -0
- data/spec/rails_4.0_app/lib/tasks/.keep +0 -0
- data/spec/rails_4.0_app/log/.keep +0 -0
- data/spec/rails_4.0_app/public/404.html +58 -0
- data/spec/rails_4.0_app/public/422.html +58 -0
- data/spec/rails_4.0_app/public/500.html +57 -0
- data/spec/rails_4.0_app/public/favicon.ico +0 -0
- data/spec/rails_4.0_app/public/robots.txt +5 -0
- data/spec/rails_4.1_app/.gitignore +16 -0
- data/spec/rails_4.1_app/Rakefile +6 -0
- data/spec/rails_4.1_app/app/assets/images/.keep +0 -0
- data/spec/rails_4.1_app/app/assets/javascripts/application.js +13 -0
- data/spec/rails_4.1_app/app/assets/stylesheets/application.css +15 -0
- data/spec/rails_4.1_app/app/controllers/application_controller.rb +5 -0
- data/spec/rails_4.1_app/app/controllers/concerns/.keep +0 -0
- data/spec/rails_4.1_app/app/controllers/home_controller.rb +4 -0
- data/spec/rails_4.1_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_4.1_app/app/mailers/.keep +0 -0
- data/spec/rails_4.1_app/app/models/.keep +0 -0
- data/spec/rails_4.1_app/app/models/concerns/.keep +0 -0
- data/spec/rails_4.1_app/app/models/user.rb +5 -0
- data/spec/rails_4.1_app/app/views/devise/confirmations/new.html.erb +12 -0
- data/spec/rails_4.1_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/spec/rails_4.1_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/spec/rails_4.1_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/spec/rails_4.1_app/app/views/devise/passwords/edit.html.erb +16 -0
- data/spec/rails_4.1_app/app/views/devise/passwords/new.html.erb +12 -0
- data/spec/rails_4.1_app/app/views/devise/registrations/edit.html.erb +29 -0
- data/spec/rails_4.1_app/app/views/devise/registrations/new.html.erb +18 -0
- data/spec/rails_4.1_app/app/views/devise/sessions/new.html.erb +17 -0
- data/spec/rails_4.1_app/app/views/devise/shared/_links.erb +25 -0
- data/spec/rails_4.1_app/app/views/devise/unlocks/new.html.erb +12 -0
- data/spec/rails_4.1_app/app/views/home/index.html.erb +10 -0
- data/spec/rails_4.1_app/app/views/layouts/application.html.erb +17 -0
- data/spec/rails_4.1_app/bin/bundle +3 -0
- data/spec/rails_4.1_app/bin/rails +8 -0
- data/spec/rails_4.1_app/bin/rake +8 -0
- data/spec/rails_4.1_app/bin/spring +18 -0
- data/spec/rails_4.1_app/config.ru +4 -0
- data/spec/rails_4.1_app/config/application.rb +23 -0
- data/spec/rails_4.1_app/config/boot.rb +4 -0
- data/spec/rails_4.1_app/config/database.yml +11 -0
- data/spec/rails_4.1_app/config/environment.rb +5 -0
- data/spec/rails_4.1_app/config/environments/development.rb +37 -0
- data/spec/rails_4.1_app/config/environments/production.rb +83 -0
- data/spec/rails_4.1_app/config/environments/test.rb +39 -0
- data/spec/rails_4.1_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_4.1_app/config/initializers/cookies_serializer.rb +3 -0
- data/spec/rails_4.1_app/config/initializers/devise.rb +254 -0
- data/spec/rails_4.1_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/rails_4.1_app/config/initializers/inflections.rb +16 -0
- data/spec/rails_4.1_app/config/initializers/mime_types.rb +5 -0
- data/spec/rails_4.1_app/config/initializers/session_store.rb +5 -0
- data/spec/rails_4.1_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails_4.1_app/config/locales/devise.en.yml +59 -0
- data/spec/rails_4.1_app/config/locales/en.yml +23 -0
- data/spec/rails_4.1_app/config/mongo.yml +11 -0
- data/spec/rails_4.1_app/config/mongoid.yml +13 -0
- data/spec/rails_4.1_app/config/routes.rb +4 -0
- data/spec/rails_4.1_app/config/secrets.yml +22 -0
- data/spec/rails_4.1_app/db/migrate/20140301171212_add_devise_users.rb +11 -0
- data/spec/rails_4.1_app/db/schema.rb +25 -0
- data/spec/rails_4.1_app/db/seeds.rb +7 -0
- data/spec/rails_4.1_app/lib/assets/.keep +0 -0
- data/spec/rails_4.1_app/lib/tasks/.keep +0 -0
- data/spec/rails_4.1_app/log/.keep +0 -0
- data/spec/rails_4.1_app/public/404.html +67 -0
- data/spec/rails_4.1_app/public/422.html +67 -0
- data/spec/rails_4.1_app/public/500.html +66 -0
- data/spec/rails_4.1_app/public/favicon.ico +0 -0
- data/spec/rails_4.1_app/public/robots.txt +5 -0
- data/spec/rails_4.2_app/.gitignore +17 -0
- data/spec/rails_4.2_app/Rakefile +6 -0
- data/spec/rails_4.2_app/app/assets/images/.keep +0 -0
- data/spec/rails_4.2_app/app/assets/javascripts/application.js +13 -0
- data/spec/rails_4.2_app/app/assets/stylesheets/application.css +15 -0
- data/spec/rails_4.2_app/app/controllers/application_controller.rb +5 -0
- data/spec/rails_4.2_app/app/controllers/concerns/.keep +0 -0
- data/spec/rails_4.2_app/app/controllers/home_controller.rb +4 -0
- data/spec/rails_4.2_app/app/helpers/application_helper.rb +2 -0
- data/spec/rails_4.2_app/app/mailers/.keep +0 -0
- data/spec/rails_4.2_app/app/models/.keep +0 -0
- data/spec/rails_4.2_app/app/models/concerns/.keep +0 -0
- data/spec/rails_4.2_app/app/models/user.rb +5 -0
- data/spec/rails_4.2_app/app/views/devise/confirmations/new.html.erb +12 -0
- data/spec/rails_4.2_app/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/spec/rails_4.2_app/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/spec/rails_4.2_app/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/spec/rails_4.2_app/app/views/devise/passwords/edit.html.erb +16 -0
- data/spec/rails_4.2_app/app/views/devise/passwords/new.html.erb +12 -0
- data/spec/rails_4.2_app/app/views/devise/registrations/edit.html.erb +29 -0
- data/spec/rails_4.2_app/app/views/devise/registrations/new.html.erb +18 -0
- data/spec/rails_4.2_app/app/views/devise/sessions/new.html.erb +17 -0
- data/spec/rails_4.2_app/app/views/devise/shared/_links.erb +25 -0
- data/spec/rails_4.2_app/app/views/devise/unlocks/new.html.erb +12 -0
- data/spec/rails_4.2_app/app/views/home/index.html.erb +10 -0
- data/spec/rails_4.2_app/app/views/layouts/application.html.erb +17 -0
- data/spec/rails_4.2_app/bin/bundle +3 -0
- data/spec/rails_4.2_app/bin/rails +8 -0
- data/spec/rails_4.2_app/bin/rake +8 -0
- data/spec/rails_4.2_app/bin/setup +29 -0
- data/spec/rails_4.2_app/bin/spring +15 -0
- data/spec/rails_4.2_app/config.ru +4 -0
- data/spec/rails_4.2_app/config/application.rb +26 -0
- data/spec/rails_4.2_app/config/boot.rb +3 -0
- data/spec/rails_4.2_app/config/database.yml +11 -0
- data/spec/rails_4.2_app/config/environment.rb +5 -0
- data/spec/rails_4.2_app/config/environments/development.rb +41 -0
- data/spec/rails_4.2_app/config/environments/production.rb +79 -0
- data/spec/rails_4.2_app/config/environments/test.rb +42 -0
- data/spec/rails_4.2_app/config/initializers/assets.rb +11 -0
- data/spec/rails_4.2_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/rails_4.2_app/config/initializers/cookies_serializer.rb +3 -0
- data/spec/rails_4.2_app/config/initializers/devise.rb +254 -0
- data/spec/rails_4.2_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/rails_4.2_app/config/initializers/inflections.rb +16 -0
- data/spec/rails_4.2_app/config/initializers/mime_types.rb +4 -0
- data/spec/rails_4.2_app/config/initializers/session_store.rb +5 -0
- data/spec/rails_4.2_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/rails_4.2_app/config/locales/en.yml +23 -0
- data/spec/rails_4.2_app/config/mongo.yml +11 -0
- data/spec/rails_4.2_app/config/mongoid.yml +13 -0
- data/spec/rails_4.2_app/config/routes.rb +4 -0
- data/spec/rails_4.2_app/config/secrets.yml +22 -0
- data/spec/rails_4.2_app/db/migrate/20140301171212_add_devise_users.rb +11 -0
- data/spec/rails_4.2_app/db/schema.rb +25 -0
- data/spec/rails_4.2_app/db/seeds.rb +7 -0
- data/spec/rails_4.2_app/lib/assets/.keep +0 -0
- data/spec/rails_4.2_app/lib/tasks/.keep +0 -0
- data/spec/rails_4.2_app/log/.keep +0 -0
- data/spec/rails_4.2_app/public/404.html +67 -0
- data/spec/rails_4.2_app/public/422.html +67 -0
- data/spec/rails_4.2_app/public/500.html +66 -0
- data/spec/rails_4.2_app/public/favicon.ico +0 -0
- data/spec/rails_4.2_app/public/robots.txt +5 -0
- data/spec/rails_helper.rb +47 -0
- data/spec/spec_helper.rb +5 -0
- metadata +409 -0
@@ -0,0 +1,98 @@
|
|
1
|
+
require 'action_dispatch/middleware/session/abstract_store'
|
2
|
+
|
3
|
+
module ActionDispatch
|
4
|
+
module Session
|
5
|
+
class MongoStoreBase < AbstractStore
|
6
|
+
|
7
|
+
SESSION_RECORD_KEY = Rack::RACK_SESSION
|
8
|
+
begin
|
9
|
+
ENV_SESSION_OPTIONS_KEY = Rack::RACK_SESSION_OPTIONS
|
10
|
+
rescue NameError
|
11
|
+
# Rack 1.2.x has access to the ENV_SESSION_OPTIONS_KEY
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.session_class
|
15
|
+
self::Session
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def session_class
|
20
|
+
self.class.session_class
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_sid
|
24
|
+
# 20 random bytes in url-safe base64
|
25
|
+
SecureRandom.base64(20).gsub('=','').gsub('+','-').gsub('/','_')
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_session(env, sid)
|
29
|
+
sid, record = find_or_initialize_session(sid)
|
30
|
+
env[SESSION_RECORD_KEY] = record
|
31
|
+
[sid, unpack(record.data)]
|
32
|
+
end
|
33
|
+
|
34
|
+
def find_session(env, sid)
|
35
|
+
get_session(env, sid)
|
36
|
+
end
|
37
|
+
|
38
|
+
def set_session(env, sid, session_data, options = {})
|
39
|
+
id, record = get_session_record(env, sid)
|
40
|
+
record.data = pack(session_data)
|
41
|
+
# Rack spec dictates that set_session should return true or false
|
42
|
+
# depending on whether or not the session was saved or not.
|
43
|
+
# However, ActionPack seems to want a session id instead.
|
44
|
+
record.save ? id : false
|
45
|
+
end
|
46
|
+
|
47
|
+
def write_session(env, sid, session_data, options = {})
|
48
|
+
set_session(env, sid, session_data, options)
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def find_or_initialize_session(sid)
|
53
|
+
session = (sid && session_class.where(:_id => sid).first) || session_class.new(:_id => generate_sid)
|
54
|
+
[session._id, session]
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_session_record(env, sid)
|
58
|
+
if env.env[ENV_SESSION_OPTIONS_KEY][:id].nil? || !env[SESSION_RECORD_KEY]
|
59
|
+
sid, env[SESSION_RECORD_KEY] = find_or_initialize_session(sid)
|
60
|
+
end
|
61
|
+
|
62
|
+
[sid, env[SESSION_RECORD_KEY]]
|
63
|
+
end
|
64
|
+
|
65
|
+
def delete_session(env, sid, options)
|
66
|
+
destroy_session(env, sid, options)
|
67
|
+
end
|
68
|
+
|
69
|
+
def destroy_session(env, sid, options)
|
70
|
+
unless options[:renew]
|
71
|
+
destroy(env)
|
72
|
+
generate_sid if !options[:drop] or options[:renew]
|
73
|
+
else
|
74
|
+
sid
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def destroy(env)
|
79
|
+
if sid = current_session_id(env)
|
80
|
+
_, record = get_session_record(env, sid)
|
81
|
+
record.destroy
|
82
|
+
env[SESSION_RECORD_KEY] = nil
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def pack(data)
|
87
|
+
Marshal.dump(data)
|
88
|
+
end
|
89
|
+
|
90
|
+
def unpack(packed)
|
91
|
+
return nil unless packed
|
92
|
+
data = packed.respond_to?(:data) ? packed.data : packed.to_s
|
93
|
+
Marshal.load(StringIO.new(data))
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'mongoid'
|
2
|
+
require 'mongo_session_store/mongo_store_base'
|
3
|
+
|
4
|
+
module ActionDispatch
|
5
|
+
module Session
|
6
|
+
class MongoidStore < MongoStoreBase
|
7
|
+
BINARY_CLASS = defined?(Moped::BSON::Binary) ? Moped::BSON::Binary : BSON::Binary
|
8
|
+
|
9
|
+
class Session
|
10
|
+
include Mongoid::Document
|
11
|
+
include Mongoid::Timestamps
|
12
|
+
|
13
|
+
store_in :collection => MongoSessionStore.collection_name
|
14
|
+
|
15
|
+
if Mongoid::Fields::Validators::Macro::OPTIONS.include? :overwrite
|
16
|
+
field :_id, :type => String, :overwrite => true
|
17
|
+
else
|
18
|
+
field :_id, :type => String
|
19
|
+
end
|
20
|
+
field :data, :type => BINARY_CLASS, :default => -> { marshaled_binary({}) }
|
21
|
+
attr_accessible :_id, :data if respond_to?(:attr_accessible)
|
22
|
+
|
23
|
+
def marshaled_binary(data)
|
24
|
+
self.class.marshaled_binary(data)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.marshaled_binary(data)
|
28
|
+
if BINARY_CLASS.to_s == 'BSON::Binary'
|
29
|
+
BSON::Binary.new(Marshal.dump(data), :generic)
|
30
|
+
else
|
31
|
+
Moped::BSON::Binary.new(:generic, Marshal.dump(data))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def pack(data)
|
38
|
+
session_class.marshaled_binary(data)
|
39
|
+
end
|
40
|
+
|
41
|
+
def unpack(packed)
|
42
|
+
return nil unless packed
|
43
|
+
Marshal.load(extract_data(packed))
|
44
|
+
end
|
45
|
+
|
46
|
+
def extract_data(packed)
|
47
|
+
if packed.class.to_s == 'BSON::Binary'
|
48
|
+
packed.data
|
49
|
+
else
|
50
|
+
packed.to_s
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
MongoidStore = ActionDispatch::Session::MongoidStore
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path('../lib/mongo_session_store/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = File.basename(__FILE__).gsub(".gemspec", "")
|
5
|
+
s.version = MongoSessionStore::VERSION
|
6
|
+
|
7
|
+
s.authors = ["Brian Hempel", "Nicolas M\303\251rouze", "Tony Pitale", "Chris Brickley"]
|
8
|
+
s.email = ["plasticchicken@gmail.com"]
|
9
|
+
s.files = `git ls-files`.split("\n")
|
10
|
+
s.test_files = `git ls-files -- {test,spec,features,perf}/*`.split("\n")
|
11
|
+
s.homepage = "http://github.com/brianhempel/mongo_session_store"
|
12
|
+
s.license = "MIT"
|
13
|
+
s.require_paths = ["lib"]
|
14
|
+
s.rubygems_version = "1.3.7"
|
15
|
+
s.summary = "Rails session stores for MongoMapper, Mongoid, or any other ODM. Rails 3.1, 3.2, 4.0, 4.1, and 4.2 compatible."
|
16
|
+
|
17
|
+
s.add_dependency "actionpack", ">= 3.1"
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.expand_path('../lib/mongo_session_store/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = File.basename(__FILE__).gsub(".gemspec", "")
|
5
|
+
s.version = MongoSessionStore::VERSION
|
6
|
+
|
7
|
+
s.authors = ["Brian Hempel", "Nicolas M\303\251rouze", "Tony Pitale", "Chris Brickley"]
|
8
|
+
s.email = ["plasticchicken@gmail.com"]
|
9
|
+
s.files = `git ls-files`.split("\n")
|
10
|
+
s.test_files = `git ls-files -- {test,spec,features,perf}/*`.split("\n")
|
11
|
+
s.homepage = "http://github.com/brianhempel/mongo_session_store"
|
12
|
+
s.license = "MIT"
|
13
|
+
s.require_paths = ["lib"]
|
14
|
+
s.rubygems_version = "1.3.7"
|
15
|
+
s.summary = "Rails session stores for MongoMapper, Mongoid, or any other ODM. Rails 3.1, 3.2, 4.0, 4.1, and 4.2 compatible."
|
16
|
+
|
17
|
+
s.add_dependency "actionpack", ">= 3.1"
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require File.expand_path('../lib/mongo_session_store/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = File.basename(__FILE__).gsub(".gemspec", "")
|
5
|
+
s.version = MongoSessionStore::VERSION
|
6
|
+
|
7
|
+
s.authors = ["Alexander Kiseliev", "Brian Hempel", "Nicolas M\303\251rouze", "Tony Pitale", "Chris Brickley"]
|
8
|
+
s.email = ["i43ack@gmail.com", "plasticchicken@gmail.com"]
|
9
|
+
s.files = `git ls-files`.split("\n")
|
10
|
+
s.test_files = `git ls-files -- {test,spec,features,perf}/*`.split("\n")
|
11
|
+
s.homepage = "https://github.com/ack43/mongo_session_store"
|
12
|
+
s.license = "MIT"
|
13
|
+
s.require_paths = ["lib"]
|
14
|
+
s.rubygems_version = "1.3.7"
|
15
|
+
s.summary = "Rails session stores for MongoMapper, Mongoid, or any other ODM. Rails 5.0 compatible."
|
16
|
+
|
17
|
+
s.add_dependency "actionpack", ">= 3.1"
|
18
|
+
|
19
|
+
s.add_dependency 'rails', ['>=5.0', "<6.0"]
|
20
|
+
end
|
data/perf/benchmark.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'benchmark'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'action_dispatch'
|
5
|
+
require File.expand_path('../../lib/mongo_session_store-rails3', __FILE__)
|
6
|
+
|
7
|
+
MongoMapper.database = "test_session_stores"
|
8
|
+
# get around Mongoid's unnecessary "requires MongoDB 2.0.0" error which is NOT triggered when loading from mongo.yml!
|
9
|
+
Mongoid.config.from_hash('database' => "test_session_stores", 'logger' => false)
|
10
|
+
|
11
|
+
RUNS = 2000
|
12
|
+
|
13
|
+
def benchmark(test_name, &block)
|
14
|
+
sleep 2 # cool off for my poor laptop
|
15
|
+
time = Benchmark.realtime do
|
16
|
+
RUNS.times do
|
17
|
+
yield
|
18
|
+
end
|
19
|
+
end
|
20
|
+
puts "#{(time/RUNS*100_000).round / 100.0}ms per #{test_name}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def benchmark_store(store)
|
24
|
+
collection = store.class.session_class.collection
|
25
|
+
collection.remove
|
26
|
+
|
27
|
+
large_session = {
|
28
|
+
:something => "not nothing",
|
29
|
+
:left => "not right",
|
30
|
+
:welcome => "not despised",
|
31
|
+
:visits => [
|
32
|
+
"http://www.google.com",
|
33
|
+
"localhost:3000",
|
34
|
+
"http://localhost:3000/increment_session",
|
35
|
+
"http://www.iso.org/iso/country_codes/iso_3166_code_lists/iso-3166-1_decoding_table.htm",
|
36
|
+
"http://www.geonames.org/search.html?q=2303+australia&country="
|
37
|
+
],
|
38
|
+
:one_k_of_data => "a"*1024,
|
39
|
+
:another_k => "b"*1024,
|
40
|
+
:more_data => [5]*500,
|
41
|
+
:too_much_data_for_a_cookie => "c"*8000,
|
42
|
+
:a_bunch_of_floats_in_embedded_docs => [{:float_a => 3.141, :float_b => -1.1}]*100
|
43
|
+
}
|
44
|
+
|
45
|
+
ids = []
|
46
|
+
|
47
|
+
env = {
|
48
|
+
'rack.session' => large_session,
|
49
|
+
'rack.session.options' => { :id => store.send(:generate_sid) }
|
50
|
+
}
|
51
|
+
benchmark "session save" do
|
52
|
+
id = store.send(:generate_sid)
|
53
|
+
ids << id
|
54
|
+
store.send(:set_session, env.merge({'rack.session.options' => { :id => id }}), id, env['rack.session'])
|
55
|
+
# store.send(:commit_session, env.merge({'rack.session.options' => { :id => ids.last }}), 200, {}, [])
|
56
|
+
end
|
57
|
+
|
58
|
+
ids.shuffle!
|
59
|
+
|
60
|
+
env = {
|
61
|
+
'rack.request.cookie_string' => "",
|
62
|
+
'HTTP_COOKIE' => "",
|
63
|
+
'rack.request.cookie_hash' => { '_session_id' => store.class.session_class.last._id }
|
64
|
+
}
|
65
|
+
benchmark "session load" do
|
66
|
+
id = ids.pop
|
67
|
+
local_env = env.merge({'rack.request.cookie_hash' => { '_session_id' => id }})
|
68
|
+
# store.send(:prepare_session, local_env)
|
69
|
+
sid, data = store.send(:get_session, local_env, id)
|
70
|
+
# something = local_env['rack.session']["something"] # trigger the load
|
71
|
+
raise data.inspect unless data[:something] == "not nothing" && data[:a_bunch_of_floats_in_embedded_docs][0] == {:float_a => 3.141, :float_b => -1.1}
|
72
|
+
end
|
73
|
+
|
74
|
+
stats = collection.stats
|
75
|
+
puts " Total Size: #{stats['size']}"
|
76
|
+
puts " Object count: #{stats['count']}"
|
77
|
+
puts " Average object size: #{stats['avgObjSize']}"
|
78
|
+
puts " Index sizes: #{stats['indexSizes'].inspect}"
|
79
|
+
end
|
80
|
+
|
81
|
+
mongo_mapper_store = MongoMapperStore.new(nil)
|
82
|
+
mongoid_store = MongoidStore.new(nil)
|
83
|
+
mongo_store = MongoStore.new(nil)
|
84
|
+
|
85
|
+
puts "MongoMapperStore..."
|
86
|
+
benchmark_store(mongo_mapper_store)
|
87
|
+
|
88
|
+
puts "MongoidStore..."
|
89
|
+
benchmark_store(mongoid_store)
|
90
|
+
|
91
|
+
puts "MongoStore..."
|
92
|
+
benchmark_store(mongo_store)
|
data/release.sh
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe Devise::SessionsController do
|
4
|
+
def create_user
|
5
|
+
post_data = {
|
6
|
+
'user[email]' => 'person@example.com',
|
7
|
+
'user[password]' => 'secret',
|
8
|
+
'user[password_confirmation]' => 'secret'
|
9
|
+
}
|
10
|
+
post '/users', post_data
|
11
|
+
end
|
12
|
+
|
13
|
+
def login
|
14
|
+
post_data = {
|
15
|
+
'user[email]' => 'person@example.com',
|
16
|
+
'user[password]' => 'secret',
|
17
|
+
'user[password_confirmation]' => 'secret'
|
18
|
+
}
|
19
|
+
post '/users/sign_in', post_data
|
20
|
+
end
|
21
|
+
|
22
|
+
def logout
|
23
|
+
delete '/users/sign_out'
|
24
|
+
end
|
25
|
+
|
26
|
+
def i_should_be_logged_in
|
27
|
+
controller.user_signed_in?.should be_true
|
28
|
+
get '/'
|
29
|
+
response.body.squish.should =~ /You are logged in as person@example.com/
|
30
|
+
end
|
31
|
+
|
32
|
+
def i_should_not_be_logged_in
|
33
|
+
controller.user_signed_in?.should be_false
|
34
|
+
get '/'
|
35
|
+
response.body.squish.should =~ /You are logged out/
|
36
|
+
end
|
37
|
+
|
38
|
+
it "does not explode" do
|
39
|
+
end
|
40
|
+
|
41
|
+
it "allows user creation" do
|
42
|
+
User.count.should == 0
|
43
|
+
create_user
|
44
|
+
response.status.should == 302
|
45
|
+
get response.redirect_url
|
46
|
+
User.count.should == 1
|
47
|
+
response.body.squish.should =~ /You are logged in as person@example.com/
|
48
|
+
response.body.squish.should =~ /You have signed up successfully/
|
49
|
+
end
|
50
|
+
|
51
|
+
it "allows user logout" do
|
52
|
+
create_user
|
53
|
+
i_should_be_logged_in
|
54
|
+
logout
|
55
|
+
response.status.should == 302
|
56
|
+
i_should_not_be_logged_in
|
57
|
+
response.body.squish.should =~ /Signed out successfully/
|
58
|
+
end
|
59
|
+
|
60
|
+
it "allows user login" do
|
61
|
+
create_user
|
62
|
+
logout
|
63
|
+
i_should_not_be_logged_in
|
64
|
+
login
|
65
|
+
response.status.should == 302
|
66
|
+
i_should_be_logged_in
|
67
|
+
response.body.squish.should =~ /Signed in successfully/
|
68
|
+
end
|
69
|
+
|
70
|
+
it "uses the right session store class" do
|
71
|
+
store = Rails.application.config.session_store
|
72
|
+
store.session_class.to_s.should == "ActionDispatch::Session::#{ENV["MONGO_SESSION_STORE_ORM"].camelize}Store::Session"
|
73
|
+
end
|
74
|
+
|
75
|
+
it "stores the session in the sessions collection" do
|
76
|
+
collection = db["sessions"]
|
77
|
+
collection.find.count.should == 0
|
78
|
+
create_user
|
79
|
+
collection.find.count.should == 1
|
80
|
+
end
|
81
|
+
|
82
|
+
it "allows renaming of the collection that stores the sessions" do
|
83
|
+
collection = db["dance_parties"]
|
84
|
+
collection.find.count.should == 0
|
85
|
+
MongoSessionStore.collection_name = "dance_parties"
|
86
|
+
create_user
|
87
|
+
collection.find.count.should == 1
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'securerandom'
|
3
|
+
require 'ostruct'
|
4
|
+
require 'mongo_session_store/mongo_store_base'
|
5
|
+
|
6
|
+
describe ActionDispatch::Session::MongoStoreBase do
|
7
|
+
ENV_SESSION_OPTIONS_KEY = ActionDispatch::Session::MongoStoreBase::ENV_SESSION_OPTIONS_KEY
|
8
|
+
SESSION_RECORD_KEY = ActionDispatch::Session::MongoStoreBase::SESSION_RECORD_KEY
|
9
|
+
|
10
|
+
Session = ActionDispatch::Session::MongoStoreBase::Session = Class.new(OpenStruct)
|
11
|
+
|
12
|
+
before do
|
13
|
+
@app = nil
|
14
|
+
@store = ActionDispatch::Session::MongoStoreBase.new(@app)
|
15
|
+
@env = {}
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#get_session" do
|
19
|
+
it "generates a new session id if given a nil session id" do
|
20
|
+
Session.stub(where: [])
|
21
|
+
|
22
|
+
sid, session_data = @store.send(:get_session, @env, nil)
|
23
|
+
|
24
|
+
sid.should_not == nil
|
25
|
+
session_data.should == nil
|
26
|
+
@env[SESSION_RECORD_KEY].class.should == Session
|
27
|
+
@env[SESSION_RECORD_KEY]._id.should == sid
|
28
|
+
end
|
29
|
+
|
30
|
+
it "generates a new session id if session is not found" do
|
31
|
+
old_sid = SecureRandom.hex
|
32
|
+
Session.stub(where: [])
|
33
|
+
|
34
|
+
sid, session_data = @store.send(:get_session, @env, old_sid)
|
35
|
+
|
36
|
+
sid.should_not == old_sid
|
37
|
+
session_data.should == nil
|
38
|
+
@env[SESSION_RECORD_KEY].class.should == Session
|
39
|
+
@env[SESSION_RECORD_KEY]._id.should == sid
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|