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.

Files changed (181) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +19 -0
  5. data/Gemfile +17 -0
  6. data/Gemfile.lock +202 -0
  7. data/README.md +72 -0
  8. data/Rakefile +31 -0
  9. data/app/controllers/curupira/authorized_controller.rb +9 -0
  10. data/app/controllers/curupira/groups_controller.rb +43 -0
  11. data/app/controllers/curupira/passwords_controller.rb +46 -0
  12. data/app/controllers/curupira/roles_controller.rb +43 -0
  13. data/app/controllers/curupira/sessions_controller.rb +30 -0
  14. data/app/controllers/curupira/users_controller.rb +47 -0
  15. data/app/helpers/curupira/authorize_helper.rb +21 -0
  16. data/app/helpers/curupira/relationship_select_options_helper.rb +17 -0
  17. data/app/mailers/curupira/reset_password_mailer.rb +13 -0
  18. data/app/views/curupira/groups/_form.html.erb +28 -0
  19. data/app/views/curupira/groups/_role_group_fields.html.erb +9 -0
  20. data/app/views/curupira/groups/edit.html.erb +3 -0
  21. data/app/views/curupira/groups/index.html.erb +24 -0
  22. data/app/views/curupira/groups/new.html.erb +3 -0
  23. data/app/views/curupira/groups/show.html.erb +32 -0
  24. data/app/views/curupira/passwords/edit.html.erb +14 -0
  25. data/app/views/curupira/passwords/new.html.erb +14 -0
  26. data/app/views/curupira/reset_password_mailer/instructions.html.erb +19 -0
  27. data/app/views/curupira/reset_password_mailer/reseted.html.erb +7 -0
  28. data/app/views/curupira/roles/_authorization_fields.html.erb +10 -0
  29. data/app/views/curupira/roles/_form.html.erb +23 -0
  30. data/app/views/curupira/roles/edit.html.erb +3 -0
  31. data/app/views/curupira/roles/index.html.erb +24 -0
  32. data/app/views/curupira/roles/new.html.erb +3 -0
  33. data/app/views/curupira/roles/show.html.erb +37 -0
  34. data/app/views/curupira/sessions/new.html.erb +17 -0
  35. data/app/views/curupira/shared/_model_links.html.erb +7 -0
  36. data/app/views/curupira/shared/_session_links.html.erb +7 -0
  37. data/app/views/curupira/users/_form.html.erb +43 -0
  38. data/app/views/curupira/users/_group_user_fields.html.erb +20 -0
  39. data/app/views/curupira/users/_role_group_user_fields.html.erb +10 -0
  40. data/app/views/curupira/users/edit.html.erb +3 -0
  41. data/app/views/curupira/users/index.html.erb +28 -0
  42. data/app/views/curupira/users/new.html.erb +3 -0
  43. data/app/views/curupira/users/show.html.erb +28 -0
  44. data/curupira.gemspec +28 -0
  45. data/lib/curupira.rb +16 -0
  46. data/lib/curupira/authorizer.rb +43 -0
  47. data/lib/curupira/rails.rb +30 -0
  48. data/lib/curupira/rails/routes.rb +15 -0
  49. data/lib/curupira/version.rb +3 -0
  50. data/lib/generators/curupira/controllers/controllers_generator.rb +27 -0
  51. data/lib/generators/curupira/install/install_generator.rb +80 -0
  52. data/lib/generators/curupira/install/model_generators_helper.rb +266 -0
  53. data/lib/generators/curupira/routes/routes_generator.rb +21 -0
  54. data/lib/generators/curupira/routes/templates/routes.rb +1 -0
  55. data/lib/generators/curupira/templates/db/migrate/add_curupira_to_users.rb +20 -0
  56. data/lib/generators/curupira/templates/db/migrate/create_action_labels.rb +12 -0
  57. data/lib/generators/curupira/templates/db/migrate/create_authorizations.rb +12 -0
  58. data/lib/generators/curupira/templates/db/migrate/create_features.rb +11 -0
  59. data/lib/generators/curupira/templates/db/migrate/create_group_users.rb +13 -0
  60. data/lib/generators/curupira/templates/db/migrate/create_groups.rb +10 -0
  61. data/lib/generators/curupira/templates/db/migrate/create_role_group_users.rb +12 -0
  62. data/lib/generators/curupira/templates/db/migrate/create_role_groups.rb +13 -0
  63. data/lib/generators/curupira/templates/db/migrate/create_roles.rb +8 -0
  64. data/lib/generators/curupira/templates/db/migrate/sorcery_core.rb +27 -0
  65. data/lib/generators/curupira/templates/models/action_label.rb +2 -0
  66. data/lib/generators/curupira/templates/models/authorization.rb +2 -0
  67. data/lib/generators/curupira/templates/models/feature.rb +2 -0
  68. data/lib/generators/curupira/templates/models/feature_service.rb +4 -0
  69. data/lib/generators/curupira/templates/models/group.rb +2 -0
  70. data/lib/generators/curupira/templates/models/group_user.rb +2 -0
  71. data/lib/generators/curupira/templates/models/role.rb +2 -0
  72. data/lib/generators/curupira/templates/models/role_group.rb +2 -0
  73. data/lib/generators/curupira/templates/models/role_group_user.rb +2 -0
  74. data/lib/generators/curupira/templates/models/service.rb +2 -0
  75. data/lib/generators/curupira/templates/models/user.rb +2 -0
  76. data/lib/generators/curupira/templates/sorcery.rb +462 -0
  77. data/lib/generators/curupira/views/views_generator.rb +27 -0
  78. data/lib/tasks/curupira_tasks.rake +4 -0
  79. data/spec/app_templates/app/models/action_label.rb +2 -0
  80. data/spec/app_templates/app/models/authorization.rb +2 -0
  81. data/spec/app_templates/app/models/feature.rb +2 -0
  82. data/spec/app_templates/app/models/feature_service.rb +2 -0
  83. data/spec/app_templates/app/models/group.rb +4 -0
  84. data/spec/app_templates/app/models/group_user.rb +2 -0
  85. data/spec/app_templates/app/models/role.rb +2 -0
  86. data/spec/app_templates/app/models/role_group.rb +2 -0
  87. data/spec/app_templates/app/models/role_group_user.rb +2 -0
  88. data/spec/app_templates/app/models/service.rb +2 -0
  89. data/spec/app_templates/app/models/user.rb +2 -0
  90. data/spec/app_templates/config/routes.rb +3 -0
  91. data/spec/controllers/controller_spec.rb +40 -0
  92. data/spec/controllers/groups_controller_spec.rb +162 -0
  93. data/spec/controllers/passwords_controller_spec.rb +171 -0
  94. data/spec/controllers/roles_controller_spec.rb +168 -0
  95. data/spec/controllers/sessions_controller_spec.rb +112 -0
  96. data/spec/controllers/users_controller_spec.rb +182 -0
  97. data/spec/curupira/authorization_spec.rb +67 -0
  98. data/spec/dummy/README.rdoc +28 -0
  99. data/spec/dummy/Rakefile +6 -0
  100. data/spec/dummy/app/assets/images/.keep +0 -0
  101. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  102. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  103. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  104. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  105. data/spec/dummy/app/controllers/home_controller.rb +4 -0
  106. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  107. data/spec/dummy/app/mailers/.keep +0 -0
  108. data/spec/dummy/app/models/.keep +0 -0
  109. data/spec/dummy/app/models/action_label.rb +3 -0
  110. data/spec/dummy/app/models/authorization.rb +4 -0
  111. data/spec/dummy/app/models/feature.rb +3 -0
  112. data/spec/dummy/app/models/group.rb +9 -0
  113. data/spec/dummy/app/models/group_user.rb +7 -0
  114. data/spec/dummy/app/models/role.rb +10 -0
  115. data/spec/dummy/app/models/role_group.rb +4 -0
  116. data/spec/dummy/app/models/role_group_user.rb +4 -0
  117. data/spec/dummy/app/models/user.rb +10 -0
  118. data/spec/dummy/app/views/home/index.html.erb +5 -0
  119. data/spec/dummy/app/views/home/test.html.erb +1 -0
  120. data/spec/dummy/app/views/layouts/application.html.erb +19 -0
  121. data/spec/dummy/bin/bundle +3 -0
  122. data/spec/dummy/bin/rails +4 -0
  123. data/spec/dummy/bin/rake +4 -0
  124. data/spec/dummy/bin/setup +29 -0
  125. data/spec/dummy/config.ru +4 -0
  126. data/spec/dummy/config/application.rb +25 -0
  127. data/spec/dummy/config/boot.rb +5 -0
  128. data/spec/dummy/config/database.yml +25 -0
  129. data/spec/dummy/config/environment.rb +5 -0
  130. data/spec/dummy/config/environments/development.rb +46 -0
  131. data/spec/dummy/config/environments/production.rb +79 -0
  132. data/spec/dummy/config/environments/test.rb +44 -0
  133. data/spec/dummy/config/initializers/assets.rb +11 -0
  134. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  135. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  136. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  137. data/spec/dummy/config/initializers/inflections.rb +16 -0
  138. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  139. data/spec/dummy/config/initializers/session_store.rb +3 -0
  140. data/spec/dummy/config/initializers/sorcery.rb +462 -0
  141. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  142. data/spec/dummy/config/locales/en.yml +23 -0
  143. data/spec/dummy/config/routes.rb +6 -0
  144. data/spec/dummy/config/secrets.yml +22 -0
  145. data/spec/dummy/db/migrate/20150305011941_create_role_group_users.rb +12 -0
  146. data/spec/dummy/db/migrate/20150305011942_create_authorizations.rb +12 -0
  147. data/spec/dummy/db/migrate/20150305011944_create_groups.rb +10 -0
  148. data/spec/dummy/db/migrate/20150305011945_create_roles.rb +8 -0
  149. data/spec/dummy/db/migrate/20150305011946_sorcery_core.rb +27 -0
  150. data/spec/dummy/db/migrate/20150305011947_create_group_users.rb +13 -0
  151. data/spec/dummy/db/migrate/20150305011948_create_role_groups.rb +13 -0
  152. data/spec/dummy/db/migrate/20150312181229_create_action_labels.rb +12 -0
  153. data/spec/dummy/db/migrate/20150312181747_create_features.rb +11 -0
  154. data/spec/dummy/db/schema.rb +112 -0
  155. data/spec/dummy/db/seeds.rb +137 -0
  156. data/spec/dummy/lib/assets/.keep +0 -0
  157. data/spec/dummy/log/.keep +0 -0
  158. data/spec/dummy/public/404.html +67 -0
  159. data/spec/dummy/public/422.html +67 -0
  160. data/spec/dummy/public/500.html +66 -0
  161. data/spec/dummy/public/favicon.ico +0 -0
  162. data/spec/features/link_authorize_spec.rb +25 -0
  163. data/spec/features/list_users_spec.rb +38 -0
  164. data/spec/features/log_in_spec.rb +15 -0
  165. data/spec/generators/curupira/install/action_label_spec.rb +53 -0
  166. data/spec/generators/curupira/install/authorization_generator_spec.rb +51 -0
  167. data/spec/generators/curupira/install/feature_generator_spec.rb +52 -0
  168. data/spec/generators/curupira/install/group_user_generator_spec.rb +51 -0
  169. data/spec/generators/curupira/install/install_generators_spec.rb +159 -0
  170. data/spec/generators/curupira/install/role_generator_spec.rb +38 -0
  171. data/spec/generators/curupira/install/role_group_generator_spec.rb +51 -0
  172. data/spec/generators/curupira/install/role_group_user_generator_spec.rb +52 -0
  173. data/spec/helpers/relationship_select_options_helper_spec.rb +18 -0
  174. data/spec/rails_helper.rb +55 -0
  175. data/spec/spec_helper.rb +87 -0
  176. data/spec/support/factories.rb +64 -0
  177. data/spec/support/generator_spec_helpers.rb +42 -0
  178. data/spec/support/helpers_spec.rb +23 -0
  179. data/spec/support/shared_examples/role_generator_shared_example_spec.rb +13 -0
  180. data/spec/support/sorcery.rb +4 -0
  181. metadata +539 -0
