Documentation
¶
Overview ¶
Package githubauth implements GitHub authentication.
Index ¶
- Constants
- func NewApplicationTokenSource(id int64, privateKey []byte, opts ...ApplicationTokenOpt) (oauth2.TokenSource, error)
- func NewInstallationTokenSource(id int64, src oauth2.TokenSource, opts ...InstallationTokenSourceOpt) oauth2.TokenSource
- type ApplicationTokenOpt
- type InstallationTokenSourceOpt
- type ResourceID
Constants ¶
const ( // DefaultApplicationTokenExpiration is the default expiration time for the GitHub App token. // The expiration time of the JWT, after which it can't be used to request an installation token. // The time must be no more than 10 minutes into the future. DefaultApplicationTokenExpiration = 10 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func NewApplicationTokenSource ¶
func NewApplicationTokenSource(id int64, privateKey []byte, opts ...ApplicationTokenOpt) (oauth2.TokenSource, error)
NewApplicationTokenSource creates a new GitHub App token source. An application token is used to authenticate as a GitHub App. ID is defined as int64 just to be aligned with the go-github library.
func NewInstallationTokenSource ¶
func NewInstallationTokenSource(id int64, src oauth2.TokenSource, opts ...InstallationTokenSourceOpt) oauth2.TokenSource
NewInstallationTokenSource creates a new GitHub App installation token source. ID is defined as int64 just to be aligned with the go-github library.
Types ¶
type ApplicationTokenOpt ¶
type ApplicationTokenOpt func(*applicationTokenSource)
ApplicationTokenOpt is a functional option for ApplicationTokenSource.
func WithApplicationTokenExpiration ¶
func WithApplicationTokenExpiration(expiration time.Duration) ApplicationTokenOpt
WithApplicationTokenExpiration sets the expiration for the GitHub App token. The expiration time of the JWT, after which it can't be used to request an installation token. The time must be no more than 10 minutes into the future.
type InstallationTokenSourceOpt ¶
type InstallationTokenSourceOpt func(*installationTokenSource)
InstallationTokenSourceOpt is a functional option for InstallationTokenSource.
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) InstallationTokenSourceOpt
WithHTTPClient sets the HTTP client for the GitHub App installation token source.
func WithInstallationTokenOptions ¶
func WithInstallationTokenOptions(opts *github.InstallationTokenOptions) InstallationTokenSourceOpt
WithInstallationTokenOptions sets the options for the GitHub App installation token.