2020-03-16 03:09:14 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module UrlBlockers
|
2020-10-29 06:08:45 +00:00
|
|
|
class DomainAllowlistEntry
|
2020-03-16 03:09:14 +00:00
|
|
|
attr_reader :domain, :port
|
|
|
|
|
|
|
|
def initialize(domain, port: nil)
|
|
|
|
@domain = domain
|
|
|
|
@port = port
|
|
|
|
end
|
|
|
|
|
|
|
|
def match?(requested_domain, requested_port = nil)
|
|
|
|
return false unless domain == requested_domain
|
|
|
|
return true if port.nil?
|
|
|
|
|
|
|
|
port == requested_port
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|