houston-devise_ldap_authenticatable 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/CHANGELOG.md +7 -0
  4. data/Gemfile +8 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +131 -0
  7. data/Rakefile +16 -0
  8. data/devise_ldap_authenticatable.gemspec +34 -0
  9. data/lib/devise_ldap_authenticatable.rb +50 -0
  10. data/lib/devise_ldap_authenticatable/exception.rb +6 -0
  11. data/lib/devise_ldap_authenticatable/ldap_adapter.rb +292 -0
  12. data/lib/devise_ldap_authenticatable/logger.rb +11 -0
  13. data/lib/devise_ldap_authenticatable/model.rb +95 -0
  14. data/lib/devise_ldap_authenticatable/routes.rb +8 -0
  15. data/lib/devise_ldap_authenticatable/schema.rb +14 -0
  16. data/lib/devise_ldap_authenticatable/strategy.rb +19 -0
  17. data/lib/devise_ldap_authenticatable/version.rb +3 -0
  18. data/lib/generators/devise_ldap_authenticatable/install_generator.rb +62 -0
  19. data/lib/generators/devise_ldap_authenticatable/templates/ldap.yml +51 -0
  20. data/spec/ldap/.gitignore +2 -0
  21. data/spec/ldap/base.ldif +73 -0
  22. data/spec/ldap/clear.ldif +26 -0
  23. data/spec/ldap/local.schema +6 -0
  24. data/spec/ldap/openldap-data/.gitignore +2 -0
  25. data/spec/ldap/openldap-data/run/.gitignore +2 -0
  26. data/spec/ldap/openldap-data/run/.gitkeep +0 -0
  27. data/spec/ldap/run-server +31 -0
  28. data/spec/ldap/server.pem +38 -0
  29. data/spec/ldap/slapd-test.conf.erb +107 -0
  30. data/spec/rails_app/Rakefile +7 -0
  31. data/spec/rails_app/app/controllers/application_controller.rb +7 -0
  32. data/spec/rails_app/app/controllers/posts_controller.rb +15 -0
  33. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  34. data/spec/rails_app/app/helpers/posts_helper.rb +2 -0
  35. data/spec/rails_app/app/models/post.rb +2 -0
  36. data/spec/rails_app/app/models/user.rb +10 -0
  37. data/spec/rails_app/app/views/layouts/application.html.erb +26 -0
  38. data/spec/rails_app/app/views/posts/index.html.erb +2 -0
  39. data/spec/rails_app/config.ru +4 -0
  40. data/spec/rails_app/config/application.rb +46 -0
  41. data/spec/rails_app/config/boot.rb +13 -0
  42. data/spec/rails_app/config/cucumber.yml +8 -0
  43. data/spec/rails_app/config/database.yml +25 -0
  44. data/spec/rails_app/config/environment.rb +5 -0
  45. data/spec/rails_app/config/environments/development.rb +21 -0
  46. data/spec/rails_app/config/environments/production.rb +46 -0
  47. data/spec/rails_app/config/environments/test.rb +34 -0
  48. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  49. data/spec/rails_app/config/initializers/devise.rb +242 -0
  50. data/spec/rails_app/config/initializers/inflections.rb +10 -0
  51. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  52. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  53. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  54. data/spec/rails_app/config/ldap.yml +22 -0
  55. data/spec/rails_app/config/ldap_with_boolean_ssl.yml +22 -0
  56. data/spec/rails_app/config/ldap_with_erb.yml +23 -0
  57. data/spec/rails_app/config/ldap_with_uid.yml +18 -0
  58. data/spec/rails_app/config/locales/devise.en.yml +58 -0
  59. data/spec/rails_app/config/locales/en.yml +5 -0
  60. data/spec/rails_app/config/routes.rb +64 -0
  61. data/spec/rails_app/config/ssl_ldap.yml +21 -0
  62. data/spec/rails_app/config/ssl_ldap_with_erb.yml +23 -0
  63. data/spec/rails_app/config/ssl_ldap_with_uid.yml +18 -0
  64. data/spec/rails_app/db/migrate/20100708120448_devise_create_users.rb +40 -0
  65. data/spec/rails_app/db/schema.rb +35 -0
  66. data/spec/rails_app/features/manage_logins.feature +35 -0
  67. data/spec/rails_app/features/step_definitions/login_steps.rb +21 -0
  68. data/spec/rails_app/features/step_definitions/web_steps.rb +219 -0
  69. data/spec/rails_app/features/support/env.rb +58 -0
  70. data/spec/rails_app/features/support/paths.rb +38 -0
  71. data/spec/rails_app/lib/tasks/.gitkeep +0 -0
  72. data/spec/rails_app/lib/tasks/cucumber.rake +53 -0
  73. data/spec/rails_app/public/404.html +26 -0
  74. data/spec/rails_app/public/422.html +26 -0
  75. data/spec/rails_app/public/500.html +26 -0
  76. data/spec/rails_app/public/images/rails.png +0 -0
  77. data/spec/rails_app/public/javascripts/application.js +2 -0
  78. data/spec/rails_app/public/javascripts/controls.js +965 -0
  79. data/spec/rails_app/public/javascripts/dragdrop.js +974 -0
  80. data/spec/rails_app/public/javascripts/effects.js +1123 -0
  81. data/spec/rails_app/public/javascripts/prototype.js +4874 -0
  82. data/spec/rails_app/public/javascripts/rails.js +118 -0
  83. data/spec/rails_app/public/stylesheets/.gitkeep +0 -0
  84. data/spec/rails_app/script/cucumber +10 -0
  85. data/spec/rails_app/script/rails +6 -0
  86. data/spec/spec_helper.rb +47 -0
  87. data/spec/support/factories.rb +16 -0
  88. data/spec/unit/user_spec.rb +298 -0
  89. metadata +411 -0
