Record Class CredentialLookup.Credential

java.lang.Object
java.lang.Record
io.github.jbastgen.stemma.git.api.CredentialLookup.Credential
Enclosing interface:
CredentialLookup

public static record CredentialLookup.Credential(CredentialLookup.Kind kind, String username, String secret, Path keyFile) extends Record
A credential. For CredentialLookup.Kind.HTTPS: username and secret (password or token). For CredentialLookup.Kind.SSH_KEY: keyFile and, if the key is protected, its passphrase in secret.
  • Constructor Details

    • Credential

      public Credential(CredentialLookup.Kind kind, String username, String secret, Path keyFile)
      Creates an instance of a Credential record class.
      Parameters:
      kind - the value for the kind record component
      username - the value for the username record component
      secret - the value for the secret record component
      keyFile - the value for the keyFile record component
  • Method Details

    • https

      public static CredentialLookup.Credential https(String username, String secret)
      A user name with a password or access token for HTTPS.
    • sshKey

      public static CredentialLookup.Credential sshKey(Path keyFile, String passphrase)
      A private key file for SSH; passphrase is empty or null if the key is not protected.
    • toString

      public String toString()
      Never prints the secret.
      Specified by:
      toString in class Record
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • kind

      public CredentialLookup.Kind kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • username

      public String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • secret

      public String secret()
      Returns the value of the secret record component.
      Returns:
      the value of the secret record component
    • keyFile

      public Path keyFile()
      Returns the value of the keyFile record component.
      Returns:
      the value of the keyFile record component