From c5266e98b8e89c286b1ca0b0c50f961e274af3b6 Mon Sep 17 00:00:00 2001 From: Justin Campbell Date: Tue, 7 Nov 2017 10:32:33 -0500 Subject: [PATCH] Change allowed auth hosts to list --- .../login/middleware/add_authentication.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/commands/login/middleware/add_authentication.rb b/plugins/commands/login/middleware/add_authentication.rb index c82bbf697..a784a3ac6 100644 --- a/plugins/commands/login/middleware/add_authentication.rb +++ b/plugins/commands/login/middleware/add_authentication.rb @@ -6,8 +6,10 @@ require_relative "../client" module VagrantPlugins module LoginCommand class AddAuthentication - VCLOUD = "vagrantcloud.com".freeze - ATLAS = "atlas.hashicorp.com".freeze + ALLOWED_AUTHENTICATION_HOSTS = %w[ + atlas.hashicorp.com + vagrantcloud.com + ].freeze def initialize(app, env) @app = app @@ -25,12 +27,8 @@ module VagrantPlugins replace = u.host == server_uri.host if !replace - # We need this in here for the transition we made from - # Vagrant Cloud to Atlas. This preserves access tokens - # appending to both without leaking access tokens to - # unsavory URLs. - if (u.host == VCLOUD && server_uri.host == ATLAS) || - (u.host == ATLAS && server_uri.host == VCLOUD) + if ALLOWED_AUTHENTICATION_HOSTS.include?(u.host) && + ALLOWED_AUTHENTICATION_HOSTS.include?(server_uri.host) replace = true end end