omniauth.rb 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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', {
  21. authorize_options: {
  22. access_type: 'online',
  23. approval_prompt: '',
  24. }
  25. }
  26. # github database connect
  27. provider :github_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database'
  28. # gitlab database connect
  29. provider :git_lab_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database', {
  30. client_options: {
  31. site: 'https://not_change_will_be_set_by_database',
  32. authorize_url: '/oauth/authorize',
  33. token_url: '/oauth/token'
  34. },
  35. }
  36. # microsoft_office365 database connect
  37. provider :microsoft_office365_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database'
  38. # weibo database connect
  39. provider :weibo_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database'
  40. # SAML database connect
  41. provider :saml_database
  42. end
  43. # This fixes issue #1642 and is required for setups in which Zammad is used
  44. # with a reverse proxy (like e.g. NGINX) handling the HTTPS stuff.
  45. # This leads to the generation of a wrong redirect_uri because Rack detects a
  46. # HTTP request which breaks OAuth2.
  47. OmniAuth.config.full_host = proc {
  48. "#{Setting.get('http_type')}://#{Setting.get('fqdn')}"
  49. }
  50. OmniAuth.config.logger = Rails.logger