lib/liberty_buildpack/util/cache/authentication_utils.rb
# Checks config/auth.yml for authorization data associated with
# the URL and updates request accordingly.
#
# @param [Net::HTTPHeader] request causing authentication exception
# @param [String] URL the authorization is required for
# @return [Boolean] true if 'Authorization' header was updated
Checks config/auth.yml for authorization data associated with
the URL and updates request accordingly.
Checks config / auth . yml for authorization data associated with the URL and updates request accordingly .
def authorization(request, url)
        unless request.key? HTTP_Authorization
          value = authorization_value(url)
          if value.instance_of? String
            request[HTTP_Authorization] = value
            return true
          elsif (value.instance_of? Hash) && (value.key? USER_KEY) && (value.key? PASS_KEY)
            request.basic_auth value[USER_KEY], value[PASS_KEY]
            return true
          end
        end
        false
      end
def authorization ( request , url ) unless request . key? HTTP_Authorization value = authorization_value ( url ) if value . instance_of? String request [ HTTP_Authorization ] = value return true elsif ( value . instance_of? Hash ) && ( value . key? USER_KEY ) && ( value . key? PASS_KEY ) request . basic_auth value [ USER_KEY ] , value [ PASS_KEY ] return true end end false end
Checks config/auth.yml for authorization data associated with
the URL and updates request accordingly.
Checks config / auth . yml for authorization data associated with the URL and updates request accordingly .
true if 'Authorization' header was updated
true if ' Authorization ' header was updated
Boolean
request
url
URL the authorization is required for
URL the authorization is required for