@@ -0,0 +1,107 @@
1
+ #
2
+ # See slapd.conf(5) for details on configuration options.
3
+ # This file should NOT be world readable.
4
+ #
5
+ <% ldapdir = RUBY_PLATFORM.match(/linux/) ? 'ldap' : 'openldap' %>
6
+ include /etc/<%= ldapdir %>/schema/core.schema
7
+ include /etc/<%= ldapdir %>/schema/cosine.schema
8
+ include /etc/<%= ldapdir %>/schema/inetorgperson.schema
9
+ include /etc/<%= ldapdir %>/schema/nis.schema
10
+
11
+ ## Local definitions
12
+ # include /etc/<%= ldapdir %>/schema/local.schema
13
+ include <%= File.expand_path('local.schema', @conf_root) %>
14
+
15
+ # Allow LDAPv2 client connections. This is NOT the default.
16
+ allow bind_v2
17
+
18
+ # Do not enable referrals until AFTER you have a working directory
19
+ # service AND an understanding of referrals.
20
+ #referral ldap://root.openldap.org
21
+
22
+ pidfile <%= File.expand_path('openldap-data/run/slapd.pid', @conf_root) %>
23
+ argsfile <%= File.expand_path('openldap-data/run/slapd.args', @conf_root) %>
24
+
25
+ # Load dynamic backend modules:
26
+ modulepath /usr/lib/openldap
27
+
28
+ # modules available in openldap-servers-overlays RPM package:
29
+ # moduleload accesslog.la
30
+ # moduleload auditlog.la
31
+ # moduleload denyop.la
32
+ # moduleload dyngroup.la
33
+ # moduleload dynlist.la
34
+ # moduleload lastmod.la
35
+ # moduleload pcache.la
36
+ # moduleload ppolicy.la
37
+ # moduleload refint.la
38
+ # moduleload retcode.la
39
+ # moduleload rwm.la
40
+ # moduleload smbk5pwd.la
41
+ # moduleload syncprov.la
42
+ # moduleload translucent.la
43
+ # moduleload unique.la
44
+ # moduleload valsort.la
45
+
46
+ # modules available in openldap-servers-sql RPM package:
47
+ # moduleload back_sql.la
48
+
49
+ # The next three lines allow use of TLS for encrypting connections using a
50
+ # dummy test certificate which you can generate by changing to
51
+ # /etc/pki/tls/certs, running "make slapd.pem", and fixing permissions on
52
+ # slapd.pem so that the ldap user or group can read it. Your client software
53
+ # may balk at self-signed certificates, however.
54
+
55
+ # ## For LDAPS
56
+ <% if @ssl %>
57
+ TLSCACertificateFile <%= File.expand_path('server.pem', @conf_root) %>
58
+ TLSCertificateFile <%= File.expand_path('server.pem', @conf_root) %>
59
+ TLSCertificateKeyFile <%= File.expand_path('server.pem', @conf_root) %>
60
+ <% else %>
61
+ # TLSCACertificateFile server.pem
62
+ # TLSCertificateFile server.pem
63
+ # TLSCertificateKeyFile server.pem
64
+ <% end %>
65
+ #
66
+ # TLSVerifyClient demand
67
+
68
+ # Sample security restrictions
69
+ # Require integrity protection (prevent hijacking)
70
+ # Require 112-bit (3DES or better) encryption for updates
71
+ # Require 63-bit encryption for simple bind
72
+ # security ssf=1 update_ssf=112 simple_bind=64
73
+
74
+ # Sample access control policy:
75
+ # Root DSE: allow anyone to read it
76
+ # Subschema (sub)entry DSE: allow anyone to read it
77
+ # Other DSEs:
78
+ # Allow self write access
79
+ # Allow authenticated users read access
80
+ # Allow anonymous users to authenticate
81
+ # Directives needed to implement policy:
82
+
83
+ # access to dn.base="dc=esc" by * read
84
+ # access to dn.base="cn=Subschema" by * read
85
+ access to *
86
+ by self write
87
+ by * read
88
+ by anonymous auth
89
+
90
+ #
91
+ # if no access controls are present, the default policy
92
+ # allows anyone and everyone to read anything but restricts
93
+ # updates to rootdn. (e.g., "access to * by * read")
94
+ #
95
+ # rootdn can always read and write EVERYTHING!
96
+
97
+ #######################################################################
98
+ # ldbm and/or bdb database definitions
99
+ #######################################################################
100
+
101
+ database ldif
102
+
103
+ suffix "dc=test,dc=com"
104
+ directory openldap-data
105
+ rootdn "cn=admin,dc=test,dc=com"
106
+ ## rootpw = secret
107
+ rootpw {SSHA}fFjKcZb4cfOAcwSjJer8nCGOEVRUnwCC
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ RailsApp::Application.load_tasks
@@ -0,0 +1,7 @@
1
+ class ApplicationController < ActionController::Base
2
+ rescue_from DeviseLdapAuthenticatable::LdapException do |exception|
3
+ render :text => exception, :status => 500
4
+ end
5
+ protect_from_forgery
6
+ layout 'application'
7
+ end
@@ -0,0 +1,15 @@
1
+ class PostsController < ApplicationController
2
+
3
+ before_filter :authenticate_user!, :except => [:index]
4
+
5
+ def index
6
+ # render :inline => "posts#index", :layout => "application"
7
+ render :text => "posts#index"
8
+ end
9
+
10
+ def new
11
+ # render :inline => "posts#new", :layout => "application"
12
+ render :text => "posts#new"
13
+ end
14
+
15
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module PostsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class Post < ActiveRecord::Base
2
+ end
@@ -0,0 +1,10 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ # Include default devise modules. Others available are:
4
+ # :token_authenticatable, :confirmable, :lockable and :timeoutable
5
+ devise :ldap_authenticatable, :registerable,
6
+ :recoverable, :rememberable, :trackable# , :validatable
7
+
8
+ # Setup accessible (or protected) attributes for your model
9
+ attr_accessible :email, :password, :password_confirmation
10
+ end
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>RailsApp</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <% if user_signed_in? %>
12
+ <%= link_to "sign out", destroy_user_session_path %>
13
+ <% else %>
14
+ <%= link_to "sign in", new_user_session_path %>
15
+ <% end %>
16
+
17
+ <p />
18
+
19
+ <% flash.each do |name, message| %>
20
+ <p id="<%= name %>" class="flash"><%= message %></p>
21
+ <% end %>
22
+
23
+ <%= yield %>
24
+
25
+ </body>
26
+ </html>
@@ -0,0 +1,2 @@
1
+ <h1>Posts#index</h1>
2
+ <p>Find me in app/views/posts/index.html.erb</p>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run RailsApp::Application
@@ -0,0 +1,46 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module RailsApp
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Add additional load paths for your own custom dirs
16
+ # config.load_paths += %W( #{config.root}/extras )
17
+
18
+ # Only load the plugins named here, in the order given (default is alphabetical).
19
+ # :all can be used as a placeholder for all plugins not explicitly named
20
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21
+
22
+ # Activate observers that should always be running
23
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24
+
25
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
+ # config.time_zone = 'Central Time (US & Canada)'
28
+
29
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31
+ # config.i18n.default_locale = :de
32
+
33
+ # Configure generators values. Many other options are available, be sure to check the documentation.
34
+ # config.generators do |g|
35
+ # g.orm :active_record
36
+ # g.template_engine :erb
37
+ # g.test_framework :test_unit, :fixture => true
38
+ # end
39
+
40
+ # Configure the default encoding used in templates for Ruby 1.9.
41
+ config.encoding = "utf-8"
42
+
43
+ # Configure sensitive parameters which will be filtered from the log file.
44
+ config.filter_parameters += [:password]
45
+ end
46
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,8 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
5
+ %>
6
+ default: <%= std_opts %> features
7
+ wip: --tags @wip:3 --wip features
8
+ rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test: &test
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
23
+
24
+ cucumber:
25
+ <<: *test
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ RailsApp::Application.initialize!
@@ -0,0 +1,21 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.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 webserver 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
+ config.active_support.deprecation = :log
19
+
20
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
21
+ end
@@ -0,0 +1,46 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = false
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+ end
@@ -0,0 +1,34 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.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
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ config.active_support.deprecation = :stderr
29
+
30
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
31
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
32
+ # like if you have constraints or database-specific column types
33
+ # config.active_record.schema_format = :sql
34
+ end
@@ -0,0 +1,7 @@
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!
@@ -0,0 +1,242 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # ==> LDAP Configuration
5
+ # config.ldap_logger = true
6
+ # config.ldap_create_user = false
7
+ # config.ldap_update_password = true
8
+ # config.ldap_config = "#{Rails.root}/config/ldap.yml"
9
+ # config.ldap_check_group_membership = false
10
+ # config.ldap_check_attributes = false
11
+ # config.ldap_use_admin_to_bind = false
12
+ # config.ldap_ad_group_check = false
13
+
14
+ # ==> Mailer Configuration
15
+ # Configure the e-mail address which will be shown in Devise::Mailer,
16
+ # note that it will be overwritten if you use your own mailer class with default "from" parameter.
17
+ config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
18
+
19
+ # Configure the class responsible to send e-mails.
20
+ # config.mailer = "Devise::Mailer"
21
+
22
+ # ==> ORM configuration
23
+ # Load and configure the ORM. Supports :active_record (default) and
24
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
25
+ # available as additional gems.
26
+ require 'devise/orm/active_record'
27
+
28
+ # ==> Configuration for any authentication mechanism
29
+ # Configure which keys are used when authenticating a user. The default is
30
+ # just :email. You can configure it to use [:username, :subdomain], so for
31
+ # authenticating a user, both parameters are required. Remember that those
32
+ # parameters are used only when authenticating and not when retrieving from
33
+ # session. If you need permissions, you should implement that in a before filter.
34
+ # You can also supply a hash where the value is a boolean determining whether
35
+ # or not authentication should be aborted when the value is not present.
36
+ # config.authentication_keys = [ :email ]
37
+
38
+ # Configure parameters from the request object used for authentication. Each entry
39
+ # given should be a request method and it will automatically be passed to the
40
+ # find_for_authentication method and considered in your model lookup. For instance,
41
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
42
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
43
+ # config.request_keys = []
44
+
45
+ # Configure which authentication keys should be case-insensitive.
46
+ # These keys will be downcased upon creating or modifying a user and when used
47
+ # to authenticate or find a user. Default is :email.
48
+ config.case_insensitive_keys = [ :email ]
49
+
50
+ # Configure which authentication keys should have whitespace stripped.
51
+ # These keys will have whitespace before and after removed upon creating or
52
+ # modifying a user and when used to authenticate or find a user. Default is :email.
53
+ config.strip_whitespace_keys = [ :email ]
54
+
55
+ # Tell if authentication through request.params is enabled. True by default.
56
+ # It can be set to an array that will enable params authentication only for the
57
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
58
+ # enable it only for database (email + password) authentication.
59
+ # config.params_authenticatable = true
60
+
61
+ # Tell if authentication through HTTP Basic Auth is enabled. False by default.
62
+ # It can be set to an array that will enable http authentication only for the
63
+ # given strategies, for example, `config.http_authenticatable = [:token]` will
64
+ # enable it only for token authentication.
65
+ # config.http_authenticatable = false
66
+
67
+ # If http headers should be returned for AJAX requests. True by default.
68
+ # config.http_authenticatable_on_xhr = true
69
+
70
+ # The realm used in Http Basic Authentication. "Application" by default.
71
+ # config.http_authentication_realm = "Application"
72
+
73
+ # It will change confirmation, password recovery and other workflows
74
+ # to behave the same regardless if the e-mail provided was right or wrong.
75
+ # Does not affect registerable.
76
+ # config.paranoid = true
77
+
78
+ # By default Devise will store the user in session. You can skip storage for
79
+ # :http_auth and :token_auth by adding those symbols to the array below.
80
+ # Notice that if you are skipping storage for all authentication paths, you
81
+ # may want to disable generating routes to Devise's sessions controller by
82
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
83
+ config.skip_session_storage = [:http_auth]
84
+
85
+ # ==> Configuration for :database_authenticatable
86
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
87
+ # using other encryptors, it sets how many times you want the password re-encrypted.
88
+ #
89
+ # Limiting the stretches to just one in testing will increase the performance of
90
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
91
+ # a value less than 10 in other environments.
92
+ config.stretches = Rails.env.test? ? 1 : 10
93
+
94
+ # Setup a pepper to generate the encrypted password.
95
+ # config.pepper = "589f0e9c372367e7176cf1617494a99b3f26c2dd2a3ca617b2aa9fe7d9a9066b6a04489f985f2e15f3a3f32f770f36d0a0c3d42ea846562d0bb0f99662c0add1"
96
+
97
+ # ==> Configuration for :confirmable
98
+ # A period that the user is allowed to access the website even without
99
+ # confirming his account. For instance, if set to 2.days, the user will be
100
+ # able to access the website for two days without confirming his account,
101
+ # access will be blocked just in the third day. Default is 0.days, meaning
102
+ # the user cannot access the website without confirming his account.
103
+ # config.allow_unconfirmed_access_for = 2.days
104
+
105
+ # If true, requires any email changes to be confirmed (exactly the same way as
106
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
107
+ # db field (see migrations). Until confirmed new email is stored in
108
+ # unconfirmed email column, and copied to email column on successful confirmation.
109
+ config.reconfirmable = true
110
+
111
+ # Defines which key will be used when confirming an account
112
+ # config.confirmation_keys = [ :email ]
113
+
114
+ # ==> Configuration for :rememberable
115
+ # The time the user will be remembered without asking for credentials again.
116
+ # config.remember_for = 2.weeks
117
+
118
+ # If true, extends the user's remember period when remembered via cookie.
119
+ # config.extend_remember_period = false
120
+
121
+ # Options to be passed to the created cookie. For instance, you can set
122
+ # :secure => true in order to force SSL only cookies.
123
+ # config.rememberable_options = {}
124
+
125
+ # ==> Configuration for :validatable
126
+ # Range for password length. Default is 6..128.
127
+ # config.password_length = 6..128
128
+
129
+ # Email regex used to validate email formats. It simply asserts that
130
+ # an one (and only one) @ exists in the given string. This is mainly
131
+ # to give user feedback and not to assert the e-mail validity.
132
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
133
+
134
+ # ==> Configuration for :timeoutable
135
+ # The time you want to timeout the user session without activity. After this
136
+ # time the user will be asked for credentials again. Default is 30 minutes.
137
+ # config.timeout_in = 30.minutes
138
+
139
+ # If true, expires auth token on session timeout.
140
+ # config.expire_auth_token_on_timeout = false
141
+
142
+ # ==> Configuration for :lockable
143
+ # Defines which strategy will be used to lock an account.
144
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
145
+ # :none = No lock strategy. You should handle locking by yourself.
146
+ # config.lock_strategy = :failed_attempts
147
+
148
+ # Defines which key will be used when locking and unlocking an account
149
+ # config.unlock_keys = [ :email ]
150
+
151
+ # Defines which strategy will be used to unlock an account.
152
+ # :email = Sends an unlock link to the user email
153
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
154
+ # :both = Enables both strategies
155
+ # :none = No unlock strategy. You should handle unlocking by yourself.
156
+ # config.unlock_strategy = :both
157
+
158
+ # Number of authentication tries before locking an account if lock_strategy
159
+ # is failed attempts.
160
+ # config.maximum_attempts = 20
161
+
162
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
163
+ # config.unlock_in = 1.hour
164
+
165
+ # ==> Configuration for :recoverable
166
+ #
167
+ # Defines which key will be used when recovering the password for an account
168
+ # config.reset_password_keys = [ :email ]
169
+
170
+ # Time interval you can reset your password with a reset password key.
171
+ # Don't put a too small interval or your users won't have the time to
172
+ # change their passwords.
173
+ config.reset_password_within = 6.hours
174
+
175
+ # ==> Configuration for :encryptable
176
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
177
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
178
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
179
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
180
+ # REST_AUTH_SITE_KEY to pepper)
181
+ # config.encryptor = :sha512
182
+
183
+ # ==> Configuration for :token_authenticatable
184
+ # Defines name of the authentication token params key
185
+ # config.token_authentication_key = :auth_token
186
+
187
+ # ==> Scopes configuration
188
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
189
+ # "users/sessions/new". It's turned off by default because it's slower if you
190
+ # are using only default views.
191
+ # config.scoped_views = false
192
+
193
+ # Configure the default scope given to Warden. By default it's the first
194
+ # devise role declared in your routes (usually :user).
195
+ # config.default_scope = :user
196
+
197
+ # Set this configuration to false if you want /users/sign_out to sign out
198
+ # only the current scope. By default, Devise signs out all scopes.
199
+ # config.sign_out_all_scopes = true
200
+
201
+ # ==> Navigation configuration
202
+ # Lists the formats that should be treated as navigational. Formats like
203
+ # :html, should redirect to the sign in page when the user does not have
204
+ # access, but formats like :xml or :json, should return 401.
205
+ #
206
+ # If you have any extra navigational formats, like :iphone or :mobile, you
207
+ # should add them to the navigational formats lists.
208
+ #
209
+ # The "*/*" below is required to match Internet Explorer requests.
210
+ # config.navigational_formats = ["*/*", :html]
211
+
212
+ # The default HTTP method used to sign out a resource. Default is :delete.
213
+ config.sign_out_via = :delete
214
+
215
+ # ==> OmniAuth
216
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
217
+ # up on your models and hooks.
218
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
219
+
220
+ # ==> Warden configuration
221
+ # If you want to use other strategies, that are not supported by Devise, or
222
+ # change the failure app, you can configure them inside the config.warden block.
223
+ #
224
+ # config.warden do |manager|
225
+ # manager.intercept_401 = false
226
+ # manager.default_strategies(:scope => :user).unshift :some_external_strategy
227
+ # end
228
+
229
+ # ==> Mountable engine configurations
230
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
231
+ # is mountable, there are some extra configurations to be taken into account.
232
+ # The following options are available, assuming the engine is mounted as:
233
+ #
234
+ # mount MyEngine, at: "/my_engine"
235
+ #
236
+ # The router that invoked `devise_for`, in the example above, would be:
237
+ # config.router_name = :my_engine
238
+ #
239
+ # When using omniauth, Devise cannot automatically set Omniauth path,
240
+ # so you need to do it manually. For the users scope, it would be:
241
+ # config.omniauth_path_prefix = "/my_engine/users/auth"
242
+ end