Documentation
¶
Index ¶
- Variables
- func LoadAccessTokenFromFile(filePath string) (*api.AccessToken, error)
- func NewContextWithGitHubUserInfo(ctx context.Context, userInfo *UserInfo) context.Context
- func ResolveAccessToken(c ClientConfig) (string, error)
- func SaveAccessTokenToFile(accessToken *api.AccessToken, authFilePath string) error
- type Authenticator
- type ClientConfig
- type CommonConfig
- type GitHubClientAuth
- type Handler
- type ServerConfig
- type TokenSource
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EmptyClientConfig = ClientConfig{} EmptyServerConfig = ServerConfig{} )
Functions ¶
func LoadAccessTokenFromFile ¶
func LoadAccessTokenFromFile(filePath string) (*api.AccessToken, error)
func ResolveAccessToken ¶
func ResolveAccessToken(c ClientConfig) (string, error)
func SaveAccessTokenToFile ¶
func SaveAccessTokenToFile(accessToken *api.AccessToken, authFilePath string) error
Types ¶
type Authenticator ¶
type Authenticator struct {
Config ServerConfig
Client *github.Client
}
func NewGitHubAuthenticator ¶
func NewGitHubAuthenticator(cfg ServerConfig) *Authenticator
func (*Authenticator) AuthenticateToken ¶
func (a *Authenticator) AuthenticateToken(accessToken string) (*UserInfo, error)
type ClientConfig ¶ added in v0.37.0
type ClientConfig struct {
CommonConfig `mapstructure:",squash"`
AccessToken string `mapstructure:"access-token"`
AccessTokenFile string `mapstructure:"access-token-file"`
EnableAccessTokenFromEnvironment bool `mapstructure:"enable-access-token-from-environment"`
}
func (ClientConfig) IsEmpty ¶ added in v0.37.0
func (c ClientConfig) IsEmpty() bool
type CommonConfig ¶ added in v0.37.0
type CommonConfig struct {
AllowInsecureHTTP bool `mapstructure:"allow-insecure-http"`
ClientID string `mapstructure:"client-id"`
ClientSecret string `mapstructure:"client-secret"`
// ConfigFile containing ClientID and ClientSecret
ConfigFile string `mapstructure:"config-file"`
}
only need ClientID for device flow
type GitHubClientAuth ¶
type GitHubClientAuth struct {
Config ClientConfig
// contains filtered or unexported fields
}
type Handler ¶ added in v0.37.0
type Handler struct {
Authenticator *Authenticator
}
func NewHandler ¶ added in v0.37.0
func NewHandler(cfg ServerConfig) *Handler
func (*Handler) AuthRequest ¶ added in v0.37.0
type ServerConfig ¶ added in v0.37.0
type ServerConfig struct {
CommonConfig `mapstructure:",squash"`
PrincipalACLConfig authz.PrincipalACLConfig `mapstructure:"principals"`
}
func FromMap ¶ added in v0.37.0
func FromMap(m map[string]interface{}) ServerConfig
func (ServerConfig) IsEmpty ¶ added in v0.37.0
func (c ServerConfig) IsEmpty() bool
type TokenSource ¶
type TokenSource struct {
AccessToken string
}
Click to show internal directories.
Click to hide internal directories.