github

package
v0.3.103-beta Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package github implements connectors.OAuthClient against a GitHub App, reading AppConfig fresh on every call.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InstanceURLReader

type InstanceURLReader interface {
	GetInstanceURL(ctx context.Context) (string, error)
}

InstanceURLReader resolves the instance's public URL live, since redirect_uri must track the current setting (T5).

type OAuthClient

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

OAuthClient implements connectors.OAuthClient for one connector id against its currently stored AppConfig.

func New

func New(connectorID string, store connectors.AppConfigStore, instanceURL InstanceURLReader, hc *http.Client) *OAuthClient

New wires the GitHub App OAuth client; hc defaults to a 15s-timeout client when nil.

func (*OAuthClient) AuthorizeURL

func (c *OAuthClient) AuthorizeURL(state string) string

AuthorizeURL uses the classic authorize flow: on an installed app, the install URL dead-ends every reconnect.

func (*OAuthClient) Configured

func (c *OAuthClient) Configured() bool

Configured implements connectors.OAuthClient; AppSlug plus client id/secret are needed to build the install URL.

func (*OAuthClient) Exchange

func (c *OAuthClient) Exchange(ctx context.Context, code string) (*connectors.TokenSet, error)

Exchange trades the code for a token, then confirms an installation exists; a token alone grants no repo access.

func (*OAuthClient) Refresh

func (c *OAuthClient) Refresh(ctx context.Context, refreshToken string) (*connectors.TokenSet, error)

Refresh implements connectors.OAuthClient.

func (*OAuthClient) Revoke

func (c *OAuthClient) Revoke(ctx context.Context, accessToken string) (err error)

Revoke calls GitHub's documented DELETE /applications/{client_id}/token revocation endpoint.

func (*OAuthClient) VerifyApp

func (c *OAuthClient) VerifyApp(ctx context.Context, cfg connectors.AppConfig) error

VerifyApp implements connectors.AppVerifier: the slug must resolve to an app with this client ID that accepts the secret.

func (*OAuthClient) VerifyKey

func (c *OAuthClient) VerifyKey(ctx context.Context, cfg connectors.AppConfig, privateKey string) error

VerifyKey implements connectors.AppKeyVerifier: GitHub must accept a JWT signed with privateKey as this App.

Jump to

Keyboard shortcuts

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