omniauth.rb 2.1 KB

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