X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b42a11ea4126c176edb290abb61721000c59f0d2..4a1735427d84743f6c2f3576263fdcae397cf9e9:/services/api/app/models/api_client.rb diff --git a/services/api/app/models/api_client.rb b/services/api/app/models/api_client.rb index c914051a34..791b971680 100644 --- a/services/api/app/models/api_client.rb +++ b/services/api/app/models/api_client.rb @@ -32,7 +32,13 @@ class ApiClient < ArvadosModel end Rails.configuration.Login.TrustedClients.keys.each do |url| - if norm_url_prefix == norm(url) + trusted = norm(url) + if norm_url_prefix == trusted + return true + end + if trusted.host.to_s.starts_with?("*.") && + norm_url_prefix.to_s.starts_with?(trusted.scheme + "://") && + norm_url_prefix.to_s.ends_with?(trusted.to_s[trusted.scheme.length + 4...]) return true end end @@ -43,13 +49,14 @@ class ApiClient < ArvadosModel def norm url # normalize URL for comparison url = URI(url.to_s) - if url.scheme == "https" - url.port == "443" - end - if url.scheme == "http" - url.port == "80" + if url.scheme == "https" && url.port == "" + url.port = "443" + elsif url.scheme == "http" && url.port == "" + url.port = "80" end url.path = "/" + url.query = nil + url.fragment = nil url end end