<commit_before>module DoorkeeperSsoClient
  module Mixins
    module ControllerHelpers
      extend ActiveSupport::Concern

      module ClassMethods
        def activate_sso(scope, options = {})
          devise_group :sso, contains: [scope]

          unless options[:skip_devise_hook]
            class_eval <<-METHODS, __FILE__, __LINE__ + 1
              def authenticate_#{scope}_with_passport!
                validate_passport!
                authenticate_#{scope}_without_passport!
              end
              alias_method_chain :authenticate_#{scope}!, :passport
            METHODS
          end
        end
      end

      def validate_passport!
        if sso_signed_in?
          sign_out(current_sso) unless current_sso.passport.try(:active?)
        end
        return true
      end

    end
  end
end
<commit_msg>Use superclassing instead of alias method as it breaks loading (routes defined way later)<commit_after>module DoorkeeperSsoClient
  module Mixins
    module ControllerHelpers
      extend ActiveSupport::Concern

      module ClassMethods
        def activate_sso(scope, options = {})
          devise_group :sso, contains: [scope]

          unless options[:skip_devise_hook]
            class_eval <<-METHODS, __FILE__, __LINE__ + 1
              def authenticate_#{scope}!
                validate_passport!
                super
              end
            METHODS
          end
        end
      end

      def validate_passport!
        if sso_signed_in?
          sign_out(current_sso) unless current_sso.passport.try(:active?)
        end
        return true
      end

    end
  end
end

{'fraction_non_alphanumeric': 0.056915544675642596, 'fraction_numerical': 0.0012239902080783353, 'mean_word_length': 1.9353680430879712, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6032937', 'n_tokens_mistral': 459, 'n_tokens_neox': 441, 'n_words': 110}