<commit_before>module BeachApiCore::UserInteractor
  class AuthenticateApplication
    include Interactor

    def call
      if context.headers.present?
        application_id, application_secret = context.headers.split(',')
        application_id.gsub!('application_id', '').to_s.strip!
        application_secret.gsub!('client_secret', '').to_s.strip!
        application = Doorkeeper::Application.find_by(uid: application_id)

        if application.blank? || application.secret != application_secret
          context.status = :unauthorized
          context.fail! message: ['Application ID and/or secret are not correct']
        end
        context.application = application
        context.application_id = application.id
      else
        context.status = :unauthorized
        context.fail! message: ['Require Application ID and secret']
      end
    end
  end
end<commit_msg>Add skip_headers for auth interactor<commit_after>module BeachApiCore::UserInteractor
  class AuthenticateApplication
    include Interactor

    def call
      if context.headers.present?
        application_id, application_secret = context.headers.split(',')
        application_id.gsub!('application_id', '').to_s.strip!
        application_secret.gsub!('client_secret', '').to_s.strip!
        application = Doorkeeper::Application.find_by(uid: application_id)

        if application.blank? || application.secret != application_secret
          context.status = :unauthorized
          context.fail! message: ['Application ID and/or secret are not correct']
        end
        context.application = application
        context.application_id = application.id
      elsif !context.skip_headers
        context.status = :unauthorized
        context.fail! message: ['Require Application ID and secret']
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09001097694840834, 'fraction_numerical': 0.0, 'mean_word_length': 3.115124153498871, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7251847', 'n_tokens_mistral': 467, 'n_tokens_neox': 462, 'n_words': 112}