devise_ldap_authenticatable 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -4
- data/README.md +45 -92
- data/Rakefile +8 -7
- data/devise_ldap_authenticatable.gemspec +15 -3
- data/lib/devise_ldap_authenticatable/ldap_adapter.rb +51 -27
- data/lib/devise_ldap_authenticatable/model.rb +5 -1
- data/lib/devise_ldap_authenticatable/strategy.rb +3 -1
- data/lib/devise_ldap_authenticatable/version.rb +1 -1
- data/lib/generators/devise_ldap_authenticatable/templates/ldap.yml +3 -3
- data/spec/ldap/.gitignore +2 -0
- data/{test → spec}/ldap/base.ldif +0 -0
- data/{test → spec}/ldap/clear.ldif +0 -0
- data/{test → spec}/ldap/local.schema +0 -0
- data/spec/ldap/openldap-data/.gitignore +2 -0
- data/spec/ldap/openldap-data/run/.gitignore +2 -0
- data/{test → spec}/ldap/openldap-data/run/.gitkeep +0 -0
- data/spec/ldap/run-server +31 -0
- data/{test → spec}/ldap/server.pem +0 -0
- data/{test/ldap/slapd-test.conf → spec/ldap/slapd-test.conf.erb} +16 -16
- data/{test → spec}/rails_app/Rakefile +0 -0
- data/spec/rails_app/app/controllers/application_controller.rb +7 -0
- data/{test → spec}/rails_app/app/controllers/posts_controller.rb +0 -0
- data/{test → spec}/rails_app/app/helpers/application_helper.rb +0 -0
- data/{test → spec}/rails_app/app/helpers/posts_helper.rb +0 -0
- data/{test → spec}/rails_app/app/models/post.rb +0 -0
- data/{test → spec}/rails_app/app/models/user.rb +0 -0
- data/{test → spec}/rails_app/app/views/layouts/application.html.erb +0 -0
- data/{test → spec}/rails_app/app/views/posts/index.html.erb +0 -0
- data/{test → spec}/rails_app/config.ru +0 -0
- data/{test → spec}/rails_app/config/application.rb +0 -0
- data/{test → spec}/rails_app/config/boot.rb +1 -1
- data/{test → spec}/rails_app/config/cucumber.yml +0 -0
- data/{test → spec}/rails_app/config/database.yml +0 -0
- data/{test → spec}/rails_app/config/environment.rb +0 -0
- data/{test → spec}/rails_app/config/environments/development.rb +0 -1
- data/{test → spec}/rails_app/config/environments/production.rb +0 -0
- data/{test → spec}/rails_app/config/environments/test.rb +1 -1
- data/{test → spec}/rails_app/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/rails_app/config/initializers/devise.rb +242 -0
- data/{test → spec}/rails_app/config/initializers/inflections.rb +0 -0
- data/{test → spec}/rails_app/config/initializers/mime_types.rb +0 -0
- data/{test → spec}/rails_app/config/initializers/secret_token.rb +0 -0
- data/{test → spec}/rails_app/config/initializers/session_store.rb +0 -0
- data/{test → spec}/rails_app/config/ldap.yml +0 -0
- data/{test → spec}/rails_app/config/ldap_with_boolean_ssl.yml +0 -0
- data/{test → spec}/rails_app/config/ldap_with_erb.yml +0 -0
- data/{test → spec}/rails_app/config/ldap_with_uid.yml +0 -0
- data/spec/rails_app/config/locales/devise.en.yml +58 -0
- data/{test → spec}/rails_app/config/locales/en.yml +0 -0
- data/{test → spec}/rails_app/config/routes.rb +0 -0
- data/{test → spec}/rails_app/config/ssl_ldap.yml +0 -0
- data/{test → spec}/rails_app/config/ssl_ldap_with_erb.yml +0 -0
- data/{test → spec}/rails_app/config/ssl_ldap_with_uid.yml +0 -0
- data/{test → spec}/rails_app/db/migrate/20100708120448_devise_create_users.rb +18 -4
- data/{test → spec}/rails_app/db/schema.rb +6 -13
- data/{test → spec}/rails_app/features/manage_logins.feature +0 -0
- data/{test → spec}/rails_app/features/step_definitions/login_steps.rb +0 -0
- data/{test → spec}/rails_app/features/step_definitions/web_steps.rb +0 -0
- data/{test → spec}/rails_app/features/support/env.rb +0 -0
- data/{test → spec}/rails_app/features/support/paths.rb +0 -0
- data/{test → spec}/rails_app/lib/tasks/.gitkeep +0 -0
- data/{test → spec}/rails_app/lib/tasks/cucumber.rake +0 -0
- data/{test → spec}/rails_app/public/404.html +0 -0
- data/{test → spec}/rails_app/public/422.html +0 -0
- data/{test → spec}/rails_app/public/500.html +0 -0
- data/{test → spec}/rails_app/public/images/rails.png +0 -0
- data/{test → spec}/rails_app/public/javascripts/application.js +0 -0
- data/{test → spec}/rails_app/public/javascripts/controls.js +0 -0
- data/{test → spec}/rails_app/public/javascripts/dragdrop.js +0 -0
- data/{test → spec}/rails_app/public/javascripts/effects.js +0 -0
- data/{test → spec}/rails_app/public/javascripts/prototype.js +0 -0
- data/{test → spec}/rails_app/public/javascripts/rails.js +0 -0
- data/{test → spec}/rails_app/public/stylesheets/.gitkeep +0 -0
- data/{test → spec}/rails_app/script/cucumber +0 -0
- data/{test → spec}/rails_app/script/rails +0 -0
- data/spec/spec_helper.rb +47 -0
- data/spec/support/factories.rb +16 -0
- data/spec/unit/user_spec.rb +303 -0
- metadata +292 -179
- data/Gemfile.lock +0 -92
- data/rails/init.rb +0 -2
- data/test/devise_ldap_authenticatable_test.rb +0 -8
- data/test/ldap/run-server.sh +0 -10
- data/test/ldap/slapd-ssl-test.conf +0 -107
- data/test/rails_app/Gemfile +0 -22
- data/test/rails_app/Gemfile.lock +0 -159
- data/test/rails_app/app/controllers/application_controller.rb +0 -4
- data/test/rails_app/config/initializers/devise.rb +0 -140
- data/test/rails_app/config/ldap_with_check_membership_off.yml +0 -23
- data/test/rails_app/config/ldap_with_check_membership_on.yml +0 -23
- data/test/rails_app/config/locales/devise.en.yml +0 -39
- data/test/rails_app/db/migrate/20100708120302_create_posts.rb +0 -14
- data/test/rails_app/db/seeds.rb +0 -7
- data/test/rails_app/test/factories/users.rb +0 -14
- data/test/rails_app/test/functional/posts_controller_test.rb +0 -58
- data/test/rails_app/test/performance/browsing_test.rb +0 -9
- data/test/rails_app/test/test_helper.rb +0 -36
- data/test/rails_app/test/unit/helpers/posts_helper_test.rb +0 -4
- data/test/rails_app/test/unit/post_test.rb +0 -4
- data/test/rails_app/test/unit/user_test.rb +0 -314
- data/test/test_helper.rb +0 -3
@@ -10,6 +10,8 @@ module Devise
|
|
10
10
|
# to sign in page.
|
11
11
|
def authenticate!
|
12
12
|
resource = valid_password? && mapping.to.authenticate_with_ldap(params[scope])
|
13
|
+
return fail(:invalid) if resource.nil?
|
14
|
+
|
13
15
|
if validate(resource)
|
14
16
|
success!(resource)
|
15
17
|
else
|
@@ -20,4 +22,4 @@ module Devise
|
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
|
-
Warden::Strategies.add(:ldap_authenticatable, Devise::Strategies::LdapAuthenticatable)
|
25
|
+
Warden::Strategies.add(:ldap_authenticatable, Devise::Strategies::LdapAuthenticatable)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
## Authorizations
|
2
|
-
# Uncomment out the merging for each
|
2
|
+
# Uncomment out the merging for each environment that you'd like to include.
|
3
3
|
# You can also just copy and paste the tree (do not include the "authorizations") to each
|
4
|
-
#
|
4
|
+
# environment if you need something different per enviornment.
|
5
5
|
authorizations: &AUTHORIZATIONS
|
6
6
|
group_base: ou=groups,dc=test,dc=com
|
7
7
|
## Requires config.ldap_check_group_membership in devise.rb be true
|
@@ -18,7 +18,7 @@ authorizations: &AUTHORIZATIONS
|
|
18
18
|
objectClass: inetOrgPerson
|
19
19
|
authorizationRole: postsAdmin
|
20
20
|
|
21
|
-
##
|
21
|
+
## Environment
|
22
22
|
|
23
23
|
development:
|
24
24
|
host: localhost
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'erb'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
FileUtils.chdir(File.dirname(__FILE__))
|
7
|
+
|
8
|
+
## For OSX:
|
9
|
+
ENV['PATH'] = "#{ENV['PATH']}:/usr/libexec"
|
10
|
+
|
11
|
+
template = File.read('slapd-test.conf.erb')
|
12
|
+
normal_out = 'slapd-test.conf'
|
13
|
+
ssl_out = 'slapd-ssl-test.conf'
|
14
|
+
|
15
|
+
File.open(normal_out, 'w') do |f|
|
16
|
+
@ssl = false
|
17
|
+
f.write ERB.new(template).result(binding)
|
18
|
+
end
|
19
|
+
File.open(ssl_out, 'w') do |f|
|
20
|
+
@ssl = true
|
21
|
+
f.write ERB.new(template).result(binding)
|
22
|
+
end
|
23
|
+
|
24
|
+
if ARGV.first == '--ssl'
|
25
|
+
cmd = "slapd -d 1 -f #{ssl_out} -h ldaps://localhost:3389"
|
26
|
+
else
|
27
|
+
cmd = "slapd -d 1 -f #{normal_out} -h ldap://localhost:3389"
|
28
|
+
end
|
29
|
+
|
30
|
+
puts(cmd)
|
31
|
+
exec(cmd)
|
File without changes
|
@@ -2,14 +2,15 @@
|
|
2
2
|
# See slapd.conf(5) for details on configuration options.
|
3
3
|
# This file should NOT be world readable.
|
4
4
|
#
|
5
|
-
|
6
|
-
include /etc
|
7
|
-
include /etc
|
8
|
-
include /etc
|
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
|
9
10
|
|
10
11
|
## Local definitions
|
11
|
-
# include /etc
|
12
|
-
include local.schema
|
12
|
+
# include /etc/<%= ldapdir %>/schema/local.schema
|
13
|
+
include <%= File.expand_path('local.schema', @conf_root) %>
|
13
14
|
|
14
15
|
# Allow LDAPv2 client connections. This is NOT the default.
|
15
16
|
allow bind_v2
|
@@ -18,8 +19,8 @@ allow bind_v2
|
|
18
19
|
# service AND an understanding of referrals.
|
19
20
|
#referral ldap://root.openldap.org
|
20
21
|
|
21
|
-
pidfile openldap-data/run/slapd.pid
|
22
|
-
argsfile openldap-data/run/slapd.args
|
22
|
+
pidfile <%= File.expand_path('openldap-data/run/slapd.pid', @conf_root) %>
|
23
|
+
argsfile <%= File.expand_path('openldap-data/run/slapd.args', @conf_root) %>
|
23
24
|
|
24
25
|
# Load dynamic backend modules:
|
25
26
|
modulepath /usr/lib/openldap
|
@@ -52,9 +53,15 @@ modulepath /usr/lib/openldap
|
|
52
53
|
# may balk at self-signed certificates, however.
|
53
54
|
|
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 %>
|
55
61
|
# TLSCACertificateFile server.pem
|
56
62
|
# TLSCertificateFile server.pem
|
57
63
|
# TLSCertificateKeyFile server.pem
|
64
|
+
<% end %>
|
58
65
|
#
|
59
66
|
# TLSVerifyClient demand
|
60
67
|
|
@@ -91,17 +98,10 @@ access to *
|
|
91
98
|
# ldbm and/or bdb database definitions
|
92
99
|
#######################################################################
|
93
100
|
|
94
|
-
database
|
101
|
+
database ldif
|
95
102
|
|
96
103
|
suffix "dc=test,dc=com"
|
97
104
|
directory openldap-data
|
98
105
|
rootdn "cn=admin,dc=test,dc=com"
|
99
106
|
## rootpw = secret
|
100
107
|
rootpw {SSHA}fFjKcZb4cfOAcwSjJer8nCGOEVRUnwCC
|
101
|
-
|
102
|
-
# Indices to maintain for this database
|
103
|
-
index objectClass eq,pres
|
104
|
-
index ou,cn,mail,surname,givenname eq,pres,sub
|
105
|
-
index uidNumber,gidNumber,loginShell eq,pres
|
106
|
-
index uid,memberUid eq,pres,sub
|
107
|
-
index nisMapName,nisMapEntry eq,pres,sub
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -11,7 +11,6 @@ RailsApp::Application.configure do
|
|
11
11
|
|
12
12
|
# Show full error reports and disable caching
|
13
13
|
config.consider_all_requests_local = true
|
14
|
-
config.action_view.debug_rjs = true
|
15
14
|
config.action_controller.perform_caching = false
|
16
15
|
|
17
16
|
# Don't care if the mailer can't send
|
File without changes
|
@@ -24,7 +24,7 @@ RailsApp::Application.configure do
|
|
24
24
|
# The :test delivery method accumulates sent emails in the
|
25
25
|
# ActionMailer::Base.deliveries array.
|
26
26
|
config.action_mailer.delivery_method = :test
|
27
|
-
|
27
|
+
|
28
28
|
config.active_support.deprecation = :stderr
|
29
29
|
|
30
30
|
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
File without changes
|
@@ -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
|