Documentation
¶
Overview ¶
Package github implements connectors.OAuthClient against a GitHub App, reading AppConfig fresh on every call.
Index ¶
- type InstanceURLReader
- type OAuthClient
- func (c *OAuthClient) AuthorizeURL(state string) string
- func (c *OAuthClient) Configured() bool
- func (c *OAuthClient) Exchange(ctx context.Context, code string) (*connectors.TokenSet, error)
- func (c *OAuthClient) Refresh(ctx context.Context, refreshToken string) (*connectors.TokenSet, error)
- func (c *OAuthClient) Revoke(ctx context.Context, accessToken string) (err error)
- func (c *OAuthClient) VerifyApp(ctx context.Context, cfg connectors.AppConfig) error
- func (c *OAuthClient) VerifyKey(ctx context.Context, cfg connectors.AppConfig, privateKey string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InstanceURLReader ¶
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.