diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2019-04-05 16:02:56 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2019-04-05 16:02:56 +0300 |
commit | 46b1b9c1d61c269588bd3cd4203420608ddd7f0b (patch) | |
tree | a877f5366d3367e1264e96f3f5e8a4b23bdbd62a /lib/gitlab/external_authorization/response.rb | |
parent | 7a48a06cf3b454021aa466464686fee8c82d6862 (diff) |
Revert "Merge branch 'if-57131-external_auth_to_ce' into 'master'"
This reverts merge request !26823
Diffstat (limited to 'lib/gitlab/external_authorization/response.rb')
-rw-r--r-- | lib/gitlab/external_authorization/response.rb | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/gitlab/external_authorization/response.rb b/lib/gitlab/external_authorization/response.rb deleted file mode 100644 index 4f3fe5882db..00000000000 --- a/lib/gitlab/external_authorization/response.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module ExternalAuthorization - class Response - include ::Gitlab::Utils::StrongMemoize - - def initialize(excon_response) - @excon_response = excon_response - end - - def valid? - @excon_response && [200, 401, 403].include?(@excon_response.status) - end - - def successful? - valid? && @excon_response.status == 200 - end - - def reason - parsed_response['reason'] if parsed_response - end - - private - - def parsed_response - strong_memoize(:parsed_response) { parse_response! } - end - - def parse_response! - JSON.parse(@excon_response.body) - rescue JSON::JSONError - # The JSON response is optional, so don't fail when it's missing - nil - end - end - end -end |