Class AuthExtension

java.lang.Object
io.github.intisy.gradle.github.extension.AuthExtension

public class AuthExtension extends Object
Extension for configuring GitHub authentication credentials.
 github {
     auth {
         token     = "ghp_..."                 // a Personal Access Token
         tokenFile = file("secrets/github.txt") // a file that contains a token
         sshKey    = file("~/.ssh/id_ed25519")  // an SSH private key for git clone/pull
     }
 }
 

The token (used for REST calls and HTTPS git operations) is resolved with the precedence tokentokenFile. The sshKey is independent and drives git transport over SSH. All fields are optional; when none are set the plugin operates unauthenticated (public repositories only).

  • Constructor Details

    • AuthExtension

      public AuthExtension()
  • Method Details

    • setToken

      public void setToken(String token)
      Sets an explicit GitHub token (Personal Access Token) used for REST calls and HTTPS git operations.
      Parameters:
      token - the token value.
    • getToken

      public String getToken()
      Returns:
      the explicit token, or null if none was set.
    • setTokenFile

      public void setTokenFile(File tokenFile)
      Sets a file whose contents are a GitHub token. Used when token is not set.
      Parameters:
      tokenFile - the file containing the token.
    • setTokenFile

      public void setTokenFile(Path tokenFile)
      Sets a path to a file whose contents are a GitHub token.
      Parameters:
      tokenFile - the path to the file containing the token.
    • getTokenFile

      public File getTokenFile()
      Returns:
      the token file, or null if none was set.
    • setSshKey

      public void setSshKey(File sshKey)
      Sets the SSH private key file used for git clone/pull over SSH.
      Parameters:
      sshKey - the private key file.
    • setSshKey

      public void setSshKey(Path sshKey)
      Sets the path to the SSH private key file used for git clone/pull over SSH.
      Parameters:
      sshKey - the path to the private key file.
    • getSshKey

      public File getSshKey()
      Returns:
      the SSH private key file, or null if none was set.