Commit 8bda2c78 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Fix omniauth SAML patch

Patch the omniauth-saml gem in an initializer instead of
relying on the autoloader to overwrite the class
parent c9f50b1d
# frozen_string_literal: true # frozen_string_literal: true
require 'omniauth/strategies/saml'
module OmniAuth module OmniAuth
module Strategies module Strategies
class SAML class SAML
extend ::Gitlab::Utils::Override
# NOTE: This method duplicates code from omniauth-saml # NOTE: This method duplicates code from omniauth-saml
# so that we can access authn_request to store it # so that we can access authn_request to store it
# See: https://github.com/omniauth/omniauth-saml/issues/172 # See: https://github.com/omniauth/omniauth-saml/issues/172
override :request_phase
def request_phase def request_phase
authn_request = OneLogin::RubySaml::Authrequest.new authn_request = OneLogin::RubySaml::Authrequest.new
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe OmniAuth::Strategies::SAML, type: :strategy do describe 'OmniAuth::Strategies::SAML', type: :strategy do
let(:idp_sso_target_url) { 'https://login.example.com/idp' } let(:idp_sso_target_url) { 'https://login.example.com/idp' }
let(:strategy) { [OmniAuth::Strategies::SAML, { idp_sso_target_url: idp_sso_target_url }] } let(:strategy) { [OmniAuth::Strategies::SAML, { idp_sso_target_url: idp_sso_target_url }] }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment