Class FetcherCredentials

java.lang.Object
com.norconex.crawler.fs.fetch.impl.FetcherCredentials

public final class FetcherCredentials extends Object

Reads the secrets of fetchers that authenticate with a token, a key or a client secret, which were plain text configuration properties: the value can also be given as Credentials, whose password can be encrypted (and so kept out of the configuration, or supplied as a variable).

A value set on the property itself always wins, so existing configurations are read as they were.

  • Method Details

    • secret

      public static String secret(String configured, Credentials credentials)
      The secret: the configured value if there is one, otherwise the (decrypted) password of the credentials.
      Parameters:
      configured - the value of the plain property, possibly blank
      credentials - the credentials, possibly not set
      Returns:
      the secret, or the configured value (blank or null) when there is no other
    • id

      public static String id(String configured, Credentials credentials)
      The identifier that goes with the secret (a client email, a client ID): the configured value if there is one, otherwise the username of the credentials.
      Parameters:
      configured - the value of the plain property, possibly blank
      credentials - the credentials, possibly not set
      Returns:
      the identifier, or the configured value (blank or null) when there is no other