Change allowed auth hosts to list
This commit is contained in:
parent
b3b98e77ed
commit
c5266e98b8
|
@ -6,8 +6,10 @@ require_relative "../client"
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module LoginCommand
|
module LoginCommand
|
||||||
class AddAuthentication
|
class AddAuthentication
|
||||||
VCLOUD = "vagrantcloud.com".freeze
|
ALLOWED_AUTHENTICATION_HOSTS = %w[
|
||||||
ATLAS = "atlas.hashicorp.com".freeze
|
atlas.hashicorp.com
|
||||||
|
vagrantcloud.com
|
||||||
|
].freeze
|
||||||
|
|
||||||
def initialize(app, env)
|
def initialize(app, env)
|
||||||
@app = app
|
@app = app
|
||||||
|
@ -25,12 +27,8 @@ module VagrantPlugins
|
||||||
replace = u.host == server_uri.host
|
replace = u.host == server_uri.host
|
||||||
|
|
||||||
if !replace
|
if !replace
|
||||||
# We need this in here for the transition we made from
|
if ALLOWED_AUTHENTICATION_HOSTS.include?(u.host) &&
|
||||||
# Vagrant Cloud to Atlas. This preserves access tokens
|
ALLOWED_AUTHENTICATION_HOSTS.include?(server_uri.host)
|
||||||
# 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)
|
|
||||||
replace = true
|
replace = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue