X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8d3f2e69e8427c8541d1796329d63ec84955e2c5..45cc809dfeab1d603e80cec3d44770d7f5a7c8ae:/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 c9eeaf2669..015b61dc49 100644 --- a/services/api/app/models/api_client.rb +++ b/services/api/app/models/api_client.rb @@ -22,14 +22,27 @@ class ApiClient < ArvadosModel def from_trusted_url norm_url_prefix = norm(self.url_prefix) - norm_url_prefix == norm(Rails.configuration.Services.Workbench1.ExternalURL) or - norm_url_prefix == norm(Rails.configuration.Services.Workbench2.ExternalURL) or - norm_url_prefix == norm("https://controller.api.client.invalid") + + [Rails.configuration.Services.Workbench1.ExternalURL, + Rails.configuration.Services.Workbench2.ExternalURL, + "https://controller.api.client.invalid"].each do |url| + if norm_url_prefix == norm(url) + return true + end + end + + Rails.configuration.Login.TrustedClients.keys.each do |url| + if norm_url_prefix == norm(url) + return true + end + end + + false end def norm url # normalize URL for comparison - url = URI(url) + url = URI(url.to_s) if url.scheme == "https" url.port == "443" end