mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 13:56:50 +08:00
27e732a58d
This splits off the logic between SSO keys used incoming vs outgoing, it allows to far better restrict who is allowed to log in using a site. This allows for better auditing of the SSO provider feature
11 lines
293 B
Ruby
11 lines
293 B
Ruby
module WildcardDomainChecker
|
|
|
|
def self.check_domain(domain, external_domain)
|
|
escaped_domain = domain[0] == "*" ? Regexp.escape(domain).sub("\\*", '\S*') : Regexp.escape(domain)
|
|
domain_regex = Regexp.new("^#{escaped_domain}$", 'i')
|
|
|
|
external_domain.match(domain_regex)
|
|
end
|
|
|
|
end
|