auth

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator struct {
	// contains filtered or unexported fields
}

Authenticator handles GitHub App authentication.

func NewAuthenticator

func NewAuthenticator() *Authenticator

NewAuthenticator creates a new authenticator.

func (*Authenticator) GenerateJWT

func (a *Authenticator) GenerateJWT(appID int64, privateKeyPath string) (string, error)

GenerateJWT generates a JWT token for the GitHub App (legacy file-based method).

func (*Authenticator) GenerateJWTForApp

func (a *Authenticator) GenerateJWTForApp(app *config.GitHubApp) (string, error)

GenerateJWTForApp generates a JWT token using the app's configured private key source.

func (*Authenticator) GetCredentials

func (a *Authenticator) GetCredentials(app *config.GitHubApp, repoURL string) (token, username string, err error)

GetCredentials returns username and token for git credential helper.

Example

Example showing the authentication flow

// This example shows the expected flow for GetCredentials
// Real implementation requires GitHub API mock server

fmt.Println("Authentication flow:")
fmt.Println("1. Check cache for existing token")
fmt.Println("2. If not cached, generate JWT")
fmt.Println("3. Exchange JWT for installation token")
fmt.Println("4. Cache the installation token")
fmt.Println("5. Return token and username")
Output:
Authentication flow:
1. Check cache for existing token
2. If not cached, generate JWT
3. Exchange JWT for installation token
4. Cache the installation token
5. Return token and username

func (*Authenticator) GetInstallationToken

func (a *Authenticator) GetInstallationToken(jwtToken string, installationID int64, repoURL string) (string, error)

GetInstallationToken exchanges JWT for an installation access token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL