saml_database.rb 797 B

1234567891011121314151617181920212223242526
  1. class SamlDatabase < OmniAuth::Strategies::SAML
  2. option :name, 'saml'
  3. def initialize(app, *args, &block)
  4. http_type = Setting.get('http_type')
  5. fqdn = Setting.get('fqdn')
  6. # Use meta URL as entity id/issues as it is best practice.
  7. # See: https://community.zammad.org/t/saml-oidc-third-party-authentication/2533/13
  8. entity_id = "#{http_type}://#{fqdn}/auth/saml/metadata"
  9. assertion_consumer_service_url = "#{http_type}://#{fqdn}/auth/saml/callback"
  10. config = Setting.get('auth_saml_credentials') || {}
  11. options = config.reject { |_k, v| v.blank? }
  12. .merge(
  13. assertion_consumer_service_url: assertion_consumer_service_url,
  14. issuer: entity_id,
  15. )
  16. args[0] = options
  17. super
  18. end
  19. end