Remove EE::API::APIGuard::HelperMethods

Summary

We have duplicated find_user_from_sources logic. FOSS :

      def find_user_from_sources
        find_user_from_access_token ||
          find_user_from_job_token ||
          find_user_from_warden
      end

https://gitlab.com/gitlab-org/gitlab/blob/398ad91aefa0ad2b60c323eea29bbbe6d165c17c/lib/api/api_guard.rb#L65-69

In the EE version we have find_user_from_bearer_token :

        override :find_user_from_sources
        def find_user_from_sources
          find_user_from_bearer_token ||
            find_user_from_job_token ||
            find_user_from_warden
        end

https://gitlab.com/gitlab-org/gitlab/blob/master/ee/lib/ee/api/api_guard.rb#L9-14

See related thread here !21120 (comment 255610353)

Improvements

  • Reduce complexity by merging the functionality of the find_user_from_bearer_token and find_user_from_job_token methods.
  • Reduce an unnecessary EE prepend

Risks

  • This affects API authentication

Involved components

  • API auth

Optional: Intended side effects

Optional: Missing test coverage

Assignee Loading
Time tracking Loading