Documentation ¶
Index ¶
- func GetToken(httpClient *http.Client, authFileBaseName string) (string, bool, error)
- func NewHMACAuth(key []byte) (jwt.SigningMethod, jwt.Keyfunc)
- func NewPerRPCCredentials(authType, token string) jwtCreds
- func NewPerRPCInternalCredentials(token string) jwtCreds
- func NewRSAAuth() (jwt.SigningMethod, jwt.Keyfunc)
- type Authentifier
- type BaseAuthConfig
- type Claims
- type Config
- type ContainerAuthConfig
- type Context
- type KeycloakAuthConfig
- type KeycloakDeviceAuthzResp
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHMACAuth ¶
func NewHMACAuth(key []byte) (jwt.SigningMethod, jwt.Keyfunc)
func NewPerRPCCredentials ¶
func NewPerRPCCredentials(authType, token string) jwtCreds
func NewPerRPCInternalCredentials ¶
func NewPerRPCInternalCredentials(token string) jwtCreds
func NewRSAAuth ¶
func NewRSAAuth() (jwt.SigningMethod, jwt.Keyfunc)
NewRSAAuth returns a jwt.Keyfunc with empty key. Useful for checking token expiration.
Types ¶
type Authentifier ¶
type BaseAuthConfig ¶
type BaseAuthConfig struct {
Type Type `json:"type"`
}
BaseAuthConfig describes a base AuthConfig used to find the good implementation.
func (*BaseAuthConfig) GetToken ¶
func (ac *BaseAuthConfig) GetToken() string
func (*BaseAuthConfig) GetType ¶
func (ac *BaseAuthConfig) GetType() Type
func (*BaseAuthConfig) Login ¶
func (ac *BaseAuthConfig) Login() error
func (*BaseAuthConfig) Renew ¶
func (ac *BaseAuthConfig) Renew() error
func (*BaseAuthConfig) Valid ¶
func (ac *BaseAuthConfig) Valid() bool
type Claims ¶
type Claims struct { // compose RegisteredClaims jwt.RegisteredClaims EmailVerified bool `json:"email_verified,omitempty"` Name string `json:"name,omitempty"` PreferredUsername string `json:"preferred_username,omitempty"` GivenName string `json:"given_name,omitempty"` FamilyName string `json:"family_name,omitempty"` Email string `json:"email,omitempty"` ResourceAccess interface{} `json:"resource_access,omitempty"` RealmAccess map[string][]string `json:"realm_access,omitempty"` Groups []string `json:"groups,omitempty"` // custom properties AuthType string }
type Config ¶
type Config struct { CurrentContext string `json:"current_context"` Contexts map[string]Context `json:"contexts"` // contains filtered or unexported fields }
func (*Config) GetAuthConfig ¶
func (c *Config) GetAuthConfig(httpClient *http.Client) (Authentifier, error)
GetAuthConfig returns the auth configuration corresponding to the current context.
func (*Config) UpdateContext ¶
func (c *Config) UpdateContext(newAuth Authentifier) error
UpdateContext update the current context with a new Autentifier.
func (*Config) UseContext ¶
UseContext set current context to context name. Creates a new empty context if does not exist.
type ContainerAuthConfig ¶
type ContainerAuthConfig struct { Type Type `json:"type"` Key []byte `json:"key"` BaseURL string `json:"base_url"` AccessToken string `json:"access_token"` }
ContainerAuthConfig define container authentication configuration.
func NewContainerAuthConfig ¶
func NewContainerAuthConfig(key, url string) *ContainerAuthConfig
func (*ContainerAuthConfig) GetToken ¶
func (ac *ContainerAuthConfig) GetToken() string
GetToken returns an access token for the current user.
func (*ContainerAuthConfig) GetType ¶
func (ac *ContainerAuthConfig) GetType() Type
GetType returns the type of the Auth Configuration.
func (*ContainerAuthConfig) Login ¶
func (ac *ContainerAuthConfig) Login() error
Login authenticates user with the authentication server.
func (*ContainerAuthConfig) Renew ¶
func (ac *ContainerAuthConfig) Renew() error
Renew renews AccessToken.
func (*ContainerAuthConfig) Valid ¶
func (ac *ContainerAuthConfig) Valid() bool
Valid returns true if current AccessToken is valid.
type Context ¶
type Context struct { AuthType Type `json:"auth_type"` AuthConfig json.RawMessage `json:"auth_config"` }
type KeycloakAuthConfig ¶
type KeycloakAuthConfig struct { Type Type `json:"type"` Username string `json:"username"` BaseURL string `json:"base_url"` // contains filtered or unexported fields }
KeycloakAuthConfig define authentication configuration.
func NewKeycloakAuthConfig ¶
func NewKeycloakAuthConfig(client *http.Client, username, pwd, url string) *KeycloakAuthConfig
func NewKeycloakAuthConfigDeviceAuthzGrant ¶
func NewKeycloakAuthConfigDeviceAuthzGrant(client *http.Client, url string) *KeycloakAuthConfig
func (*KeycloakAuthConfig) GetToken ¶
func (ac *KeycloakAuthConfig) GetToken() string
GetToken returns an access token for the current user.
func (*KeycloakAuthConfig) GetType ¶
func (ac *KeycloakAuthConfig) GetType() Type
GetType returns the type of the Auth Configuration.
func (*KeycloakAuthConfig) Login ¶
func (ac *KeycloakAuthConfig) Login() error
Login authenticates user with the authentication server.
func (*KeycloakAuthConfig) Renew ¶
func (ac *KeycloakAuthConfig) Renew() error
Renew renews AccessToken.
func (*KeycloakAuthConfig) Valid ¶
func (ac *KeycloakAuthConfig) Valid() bool
Valid returns true if current AccessToken is valid or not expired.