curupira 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of curupira might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/.travis.yml +19 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +202 -0
- data/README.md +72 -0
- data/Rakefile +31 -0
- data/app/controllers/curupira/authorized_controller.rb +9 -0
- data/app/controllers/curupira/groups_controller.rb +43 -0
- data/app/controllers/curupira/passwords_controller.rb +46 -0
- data/app/controllers/curupira/roles_controller.rb +43 -0
- data/app/controllers/curupira/sessions_controller.rb +30 -0
- data/app/controllers/curupira/users_controller.rb +47 -0
- data/app/helpers/curupira/authorize_helper.rb +21 -0
- data/app/helpers/curupira/relationship_select_options_helper.rb +17 -0
- data/app/mailers/curupira/reset_password_mailer.rb +13 -0
- data/app/views/curupira/groups/_form.html.erb +28 -0
- data/app/views/curupira/groups/_role_group_fields.html.erb +9 -0
- data/app/views/curupira/groups/edit.html.erb +3 -0
- data/app/views/curupira/groups/index.html.erb +24 -0
- data/app/views/curupira/groups/new.html.erb +3 -0
- data/app/views/curupira/groups/show.html.erb +32 -0
- data/app/views/curupira/passwords/edit.html.erb +14 -0
- data/app/views/curupira/passwords/new.html.erb +14 -0
- data/app/views/curupira/reset_password_mailer/instructions.html.erb +19 -0
- data/app/views/curupira/reset_password_mailer/reseted.html.erb +7 -0
- data/app/views/curupira/roles/_authorization_fields.html.erb +10 -0
- data/app/views/curupira/roles/_form.html.erb +23 -0
- data/app/views/curupira/roles/edit.html.erb +3 -0
- data/app/views/curupira/roles/index.html.erb +24 -0
- data/app/views/curupira/roles/new.html.erb +3 -0
- data/app/views/curupira/roles/show.html.erb +37 -0
- data/app/views/curupira/sessions/new.html.erb +17 -0
- data/app/views/curupira/shared/_model_links.html.erb +7 -0
- data/app/views/curupira/shared/_session_links.html.erb +7 -0
- data/app/views/curupira/users/_form.html.erb +43 -0
- data/app/views/curupira/users/_group_user_fields.html.erb +20 -0
- data/app/views/curupira/users/_role_group_user_fields.html.erb +10 -0
- data/app/views/curupira/users/edit.html.erb +3 -0
- data/app/views/curupira/users/index.html.erb +28 -0
- data/app/views/curupira/users/new.html.erb +3 -0
- data/app/views/curupira/users/show.html.erb +28 -0
- data/curupira.gemspec +28 -0
- data/lib/curupira.rb +16 -0
- data/lib/curupira/authorizer.rb +43 -0
- data/lib/curupira/rails.rb +30 -0
- data/lib/curupira/rails/routes.rb +15 -0
- data/lib/curupira/version.rb +3 -0
- data/lib/generators/curupira/controllers/controllers_generator.rb +27 -0
- data/lib/generators/curupira/install/install_generator.rb +80 -0
- data/lib/generators/curupira/install/model_generators_helper.rb +266 -0
- data/lib/generators/curupira/routes/routes_generator.rb +21 -0
- data/lib/generators/curupira/routes/templates/routes.rb +1 -0
- data/lib/generators/curupira/templates/db/migrate/add_curupira_to_users.rb +20 -0
- data/lib/generators/curupira/templates/db/migrate/create_action_labels.rb +12 -0
- data/lib/generators/curupira/templates/db/migrate/create_authorizations.rb +12 -0
- data/lib/generators/curupira/templates/db/migrate/create_features.rb +11 -0
- data/lib/generators/curupira/templates/db/migrate/create_group_users.rb +13 -0
- data/lib/generators/curupira/templates/db/migrate/create_groups.rb +10 -0
- data/lib/generators/curupira/templates/db/migrate/create_role_group_users.rb +12 -0
- data/lib/generators/curupira/templates/db/migrate/create_role_groups.rb +13 -0
- data/lib/generators/curupira/templates/db/migrate/create_roles.rb +8 -0
- data/lib/generators/curupira/templates/db/migrate/sorcery_core.rb +27 -0
- data/lib/generators/curupira/templates/models/action_label.rb +2 -0
- data/lib/generators/curupira/templates/models/authorization.rb +2 -0
- data/lib/generators/curupira/templates/models/feature.rb +2 -0
- data/lib/generators/curupira/templates/models/feature_service.rb +4 -0
- data/lib/generators/curupira/templates/models/group.rb +2 -0
- data/lib/generators/curupira/templates/models/group_user.rb +2 -0
- data/lib/generators/curupira/templates/models/role.rb +2 -0
- data/lib/generators/curupira/templates/models/role_group.rb +2 -0
- data/lib/generators/curupira/templates/models/role_group_user.rb +2 -0
- data/lib/generators/curupira/templates/models/service.rb +2 -0
- data/lib/generators/curupira/templates/models/user.rb +2 -0
- data/lib/generators/curupira/templates/sorcery.rb +462 -0
- data/lib/generators/curupira/views/views_generator.rb +27 -0
- data/lib/tasks/curupira_tasks.rake +4 -0
- data/spec/app_templates/app/models/action_label.rb +2 -0
- data/spec/app_templates/app/models/authorization.rb +2 -0
- data/spec/app_templates/app/models/feature.rb +2 -0
- data/spec/app_templates/app/models/feature_service.rb +2 -0
- data/spec/app_templates/app/models/group.rb +4 -0
- data/spec/app_templates/app/models/group_user.rb +2 -0
- data/spec/app_templates/app/models/role.rb +2 -0
- data/spec/app_templates/app/models/role_group.rb +2 -0
- data/spec/app_templates/app/models/role_group_user.rb +2 -0
- data/spec/app_templates/app/models/service.rb +2 -0
- data/spec/app_templates/app/models/user.rb +2 -0
- data/spec/app_templates/config/routes.rb +3 -0
- data/spec/controllers/controller_spec.rb +40 -0
- data/spec/controllers/groups_controller_spec.rb +162 -0
- data/spec/controllers/passwords_controller_spec.rb +171 -0
- data/spec/controllers/roles_controller_spec.rb +168 -0
- data/spec/controllers/sessions_controller_spec.rb +112 -0
- data/spec/controllers/users_controller_spec.rb +182 -0
- data/spec/curupira/authorization_spec.rb +67 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/home_controller.rb +4 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/action_label.rb +3 -0
- data/spec/dummy/app/models/authorization.rb +4 -0
- data/spec/dummy/app/models/feature.rb +3 -0
- data/spec/dummy/app/models/group.rb +9 -0
- data/spec/dummy/app/models/group_user.rb +7 -0
- data/spec/dummy/app/models/role.rb +10 -0
- data/spec/dummy/app/models/role_group.rb +4 -0
- data/spec/dummy/app/models/role_group_user.rb +4 -0
- data/spec/dummy/app/models/user.rb +10 -0
- data/spec/dummy/app/views/home/index.html.erb +5 -0
- data/spec/dummy/app/views/home/test.html.erb +1 -0
- data/spec/dummy/app/views/layouts/application.html.erb +19 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +25 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +46 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +44 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/sorcery.rb +462 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +6 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/migrate/20150305011941_create_role_group_users.rb +12 -0
- data/spec/dummy/db/migrate/20150305011942_create_authorizations.rb +12 -0
- data/spec/dummy/db/migrate/20150305011944_create_groups.rb +10 -0
- data/spec/dummy/db/migrate/20150305011945_create_roles.rb +8 -0
- data/spec/dummy/db/migrate/20150305011946_sorcery_core.rb +27 -0
- data/spec/dummy/db/migrate/20150305011947_create_group_users.rb +13 -0
- data/spec/dummy/db/migrate/20150305011948_create_role_groups.rb +13 -0
- data/spec/dummy/db/migrate/20150312181229_create_action_labels.rb +12 -0
- data/spec/dummy/db/migrate/20150312181747_create_features.rb +11 -0
- data/spec/dummy/db/schema.rb +112 -0
- data/spec/dummy/db/seeds.rb +137 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/features/link_authorize_spec.rb +25 -0
- data/spec/features/list_users_spec.rb +38 -0
- data/spec/features/log_in_spec.rb +15 -0
- data/spec/generators/curupira/install/action_label_spec.rb +53 -0
- data/spec/generators/curupira/install/authorization_generator_spec.rb +51 -0
- data/spec/generators/curupira/install/feature_generator_spec.rb +52 -0
- data/spec/generators/curupira/install/group_user_generator_spec.rb +51 -0
- data/spec/generators/curupira/install/install_generators_spec.rb +159 -0
- data/spec/generators/curupira/install/role_generator_spec.rb +38 -0
- data/spec/generators/curupira/install/role_group_generator_spec.rb +51 -0
- data/spec/generators/curupira/install/role_group_user_generator_spec.rb +52 -0
- data/spec/helpers/relationship_select_options_helper_spec.rb +18 -0
- data/spec/rails_helper.rb +55 -0
- data/spec/spec_helper.rb +87 -0
- data/spec/support/factories.rb +64 -0
- data/spec/support/generator_spec_helpers.rb +42 -0
- data/spec/support/helpers_spec.rb +23 -0
- data/spec/support/shared_examples/role_generator_shared_example_spec.rb +13 -0
- data/spec/support/sorcery.rb +4 -0
- metadata +539 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
module Curupira
|
2
|
+
module Generators
|
3
|
+
class RoutesGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def inject_routes_into_application_routes
|
7
|
+
route(curupira_routes)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def curupira_routes
|
13
|
+
File.read(routes_file_path)
|
14
|
+
end
|
15
|
+
|
16
|
+
def routes_file_path
|
17
|
+
File.expand_path(find_in_source_paths('routes.rb'))
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
curupira_routes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class AddCurupiraToUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
change_table :users do |t|
|
4
|
+
<% @user_columns.values.each do |column| -%>
|
5
|
+
<%= column %>
|
6
|
+
<% end -%>
|
7
|
+
end
|
8
|
+
<% @user_indexes.values.each do |index| -%>
|
9
|
+
<%= index %>
|
10
|
+
<% end -%>
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
change_table :users do |t|
|
15
|
+
<% if @user_columns.any? -%>
|
16
|
+
t.remove <%= @user_columns.keys.map { |column| ":#{column}" }.join(",") %>
|
17
|
+
<% end -%>
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateActionLabels < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :action_labels do |t|
|
4
|
+
t.string :name
|
5
|
+
t.belongs_to :feature, index: true
|
6
|
+
t.boolean :active, default: true
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
add_foreign_key :action_labels, :features
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateAuthorizations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :authorizations do |t|
|
4
|
+
t.belongs_to :feature, index: true
|
5
|
+
t.belongs_to :role, index: true
|
6
|
+
|
7
|
+
t.timestamps null: false
|
8
|
+
end
|
9
|
+
add_foreign_key :authorizations, :features
|
10
|
+
add_foreign_key :authorizations, :roles
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateGroupUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :group_users do |t|
|
4
|
+
t.belongs_to :group, index: true
|
5
|
+
t.belongs_to :user, index: true
|
6
|
+
t.boolean :active
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
add_foreign_key :group_users, :groups
|
11
|
+
add_foreign_key :group_users, :users
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateRoleGroupUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :role_group_users do |t|
|
4
|
+
t.belongs_to :role, index: true
|
5
|
+
t.belongs_to :group_user, index: true
|
6
|
+
|
7
|
+
t.timestamps null: false
|
8
|
+
end
|
9
|
+
add_foreign_key :authorizations, :group_users
|
10
|
+
add_foreign_key :authorizations, :roles
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateRoleGroups < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :role_groups do |t|
|
4
|
+
t.belongs_to :role, index: true
|
5
|
+
t.belongs_to :group, index: true
|
6
|
+
t.boolean :active
|
7
|
+
|
8
|
+
t.timestamps null: false
|
9
|
+
end
|
10
|
+
add_foreign_key :role_groups, :roles
|
11
|
+
add_foreign_key :role_groups, :groups
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class SorceryCore < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :users do |t|
|
4
|
+
t.string :email, null: false
|
5
|
+
t.string :name, null: false
|
6
|
+
t.boolean :active, default: true
|
7
|
+
t.string :username
|
8
|
+
t.string :crypted_password
|
9
|
+
t.string :salt
|
10
|
+
t.string :reset_password_token, default: nil
|
11
|
+
t.datetime :reset_password_token_expires_at, default: nil
|
12
|
+
t.datetime :reset_password_email_sent_at, default: nil
|
13
|
+
t.datetime :last_login_at, default: nil
|
14
|
+
t.datetime :last_logout_at, default: nil
|
15
|
+
t.datetime :last_activity_at, default: nil
|
16
|
+
t.string :last_login_from_ip_address, default: nil
|
17
|
+
t.boolean :admin, default: false
|
18
|
+
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
|
22
|
+
add_index :users, :username, unique: true
|
23
|
+
add_index :users, :reset_password_token
|
24
|
+
add_index :users, :last_logout_at
|
25
|
+
add_index :users, :last_activity_at
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,462 @@
|
|
1
|
+
# The first thing you need to configure is which modules you need in your app.
|
2
|
+
# The default is nothing which will include only core features (password encryption, login/logout).
|
3
|
+
# Available submodules are: :user_activation, :http_basic_auth, :remember_me,
|
4
|
+
# :reset_password, :session_timeout, :brute_force_protection, :activity_logging, :external
|
5
|
+
Rails.application.config.sorcery.submodules = [:reset_password, :activity_logging]
|
6
|
+
|
7
|
+
# Here you can configure each submodule's features.
|
8
|
+
Rails.application.config.sorcery.configure do |config|
|
9
|
+
# -- core --
|
10
|
+
# What controller action to call for non-authenticated users. You can also
|
11
|
+
# override the 'not_authenticated' method of course.
|
12
|
+
# Default: `:not_authenticated`
|
13
|
+
#
|
14
|
+
# config.not_authenticated_action =
|
15
|
+
|
16
|
+
|
17
|
+
# When a non logged in user tries to enter a page that requires login, save
|
18
|
+
# the URL he wanted to reach, and send him there after login, using 'redirect_back_or_to'.
|
19
|
+
# Default: `true`
|
20
|
+
#
|
21
|
+
# config.save_return_to_url =
|
22
|
+
|
23
|
+
|
24
|
+
# Set domain option for cookies; Useful for remember_me submodule.
|
25
|
+
# Default: `nil`
|
26
|
+
#
|
27
|
+
# config.cookie_domain =
|
28
|
+
|
29
|
+
|
30
|
+
# Allow the remember_me cookie to be set through AJAX
|
31
|
+
# Default: `true`
|
32
|
+
#
|
33
|
+
# config.remember_me_httponly =
|
34
|
+
|
35
|
+
|
36
|
+
# -- session timeout --
|
37
|
+
# How long in seconds to keep the session alive.
|
38
|
+
# Default: `3600`
|
39
|
+
#
|
40
|
+
# config.session_timeout =
|
41
|
+
|
42
|
+
|
43
|
+
# Use the last action as the beginning of session timeout.
|
44
|
+
# Default: `false`
|
45
|
+
#
|
46
|
+
# config.session_timeout_from_last_action =
|
47
|
+
|
48
|
+
|
49
|
+
# -- http_basic_auth --
|
50
|
+
# What realm to display for which controller name. For example {"My App" => "Application"}
|
51
|
+
# Default: `{"application" => "Application"}`
|
52
|
+
#
|
53
|
+
# config.controller_to_realm_map =
|
54
|
+
|
55
|
+
|
56
|
+
# -- activity logging --
|
57
|
+
# will register the time of last user login, every login.
|
58
|
+
# Default: `true`
|
59
|
+
#
|
60
|
+
# config.register_login_time =
|
61
|
+
|
62
|
+
|
63
|
+
# will register the time of last user logout, every logout.
|
64
|
+
# Default: `true`
|
65
|
+
#
|
66
|
+
# config.register_logout_time =
|
67
|
+
|
68
|
+
|
69
|
+
# will register the time of last user action, every action.
|
70
|
+
# Default: `true`
|
71
|
+
#
|
72
|
+
# config.register_last_activity_time =
|
73
|
+
|
74
|
+
|
75
|
+
# -- external --
|
76
|
+
# What providers are supported by this app, i.e. [:twitter, :facebook, :github, :linkedin, :xing, :google, :liveid, :salesforce] .
|
77
|
+
# Default: `[]`
|
78
|
+
#
|
79
|
+
# config.external_providers =
|
80
|
+
|
81
|
+
|
82
|
+
# You can change it by your local ca_file. i.e. '/etc/pki/tls/certs/ca-bundle.crt'
|
83
|
+
# Path to ca_file. By default use a internal ca-bundle.crt.
|
84
|
+
# Default: `'path/to/ca_file'`
|
85
|
+
#
|
86
|
+
# config.ca_file =
|
87
|
+
|
88
|
+
|
89
|
+
# For information about LinkedIn API:
|
90
|
+
# - user info fields go to https://developer.linkedin.com/documents/profile-fields
|
91
|
+
# - access permissions go to https://developer.linkedin.com/documents/authentication#granting
|
92
|
+
#
|
93
|
+
# config.linkedin.key = ""
|
94
|
+
# config.linkedin.secret = ""
|
95
|
+
# config.linkedin.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=linkedin"
|
96
|
+
# config.linkedin.user_info_fields = ['first-name', 'last-name']
|
97
|
+
# config.linkedin.user_info_mapping = {first_name: "firstName", last_name: "lastName"}
|
98
|
+
# config.linkedin.access_permissions = ['r_basicprofile']
|
99
|
+
#
|
100
|
+
#
|
101
|
+
# For information about XING API:
|
102
|
+
# - user info fields go to https://dev.xing.com/docs/get/users/me
|
103
|
+
#
|
104
|
+
# config.xing.key = ""
|
105
|
+
# config.xing.secret = ""
|
106
|
+
# config.xing.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=xing"
|
107
|
+
# config.xing.user_info_mapping = {first_name: "first_name", last_name: "last_name"}
|
108
|
+
#
|
109
|
+
#
|
110
|
+
# Twitter will not accept any requests nor redirect uri containing localhost,
|
111
|
+
# make sure you use 0.0.0.0:3000 to access your app in development
|
112
|
+
#
|
113
|
+
# config.twitter.key = ""
|
114
|
+
# config.twitter.secret = ""
|
115
|
+
# config.twitter.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=twitter"
|
116
|
+
# config.twitter.user_info_mapping = {:email => "screen_name"}
|
117
|
+
#
|
118
|
+
# config.facebook.key = ""
|
119
|
+
# config.facebook.secret = ""
|
120
|
+
# config.facebook.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=facebook"
|
121
|
+
# config.facebook.user_info_mapping = {:email => "name"}
|
122
|
+
# config.facebook.access_permissions = ["email", "publish_stream"]
|
123
|
+
# config.facebook.display = "page"
|
124
|
+
#
|
125
|
+
# config.github.key = ""
|
126
|
+
# config.github.secret = ""
|
127
|
+
# config.github.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=github"
|
128
|
+
# config.github.user_info_mapping = {:email => "name"}
|
129
|
+
#
|
130
|
+
# config.google.key = ""
|
131
|
+
# config.google.secret = ""
|
132
|
+
# config.google.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=google"
|
133
|
+
# config.google.user_info_mapping = {:email => "email", :username => "name"}
|
134
|
+
#
|
135
|
+
# config.vk.key = ""
|
136
|
+
# config.vk.secret = ""
|
137
|
+
# config.vk.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=vk"
|
138
|
+
# config.vk.user_info_mapping = {:login => "domain", :name => "full_name"}
|
139
|
+
#
|
140
|
+
# To use liveid in development mode you have to replace mydomain.com with
|
141
|
+
# a valid domain even in development. To use a valid domain in development
|
142
|
+
# simply add your domain in your /etc/hosts file in front of 127.0.0.1
|
143
|
+
#
|
144
|
+
# config.liveid.key = ""
|
145
|
+
# config.liveid.secret = ""
|
146
|
+
# config.liveid.callback_url = "http://mydomain.com:3000/oauth/callback?provider=liveid"
|
147
|
+
# config.liveid.user_info_mapping = {:username => "name"}
|
148
|
+
|
149
|
+
# For information about JIRA API:
|
150
|
+
# https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+OAuth+authentication
|
151
|
+
# to obtain the consumer key and the public key you can use the jira-ruby gem https://github.com/sumoheavy/jira-ruby
|
152
|
+
# or run openssl req -x509 -nodes -newkey rsa:1024 -sha1 -keyout rsakey.pem -out rsacert.pem to obtain the public key
|
153
|
+
# Make sure you have configured the application link properly
|
154
|
+
|
155
|
+
# config.jira.key = "1234567"
|
156
|
+
# config.jira.secret = "jiraTest"
|
157
|
+
# config.jira.site = "http://localhost:2990/jira/plugins/servlet/oauth"
|
158
|
+
# config.jira.signature_method = "RSA-SHA1"
|
159
|
+
# config.jira.private_key_file = "rsakey.pem"
|
160
|
+
|
161
|
+
# For information about Salesforce API:
|
162
|
+
# https://developer.salesforce.com/signup &
|
163
|
+
# https://www.salesforce.com/us/developer/docs/api_rest/
|
164
|
+
# Salesforce callback_url must be https. You can run the following to generate self-signed ssl cert
|
165
|
+
# openssl req -new -newkey rsa:2048 -sha1 -days 365 -nodes -x509 -keyout server.key -out server.crt
|
166
|
+
# Make sure you have configured the application link properly
|
167
|
+
# config.salesforce.key = '123123'
|
168
|
+
# config.salesforce.secret = 'acb123'
|
169
|
+
# config.salesforce.callback_url = "https://127.0.0.1:9292/oauth/callback?provider=salesforce"
|
170
|
+
# config.salesforce.scope = "full"
|
171
|
+
# config.salesforce.user_info_mapping = {:email => "email"}
|
172
|
+
|
173
|
+
# --- user config ---
|
174
|
+
config.user_config do |user|
|
175
|
+
# -- core --
|
176
|
+
# specify username attributes, for example: [:username, :email].
|
177
|
+
# Default: `[:email]`
|
178
|
+
#
|
179
|
+
user.username_attribute_names = [:username, :email]
|
180
|
+
|
181
|
+
|
182
|
+
# change *virtual* password attribute, the one which is used until an encrypted one is generated.
|
183
|
+
# Default: `:password`
|
184
|
+
#
|
185
|
+
# user.password_attribute_name =
|
186
|
+
|
187
|
+
|
188
|
+
# downcase the username before trying to authenticate, default is false
|
189
|
+
# Default: `false`
|
190
|
+
#
|
191
|
+
# user.downcase_username_before_authenticating =
|
192
|
+
|
193
|
+
|
194
|
+
# change default email attribute.
|
195
|
+
# Default: `:email`
|
196
|
+
#
|
197
|
+
# user.email_attribute_name =
|
198
|
+
|
199
|
+
|
200
|
+
# change default crypted_password attribute.
|
201
|
+
# Default: `:crypted_password`
|
202
|
+
#
|
203
|
+
# user.crypted_password_attribute_name =
|
204
|
+
|
205
|
+
|
206
|
+
# what pattern to use to join the password with the salt
|
207
|
+
# Default: `""`
|
208
|
+
#
|
209
|
+
# user.salt_join_token =
|
210
|
+
|
211
|
+
|
212
|
+
# change default salt attribute.
|
213
|
+
# Default: `:salt`
|
214
|
+
#
|
215
|
+
# user.salt_attribute_name =
|
216
|
+
|
217
|
+
|
218
|
+
# how many times to apply encryption to the password.
|
219
|
+
# Default: `nil`
|
220
|
+
#
|
221
|
+
# user.stretches =
|
222
|
+
|
223
|
+
|
224
|
+
# encryption key used to encrypt reversible encryptions such as AES256.
|
225
|
+
# WARNING: If used for users' passwords, changing this key will leave passwords undecryptable!
|
226
|
+
# Default: `nil`
|
227
|
+
#
|
228
|
+
# user.encryption_key =
|
229
|
+
|
230
|
+
|
231
|
+
# use an external encryption class.
|
232
|
+
# Default: `nil`
|
233
|
+
#
|
234
|
+
# user.custom_encryption_provider =
|
235
|
+
|
236
|
+
|
237
|
+
# encryption algorithm name. See 'encryption_algorithm=' for available options.
|
238
|
+
# Default: `:bcrypt`
|
239
|
+
#
|
240
|
+
# user.encryption_algorithm =
|
241
|
+
|
242
|
+
|
243
|
+
# make this configuration inheritable for subclasses. Useful for ActiveRecord's STI.
|
244
|
+
# Default: `false`
|
245
|
+
#
|
246
|
+
# user.subclasses_inherit_config =
|
247
|
+
|
248
|
+
|
249
|
+
# -- remember_me --
|
250
|
+
# How long in seconds the session length will be
|
251
|
+
# Default: `604800`
|
252
|
+
#
|
253
|
+
# user.remember_me_for =
|
254
|
+
|
255
|
+
|
256
|
+
# -- user_activation --
|
257
|
+
# the attribute name to hold activation state (active/pending).
|
258
|
+
# Default: `:activation_state`
|
259
|
+
#
|
260
|
+
# user.activation_state_attribute_name =
|
261
|
+
|
262
|
+
|
263
|
+
# the attribute name to hold activation code (sent by email).
|
264
|
+
# Default: `:activation_token`
|
265
|
+
#
|
266
|
+
# user.activation_token_attribute_name =
|
267
|
+
|
268
|
+
|
269
|
+
# the attribute name to hold activation code expiration date.
|
270
|
+
# Default: `:activation_token_expires_at`
|
271
|
+
#
|
272
|
+
# user.activation_token_expires_at_attribute_name =
|
273
|
+
|
274
|
+
|
275
|
+
# how many seconds before the activation code expires. nil for never expires.
|
276
|
+
# Default: `nil`
|
277
|
+
#
|
278
|
+
# user.activation_token_expiration_period =
|
279
|
+
|
280
|
+
|
281
|
+
# your mailer class. Required.
|
282
|
+
# Default: `nil`
|
283
|
+
#
|
284
|
+
# user.user_activation_mailer =
|
285
|
+
|
286
|
+
|
287
|
+
# when true sorcery will not automatically
|
288
|
+
# email activation details and allow you to
|
289
|
+
# manually handle how and when email is sent.
|
290
|
+
# Default: `false`
|
291
|
+
#
|
292
|
+
# user.activation_mailer_disabled =
|
293
|
+
|
294
|
+
|
295
|
+
# activation needed email method on your mailer class.
|
296
|
+
# Default: `:activation_needed_email`
|
297
|
+
#
|
298
|
+
# user.activation_needed_email_method_name =
|
299
|
+
|
300
|
+
|
301
|
+
# activation success email method on your mailer class.
|
302
|
+
# Default: `:activation_success_email`
|
303
|
+
#
|
304
|
+
# user.activation_success_email_method_name =
|
305
|
+
|
306
|
+
|
307
|
+
# do you want to prevent or allow users that did not activate by email to login?
|
308
|
+
# Default: `true`
|
309
|
+
#
|
310
|
+
# user.prevent_non_active_users_to_login =
|
311
|
+
|
312
|
+
|
313
|
+
# -- reset_password --
|
314
|
+
# reset password code attribute name.
|
315
|
+
# Default: `:reset_password_token`
|
316
|
+
#
|
317
|
+
# user.reset_password_token_attribute_name =
|
318
|
+
|
319
|
+
|
320
|
+
# expires at attribute name.
|
321
|
+
# Default: `:reset_password_token_expires_at`
|
322
|
+
#
|
323
|
+
# user.reset_password_token_expires_at_attribute_name =
|
324
|
+
|
325
|
+
|
326
|
+
# when was email sent, used for hammering protection.
|
327
|
+
# Default: `:reset_password_email_sent_at`
|
328
|
+
#
|
329
|
+
# user.reset_password_email_sent_at_attribute_name =
|
330
|
+
|
331
|
+
|
332
|
+
# mailer class. Needed.
|
333
|
+
# Default: `nil`
|
334
|
+
#
|
335
|
+
user.reset_password_mailer = Curupira::ResetPasswordMailer
|
336
|
+
|
337
|
+
|
338
|
+
# reset password email method on your mailer class.
|
339
|
+
# Default: `:reset_password_email`
|
340
|
+
#
|
341
|
+
user.reset_password_email_method_name = :instructions
|
342
|
+
|
343
|
+
|
344
|
+
# when true sorcery will not automatically
|
345
|
+
# email password reset details and allow you to
|
346
|
+
# manually handle how and when email is sent
|
347
|
+
# Default: `false`
|
348
|
+
#
|
349
|
+
# user.reset_password_mailer_disabled =
|
350
|
+
|
351
|
+
|
352
|
+
# how many seconds before the reset request expires. nil for never expires.
|
353
|
+
# Default: `nil`
|
354
|
+
#
|
355
|
+
# user.reset_password_expiration_period =
|
356
|
+
|
357
|
+
|
358
|
+
# hammering protection, how long in seconds to wait before allowing another email to be sent.
|
359
|
+
# Default: `5 * 60`
|
360
|
+
#
|
361
|
+
# user.reset_password_time_between_emails =
|
362
|
+
|
363
|
+
|
364
|
+
# -- brute_force_protection --
|
365
|
+
# Failed logins attribute name.
|
366
|
+
# Default: `:failed_logins_count`
|
367
|
+
#
|
368
|
+
# user.failed_logins_count_attribute_name =
|
369
|
+
|
370
|
+
|
371
|
+
# This field indicates whether user is banned and when it will be active again.
|
372
|
+
# Default: `:lock_expires_at`
|
373
|
+
#
|
374
|
+
# user.lock_expires_at_attribute_name =
|
375
|
+
|
376
|
+
|
377
|
+
# How many failed logins allowed.
|
378
|
+
# Default: `50`
|
379
|
+
#
|
380
|
+
# user.consecutive_login_retries_amount_limit =
|
381
|
+
|
382
|
+
|
383
|
+
# How long the user should be banned. in seconds. 0 for permanent.
|
384
|
+
# Default: `60 * 60`
|
385
|
+
#
|
386
|
+
# user.login_lock_time_period =
|
387
|
+
|
388
|
+
# Unlock token attribute name
|
389
|
+
# Default: `:unlock_token`
|
390
|
+
#
|
391
|
+
# user.unlock_token_attribute_name =
|
392
|
+
|
393
|
+
# Unlock token mailer method
|
394
|
+
# Default: `:send_unlock_token_email`
|
395
|
+
#
|
396
|
+
# user.unlock_token_email_method_name =
|
397
|
+
|
398
|
+
# when true sorcery will not automatically
|
399
|
+
# send email with unlock token
|
400
|
+
# Default: `false`
|
401
|
+
#
|
402
|
+
# user.unlock_token_mailer_disabled = true
|
403
|
+
|
404
|
+
# Unlock token mailer class
|
405
|
+
# Default: `nil`
|
406
|
+
#
|
407
|
+
# user.unlock_token_mailer = UserMailer
|
408
|
+
|
409
|
+
# -- activity logging --
|
410
|
+
# Last login attribute name.
|
411
|
+
# Default: `:last_login_at`
|
412
|
+
#
|
413
|
+
# user.last_login_at_attribute_name =
|
414
|
+
|
415
|
+
|
416
|
+
# Last logout attribute name.
|
417
|
+
# Default: `:last_logout_at`
|
418
|
+
#
|
419
|
+
# user.last_logout_at_attribute_name =
|
420
|
+
|
421
|
+
|
422
|
+
# Last activity attribute name.
|
423
|
+
# Default: `:last_activity_at`
|
424
|
+
#
|
425
|
+
# user.last_activity_at_attribute_name =
|
426
|
+
|
427
|
+
|
428
|
+
# How long since last activity is the user defined logged out?
|
429
|
+
# Default: `10 * 60`
|
430
|
+
#
|
431
|
+
# user.activity_timeout =
|
432
|
+
|
433
|
+
|
434
|
+
# -- external --
|
435
|
+
# Class which holds the various external provider data for this user.
|
436
|
+
# Default: `nil`
|
437
|
+
#
|
438
|
+
# user.authentications_class =
|
439
|
+
|
440
|
+
|
441
|
+
# User's identifier in authentications class.
|
442
|
+
# Default: `:user_id`
|
443
|
+
#
|
444
|
+
# user.authentications_user_id_attribute_name =
|
445
|
+
|
446
|
+
|
447
|
+
# Provider's identifier in authentications class.
|
448
|
+
# Default: `:provider`
|
449
|
+
#
|
450
|
+
# user.provider_attribute_name =
|
451
|
+
|
452
|
+
|
453
|
+
# User's external unique identifier in authentications class.
|
454
|
+
# Default: `:uid`
|
455
|
+
#
|
456
|
+
# user.provider_uid_attribute_name =
|
457
|
+
end
|
458
|
+
|
459
|
+
# This line must come after the 'user config' block.
|
460
|
+
# Define which model authenticates with sorcery.
|
461
|
+
config.user_class = "User"
|
462
|
+
end
|