Documentation ¶
Overview ¶
Package githubauth provides interfaces and implementations for authenticating to GitHub.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForAllRepos ¶
func ForAllRepos() *allReposScope
ForAllRepos creates a scope that requests permissions on all repositories.
Types ¶
type AppScope ¶
type AppScope interface { *allReposScope | *selectedReposScope }
AppScope is an interface which determines the repositories scope for which the app should request tokens.
type AppTokenSource ¶
type AppTokenSource[T AppScope] struct { // contains filtered or unexported fields }
AppTokenSource is a GitHubToken provider that authenticates as a GitHub App.
func NewAppTokenSource ¶
func NewAppTokenSource[T AppScope](appID, installationID, privateKeyPEM string, scope T) (*AppTokenSource[T], error)
NewAppTokenSource returns a AppTokenSource which authenticates as a GitHub App and returns a GitHub token.
func (*AppTokenSource[T]) GitHubApp ¶
func (s *AppTokenSource[T]) GitHubApp() *githubapp.GitHubApp
GitHubApp returns the underlying GitHubApp.
func (*AppTokenSource[T]) GitHubToken ¶
func (s *AppTokenSource[T]) GitHubToken(ctx context.Context) (string, error)
GitHubToken implements TokenSource.
type StaticTokenSource ¶
type StaticTokenSource struct {
// contains filtered or unexported fields
}
StaticTokenSource is a GitHubToken provider that returns the provided token.
func NewStaticTokenSource ¶
func NewStaticTokenSource(token string) (*StaticTokenSource, error)
NewStaticTokenSource returns a StaticTokenSource which returns the token string as given.
func (*StaticTokenSource) GitHubToken ¶
func (s *StaticTokenSource) GitHubToken(ctx context.Context) (string, error)
GitHubToken implements TokenSource.