Class AllowedHostsValidator

java.lang.Object
com.microsoft.kiota.authentication.AllowedHostsValidator

public class AllowedHostsValidator extends Object
Maintains a list of valid hosts and allows authentication providers to check whether a host is valid before authenticating a request
  • Constructor Details

    • AllowedHostsValidator

      public AllowedHostsValidator(@Nonnull String... allowedHosts)
      Creates a new AllowedHostsValidator.
      Parameters:
      allowedHosts - The list of valid hosts.
  • Method Details

    • getAllowedHosts

      @Nonnull public Set<String> getAllowedHosts()
      Gets the allowed hosts. Read-only.
      Returns:
      the allowed hosts.
    • setAllowedHosts

      public void setAllowedHosts(@Nonnull Set<String> allowedHosts)
      Sets the allowed hosts.
      Parameters:
      allowedHosts - the allowed hosts.
    • isUrlHostValid

      public boolean isUrlHostValid(@Nonnull URI uri)
      Checks if the provided host is allowed.
      Parameters:
      uri - the uri to check the host for.
      Returns:
      true if the host is allowed, false otherwise.