@@ -0,0 +1,79 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # Code is not reloaded between requests.
5
+ config.cache_classes = true
6
+
7
+ # Eager load code on boot. This eager loads most of Rails and
8
+ # your application in memory, allowing both threaded web servers
9
+ # and those relying on copy on write to perform better.
10
+ # Rake tasks automatically ignore this option for performance.
11
+ config.eager_load = true
12
+
13
+ # Full error reports are disabled and caching is turned on.
14
+ config.consider_all_requests_local = false
15
+ config.action_controller.perform_caching = true
16
+
17
+ # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
+ # Add `rack-cache` to your Gemfile before enabling this.
19
+ # For large-scale production use, consider using a caching reverse proxy like
20
+ # NGINX, varnish or squid.
21
+ # config.action_dispatch.rack_cache = true
22
+
23
+ # Disable serving static files from the `/public` folder by default since
24
+ # Apache or NGINX already handles this.
25
+ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
26
+
27
+ # Compress JavaScripts and CSS.
28
+ config.assets.js_compressor = :uglifier
29
+ # config.assets.css_compressor = :sass
30
+
31
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
32
+ config.assets.compile = false
33
+
34
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
35
+ # yet still be able to expire them through the digest params.
36
+ config.assets.digest = true
37
+
38
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
39
+
40
+ # Specifies the header that your server uses for sending files.
41
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
42
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
43
+
44
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45
+ # config.force_ssl = true
46
+
47
+ # Use the lowest log level to ensure availability of diagnostic information
48
+ # when problems arise.
49
+ config.log_level = :debug
50
+
51
+ # Prepend all log lines with the following tags.
52
+ # config.log_tags = [ :subdomain, :uuid ]
53
+
54
+ # Use a different logger for distributed setups.
55
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
56
+
57
+ # Use a different cache store in production.
58
+ # config.cache_store = :mem_cache_store
59
+
60
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
61
+ # config.action_controller.asset_host = 'http://assets.example.com'
62
+
63
+ # Ignore bad email addresses and do not raise email delivery errors.
64
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
65
+ # config.action_mailer.raise_delivery_errors = false
66
+
67
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
68
+ # the I18n.default_locale when a translation cannot be found).
69
+ config.i18n.fallbacks = true
70
+
71
+ # Send deprecation notices to registered listeners.
72
+ config.active_support.deprecation = :notify
73
+
74
+ # Use default logging formatter so that PID and timestamp are not suppressed.
75
+ config.log_formatter = ::Logger::Formatter.new
76
+
77
+ # Do not dump schema after migrations.
78
+ config.active_record.dump_schema_after_migration = false
79
+ end
@@ -0,0 +1,44 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Randomize the order test cases are executed.
35
+ config.active_support.test_order = :random
36
+
37
+ # Print deprecation notices to the stderr.
38
+ config.active_support.deprecation = :stderr
39
+
40
+ # Raises error for missing translations
41
+ # config.action_view.raise_on_missing_translations = true
42
+
43
+ default_url_options[:host] = "host.test"
44
+ end
@@ -0,0 +1,11 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
11
+ # Rails.application.config.assets.precompile += %w( search.js )
@@ -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,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -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