omniauth.rb 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. Dir[ Rails.root.join('lib', 'omniauth', '*') ].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 :gitlab_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. # oauth2 database connect
  38. provider :oauth2_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database', {
  39. client_options: {
  40. site: 'https://not_change_will_be_set_by_database',
  41. authorize_url: '/oauth/authorize',
  42. token_url: '/oauth/token',
  43. },
  44. }
  45. # weibo database connect
  46. provider :weibo_database, 'not_change_will_be_set_by_database', 'not_change_will_be_set_by_database'
  47. # SAML database connect
  48. provider :saml_database
  49. end
  50. # This fixes issue #1642 and is required for setups in which Zammad is used
  51. # with a reverse proxy (like e.g. NGINX) handling the HTTPS stuff.
  52. # This leads to the generation of a wrong redirect_uri because Rack detects a
  53. # HTTP request which breaks OAuth2.
  54. OmniAuth.config.full_host = proc {
  55. "#{Setting.get('http_type')}://#{Setting.get('fqdn')}"
  56. }