PageRenderTime 52ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/config/initializers/sorcery.rb

https://gitlab.com/intercity/intercity-next
Ruby | 463 lines | 6 code | 115 blank | 342 comment | 0 complexity | 4525bf12238d9e71d0b7391433ec670a MD5 | raw file
  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 = []
  6. # Here you can configure each submodule's features.
  7. Rails.application.config.sorcery.configure do |config|
  8. # -- core --
  9. # What controller action to call for non-authenticated users. You can also
  10. # override the 'not_authenticated' method of course.
  11. # Default: `:not_authenticated`
  12. #
  13. # config.not_authenticated_action =
  14. # When a non logged in user tries to enter a page that requires login, save
  15. # the URL he wanted to reach, and send him there after login, using 'redirect_back_or_to'.
  16. # Default: `true`
  17. #
  18. # config.save_return_to_url =
  19. # Set domain option for cookies; Useful for remember_me submodule.
  20. # Default: `nil`
  21. #
  22. # config.cookie_domain =
  23. # Allow the remember_me cookie to be set through AJAX
  24. # Default: `true`
  25. #
  26. # config.remember_me_httponly =
  27. # -- session timeout --
  28. # How long in seconds to keep the session alive.
  29. # Default: `3600`
  30. #
  31. # config.session_timeout =
  32. # Use the last action as the beginning of session timeout.
  33. # Default: `false`
  34. #
  35. # config.session_timeout_from_last_action =
  36. # -- http_basic_auth --
  37. # What realm to display for which controller name. For example {"My App" => "Application"}
  38. # Default: `{"application" => "Application"}`
  39. #
  40. # config.controller_to_realm_map =
  41. # -- activity logging --
  42. # will register the time of last user login, every login.
  43. # Default: `true`
  44. #
  45. # config.register_login_time =
  46. # will register the time of last user logout, every logout.
  47. # Default: `true`
  48. #
  49. # config.register_logout_time =
  50. # will register the time of last user action, every action.
  51. # Default: `true`
  52. #
  53. # config.register_last_activity_time =
  54. # -- external --
  55. # What providers are supported by this app, i.e. [:twitter, :facebook, :github, :linkedin, :xing, :google, :liveid, :salesforce] .
  56. # Default: `[]`
  57. #
  58. # config.external_providers =
  59. # You can change it by your local ca_file. i.e. '/etc/pki/tls/certs/ca-bundle.crt'
  60. # Path to ca_file. By default use a internal ca-bundle.crt.
  61. # Default: `'path/to/ca_file'`
  62. #
  63. # config.ca_file =
  64. # For information about LinkedIn API:
  65. # - user info fields go to https://developer.linkedin.com/documents/profile-fields
  66. # - access permissions go to https://developer.linkedin.com/documents/authentication#granting
  67. #
  68. # config.linkedin.key = ""
  69. # config.linkedin.secret = ""
  70. # config.linkedin.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=linkedin"
  71. # config.linkedin.user_info_fields = ['first-name', 'last-name']
  72. # config.linkedin.user_info_mapping = {first_name: "firstName", last_name: "lastName"}
  73. # config.linkedin.access_permissions = ['r_basicprofile']
  74. #
  75. #
  76. # For information about XING API:
  77. # - user info fields go to https://dev.xing.com/docs/get/users/me
  78. #
  79. # config.xing.key = ""
  80. # config.xing.secret = ""
  81. # config.xing.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=xing"
  82. # config.xing.user_info_mapping = {first_name: "first_name", last_name: "last_name"}
  83. #
  84. #
  85. # Twitter will not accept any requests nor redirect uri containing localhost,
  86. # make sure you use 0.0.0.0:3000 to access your app in development
  87. #
  88. # config.twitter.key = ""
  89. # config.twitter.secret = ""
  90. # config.twitter.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=twitter"
  91. # config.twitter.user_info_mapping = {:email => "screen_name"}
  92. #
  93. # config.facebook.key = ""
  94. # config.facebook.secret = ""
  95. # config.facebook.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=facebook"
  96. # config.facebook.user_info_mapping = {:email => "name"}
  97. # config.facebook.access_permissions = ["email", "publish_actions"]
  98. # config.facebook.display = "page"
  99. # config.facebook.api_version = "v2.2"
  100. #
  101. # config.github.key = ""
  102. # config.github.secret = ""
  103. # config.github.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=github"
  104. # config.github.user_info_mapping = {:email => "name"}
  105. #
  106. # config.google.key = ""
  107. # config.google.secret = ""
  108. # config.google.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=google"
  109. # config.google.user_info_mapping = {:email => "email", :username => "name"}
  110. #
  111. # config.vk.key = ""
  112. # config.vk.secret = ""
  113. # config.vk.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=vk"
  114. # config.vk.user_info_mapping = {:login => "domain", :name => "full_name"}
  115. #
  116. # To use liveid in development mode you have to replace mydomain.com with
  117. # a valid domain even in development. To use a valid domain in development
  118. # simply add your domain in your /etc/hosts file in front of 127.0.0.1
  119. #
  120. # config.liveid.key = ""
  121. # config.liveid.secret = ""
  122. # config.liveid.callback_url = "http://mydomain.com:3000/oauth/callback?provider=liveid"
  123. # config.liveid.user_info_mapping = {:username => "name"}
  124. # For information about JIRA API:
  125. # https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+Example+-+OAuth+authentication
  126. # to obtain the consumer key and the public key you can use the jira-ruby gem https://github.com/sumoheavy/jira-ruby
  127. # or run openssl req -x509 -nodes -newkey rsa:1024 -sha1 -keyout rsakey.pem -out rsacert.pem to obtain the public key
  128. # Make sure you have configured the application link properly
  129. # config.jira.key = "1234567"
  130. # config.jira.secret = "jiraTest"
  131. # config.jira.site = "http://localhost:2990/jira/plugins/servlet/oauth"
  132. # config.jira.signature_method = "RSA-SHA1"
  133. # config.jira.private_key_file = "rsakey.pem"
  134. # For information about Salesforce API:
  135. # https://developer.salesforce.com/signup &
  136. # https://www.salesforce.com/us/developer/docs/api_rest/
  137. # Salesforce callback_url must be https. You can run the following to generate self-signed ssl cert
  138. # openssl req -new -newkey rsa:2048 -sha1 -days 365 -nodes -x509 -keyout server.key -out server.crt
  139. # Make sure you have configured the application link properly
  140. # config.salesforce.key = '123123'
  141. # config.salesforce.secret = 'acb123'
  142. # config.salesforce.callback_url = "https://127.0.0.1:9292/oauth/callback?provider=salesforce"
  143. # config.salesforce.scope = "full"
  144. # config.salesforce.user_info_mapping = {:email => "email"}
  145. # --- user config ---
  146. config.user_config do |user|
  147. # -- core --
  148. # specify username attributes, for example: [:username, :email].
  149. # Default: `[:email]`
  150. #
  151. # user.username_attribute_names =
  152. # change *virtual* password attribute, the one which is used until an encrypted one is generated.
  153. # Default: `:password`
  154. #
  155. # user.password_attribute_name =
  156. # downcase the username before trying to authenticate, default is false
  157. # Default: `false`
  158. #
  159. # user.downcase_username_before_authenticating =
  160. # change default email attribute.
  161. # Default: `:email`
  162. #
  163. # user.email_attribute_name =
  164. # change default crypted_password attribute.
  165. # Default: `:crypted_password`
  166. #
  167. # user.crypted_password_attribute_name =
  168. # what pattern to use to join the password with the salt
  169. # Default: `""`
  170. #
  171. # user.salt_join_token =
  172. # change default salt attribute.
  173. # Default: `:salt`
  174. #
  175. # user.salt_attribute_name =
  176. # how many times to apply encryption to the password.
  177. # Default: `nil`
  178. #
  179. # user.stretches =
  180. # encryption key used to encrypt reversible encryptions such as AES256.
  181. # WARNING: If used for users' passwords, changing this key will leave passwords undecryptable!
  182. # Default: `nil`
  183. #
  184. # user.encryption_key =
  185. # use an external encryption class.
  186. # Default: `nil`
  187. #
  188. # user.custom_encryption_provider =
  189. # encryption algorithm name. See 'encryption_algorithm=' for available options.
  190. # Default: `:bcrypt`
  191. #
  192. # user.encryption_algorithm =
  193. # make this configuration inheritable for subclasses. Useful for ActiveRecord's STI.
  194. # Default: `false`
  195. #
  196. # user.subclasses_inherit_config =
  197. # -- remember_me --
  198. # How long in seconds the session length will be
  199. # Default: `604800`
  200. #
  201. # user.remember_me_for =
  202. # -- user_activation --
  203. # the attribute name to hold activation state (active/pending).
  204. # Default: `:activation_state`
  205. #
  206. # user.activation_state_attribute_name =
  207. # the attribute name to hold activation code (sent by email).
  208. # Default: `:activation_token`
  209. #
  210. # user.activation_token_attribute_name =
  211. # the attribute name to hold activation code expiration date.
  212. # Default: `:activation_token_expires_at`
  213. #
  214. # user.activation_token_expires_at_attribute_name =
  215. # how many seconds before the activation code expires. nil for never expires.
  216. # Default: `nil`
  217. #
  218. # user.activation_token_expiration_period =
  219. # your mailer class. Required.
  220. # Default: `nil`
  221. #
  222. # user.user_activation_mailer =
  223. # when true sorcery will not automatically
  224. # email activation details and allow you to
  225. # manually handle how and when email is sent.
  226. # Default: `false`
  227. #
  228. # user.activation_mailer_disabled =
  229. # activation needed email method on your mailer class.
  230. # Default: `:activation_needed_email`
  231. #
  232. # user.activation_needed_email_method_name =
  233. # activation success email method on your mailer class.
  234. # Default: `:activation_success_email`
  235. #
  236. # user.activation_success_email_method_name =
  237. # do you want to prevent or allow users that did not activate by email to login?
  238. # Default: `true`
  239. #
  240. # user.prevent_non_active_users_to_login =
  241. # -- reset_password --
  242. # reset password code attribute name.
  243. # Default: `:reset_password_token`
  244. #
  245. # user.reset_password_token_attribute_name =
  246. # expires at attribute name.
  247. # Default: `:reset_password_token_expires_at`
  248. #
  249. # user.reset_password_token_expires_at_attribute_name =
  250. # when was email sent, used for hammering protection.
  251. # Default: `:reset_password_email_sent_at`
  252. #
  253. # user.reset_password_email_sent_at_attribute_name =
  254. # mailer class. Needed.
  255. # Default: `nil`
  256. #
  257. # user.reset_password_mailer =
  258. # reset password email method on your mailer class.
  259. # Default: `:reset_password_email`
  260. #
  261. # user.reset_password_email_method_name =
  262. # when true sorcery will not automatically
  263. # email password reset details and allow you to
  264. # manually handle how and when email is sent
  265. # Default: `false`
  266. #
  267. # user.reset_password_mailer_disabled =
  268. # how many seconds before the reset request expires. nil for never expires.
  269. # Default: `nil`
  270. #
  271. # user.reset_password_expiration_period =
  272. # hammering protection, how long in seconds to wait before allowing another email to be sent.
  273. # Default: `5 * 60`
  274. #
  275. # user.reset_password_time_between_emails =
  276. # -- brute_force_protection --
  277. # Failed logins attribute name.
  278. # Default: `:failed_logins_count`
  279. #
  280. # user.failed_logins_count_attribute_name =
  281. # This field indicates whether user is banned and when it will be active again.
  282. # Default: `:lock_expires_at`
  283. #
  284. # user.lock_expires_at_attribute_name =
  285. # How many failed logins allowed.
  286. # Default: `50`
  287. #
  288. # user.consecutive_login_retries_amount_limit =
  289. # How long the user should be banned. in seconds. 0 for permanent.
  290. # Default: `60 * 60`
  291. #
  292. # user.login_lock_time_period =
  293. # Unlock token attribute name
  294. # Default: `:unlock_token`
  295. #
  296. # user.unlock_token_attribute_name =
  297. # Unlock token mailer method
  298. # Default: `:send_unlock_token_email`
  299. #
  300. # user.unlock_token_email_method_name =
  301. # when true sorcery will not automatically
  302. # send email with unlock token
  303. # Default: `false`
  304. #
  305. # user.unlock_token_mailer_disabled = true
  306. # Unlock token mailer class
  307. # Default: `nil`
  308. #
  309. # user.unlock_token_mailer = UserMailer
  310. # -- activity logging --
  311. # Last login attribute name.
  312. # Default: `:last_login_at`
  313. #
  314. # user.last_login_at_attribute_name =
  315. # Last logout attribute name.
  316. # Default: `:last_logout_at`
  317. #
  318. # user.last_logout_at_attribute_name =
  319. # Last activity attribute name.
  320. # Default: `:last_activity_at`
  321. #
  322. # user.last_activity_at_attribute_name =
  323. # How long since last activity is the user defined logged out?
  324. # Default: `10 * 60`
  325. #
  326. # user.activity_timeout =
  327. # -- external --
  328. # Class which holds the various external provider data for this user.
  329. # Default: `nil`
  330. #
  331. # user.authentications_class =
  332. # User's identifier in authentications class.
  333. # Default: `:user_id`
  334. #
  335. # user.authentications_user_id_attribute_name =
  336. # Provider's identifier in authentications class.
  337. # Default: `:provider`
  338. #
  339. # user.provider_attribute_name =
  340. # User's external unique identifier in authentications class.
  341. # Default: `:uid`
  342. #
  343. # user.provider_uid_attribute_name =
  344. end
  345. # This line must come after the 'user config' block.
  346. # Define which model authenticates with sorcery.
  347. config.user_class = "User"
  348. end