Documentation
¶
Index ¶
- Variables
- func GitHubAuthHandlerFunc(cfg GitHubAuthServerConfig, next http.Handler) http.HandlerFunc
- func LoadAccessTokenFromFile(filePath string) (*api.AccessToken, error)
- func NewContextWithGitHubUserInfo(ctx context.Context, userInfo *UserInfo) context.Context
- func ResolveAccessToken(c GitHubAuthClientConfig) (string, error)
- func SaveAccessTokenToFile(accessToken *api.AccessToken, authFilePath string) error
- type Authenticator
- type GitHubAuthClientConfig
- type GitHubAuthCommonConfig
- type GitHubAuthHandler
- type GitHubAuthServerConfig
- type GitHubClientAuth
- type TokenSource
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EmptyGitHubAuthClientConfig = GitHubAuthClientConfig{} EmptyGitHubAuthServerConfig = GitHubAuthServerConfig{} )
Functions ¶
func GitHubAuthHandlerFunc ¶
func GitHubAuthHandlerFunc(cfg GitHubAuthServerConfig, next http.Handler) http.HandlerFunc
func LoadAccessTokenFromFile ¶
func LoadAccessTokenFromFile(filePath string) (*api.AccessToken, error)
func ResolveAccessToken ¶
func ResolveAccessToken(c GitHubAuthClientConfig) (string, error)
func SaveAccessTokenToFile ¶
func SaveAccessTokenToFile(accessToken *api.AccessToken, authFilePath string) error
Types ¶
type Authenticator ¶
type Authenticator struct {
Config GitHubAuthServerConfig
Client *github.Client
}
func NewGitHubAuthenticator ¶
func NewGitHubAuthenticator(cfg GitHubAuthServerConfig) *Authenticator
func (*Authenticator) AuthenticateToken ¶
func (a *Authenticator) AuthenticateToken(accessToken string) (*UserInfo, error)
type GitHubAuthClientConfig ¶
type GitHubAuthClientConfig struct {
GitHubAuthCommonConfig `mapstructure:",squash"`
AccessToken string `mapstructure:"access-token"`
AccessTokenFile string `mapstructure:"access-token-file"`
EnableAccessTokenFromEnvironment bool `mapstructure:"enable-access-token-from-environment"`
}
func (GitHubAuthClientConfig) IsEmpty ¶
func (c GitHubAuthClientConfig) IsEmpty() bool
type GitHubAuthCommonConfig ¶
type GitHubAuthCommonConfig 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 GitHubAuthHandler ¶
type GitHubAuthHandler struct {
Authenticator *Authenticator
// contains filtered or unexported fields
}
func (GitHubAuthHandler) ServeHTTP ¶
func (h GitHubAuthHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type GitHubAuthServerConfig ¶
type GitHubAuthServerConfig struct {
GitHubAuthCommonConfig `mapstructure:",squash"`
PrincipalACLConfig authz.PrincipalACLConfig `mapstructure:"principals"`
}
func (GitHubAuthServerConfig) IsEmpty ¶
func (c GitHubAuthServerConfig) IsEmpty() bool
type GitHubClientAuth ¶
type GitHubClientAuth struct {
Config GitHubAuthClientConfig
// contains filtered or unexported fields
}
type TokenSource ¶
type TokenSource struct {
AccessToken string
}
Click to show internal directories.
Click to hide internal directories.