omniauth.rb 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Dir[ Rails.root.join('lib/omniauth/*') ].sort.each do |file|
  2. if File.file?(file)
  3. require file
  4. end
  5. end
  6. Rails.application.config.middleware.use OmniAuth::Builder do
  7. # twitter database connect
  8. provider :twitter_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database', {
  9. client_options: {
  10. authorize_path: '/oauth/authorize',
  11. site: 'https://api.twitter.com',
  12. }
  13. }
  14. # facebook database connect
  15. provider :facebook_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database'
  16. # linkedin database connect
  17. provider :linked_in_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database'
  18. # google database connect
  19. provider :google_oauth2_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database', {
  20. authorize_options: {
  21. access_type: 'online',
  22. approval_prompt: '',
  23. }
  24. }
  25. # github database connect
  26. provider :github_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database'
  27. # gitlab database connect
  28. provider :git_lab_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database', {
  29. client_options: {
  30. site: 'https://not_change_will_be_set_by_database',
  31. authorize_url: '/oauth/authorize',
  32. token_url: '/oauth/token'
  33. },
  34. }
  35. # microsoft_office365 database connect
  36. provider :microsoft_office365_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database'
  37. # weibo database connect
  38. provider :weibo_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database'
  39. # SAML database connect
  40. provider :saml_database
  41. end
  42. # This fixes issue #1642 and is required for setups in which Zammad is used
  43. # with a reverse proxy (like e.g. NGINX) handling the HTTPS stuff.
  44. # This leads to the generation of a wrong redirect_uri because Rack detects a
  45. # HTTP request which breaks OAuth2.
  46. OmniAuth.config.full_host = proc {
  47. "#{Setting.get('http_type')}://#{Setting.get('fqdn')}"
  48. }
  49. OmniAuth.config.logger = Rails.logger