githubappauth

package module
v0.0.0-...-e168fdf Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallationTokenOptions

func InstallationTokenOptions(repoName string) (*github.InstallationTokenOptions, error)

func ParsePrivateKey

func ParsePrivateKey(privateKey string) (*rsa.PrivateKey, error)

Types

type Client

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

func NewClient

func NewClient(conf *Config) (*Client, error)

func (*Client) CreateJWT

func (c *Client) CreateJWT(now time.Time) (string, error)

func (*Client) Enabled

func (c *Client) Enabled() bool

func (*Client) NewGitHubClient

func (c *Client) NewGitHubClient(ctx context.Context, baseURL string) (*github.Client, error)

func (*Client) ResolveInstallationToken

func (c *Client) ResolveInstallationToken(ctx context.Context, config *InstallationTokenConfig, repoName string) (string, error)

func (*Client) ValidateBaseURL

func (c *Client) ValidateBaseURL(baseURL string) (*url.URL, error)

type Config

type Config struct {
	AppID               string
	PrivateKey          string
	AllowedBaseURLHosts []string
}

Config is the server-side GitHub App credential set.

type InstallationTokenConfig

type InstallationTokenConfig struct {
	BaseURL        string
	InstallationID uint64
}

type OAuthClient

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

func NewOAuthClient

func NewOAuthClient(conf *OAuthConfig) (*OAuthClient, error)

func (*OAuthClient) AuthorizationURL

func (c *OAuthClient) AuthorizationURL(state string) (string, error)

func (*OAuthClient) Enabled

func (c *OAuthClient) Enabled() bool

func (*OAuthClient) ExchangeCode

func (c *OAuthClient) ExchangeCode(ctx context.Context, code string) (*oauth2.Token, error)

func (*OAuthClient) GetAuthenticatedUser

func (c *OAuthClient) GetAuthenticatedUser(ctx context.Context, token *oauth2.Token) (*github.User, error)

func (*OAuthClient) NewUserClient

func (c *OAuthClient) NewUserClient(ctx context.Context, token *oauth2.Token) (*github.Client, error)

type OAuthConfig

type OAuthConfig struct {
	ClientID                 string
	ClientSecret             string
	OAuthBaseURL             string
	APIBaseURL               string
	RedirectURL              string
	Scopes                   []string
	AllowedOAuthBaseURLHosts []string
	AllowedAPIBaseURLHosts   []string
}

OAuthConfig is the GitHub App user-to-server OAuth credential set.

Jump to

Keyboard shortcuts

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