# File lib/rhc/auth/token.rb, line 17
    def to_request(request, client=nil)
      if !token and auth and @allows_tokens and client and client.supports_sessions?
        debug "Attempting to generate token"
        token_rejected(nil, client)
      end

      if token
        debug "Using token authentication"
        (request[:headers] ||= {})['authorization'] = "Bearer #{token}"
      elsif auth
        debug "Bypassing token auth"
        auth.to_request(request, client)
      end
      request
    end