Documentation ¶
Index ¶
- Constants
- func GetCredentialInitializer() map[AuthType]NewCredentialFunc
- func RegisterCredentialInitializer(authType AuthType, initializer NewCredentialFunc)
- type AnonymousAuthInfo
- type AuthInfo
- type AuthType
- type BasicAuthInfo
- type Credential
- func DefaultCredential() Credential
- func GetCredential(genericConf *generic.GenericConfiguration, ...) (Credential, error)
- func NewBasicAuthCredential(_ *generic.AuthConfiguration, ...) (Credential, error)
- func NewInsecureCredential(_ *generic.AuthConfiguration, _ *dynamic.DynamicAgentConfiguration) (Credential, error)
- type NewCredentialFunc
Constants ¶
View Source
const ( AuthTypeBasicAuth = "Basic" AuthTypeInsecure = "Insecure" )
View Source
const SubjectNameAnonymous = "anonymous"
Variables ¶
This section is empty.
Functions ¶
func GetCredentialInitializer ¶
func GetCredentialInitializer() map[AuthType]NewCredentialFunc
func RegisterCredentialInitializer ¶
func RegisterCredentialInitializer(authType AuthType, initializer NewCredentialFunc)
Types ¶
type AnonymousAuthInfo ¶
type AnonymousAuthInfo struct{}
func (AnonymousAuthInfo) AuthType ¶
func (a AnonymousAuthInfo) AuthType() AuthType
func (AnonymousAuthInfo) SubjectName ¶
func (a AnonymousAuthInfo) SubjectName() string
type AuthInfo ¶
type AuthInfo interface { // AuthType return the authentication protocol. AuthType() AuthType // SubjectName return the subject name it holds. SubjectName() string }
AuthInfo defines the common interface for the auth information the users are interested in. A struct that implements AuthInfo can hold other information the corresponding protocol can provide besides the interface defined.
type BasicAuthInfo ¶
func (BasicAuthInfo) AuthType ¶
func (b BasicAuthInfo) AuthType() AuthType
func (BasicAuthInfo) SubjectName ¶
func (b BasicAuthInfo) SubjectName() string
type Credential ¶
type Credential interface { // AuthType return the authentication protocol. AuthType() AuthType // Auth takes a http request parameter and uses corresponding protocol to retrieve AuthInfo from the request. Auth(r *http.Request) (AuthInfo, error) // AuthToken takes a raw token string parameter and uses corresponding protocol to retrieve AuthInfo from it. AuthToken(token string) (AuthInfo, error) // Run starts the Credential component Run(ctx context.Context) }
Credential defines common interface for all authentication protocol(e.g., BasicAuth, JWT Token).
func DefaultCredential ¶
func DefaultCredential() Credential
func GetCredential ¶
func GetCredential(genericConf *generic.GenericConfiguration, dynamicConfig *dynamic.DynamicAgentConfiguration) (Credential, error)
func NewBasicAuthCredential ¶
func NewBasicAuthCredential(_ *generic.AuthConfiguration, dynamicConfiguration *dynamic.DynamicAgentConfiguration) (Credential, error)
func NewInsecureCredential ¶
func NewInsecureCredential(_ *generic.AuthConfiguration, _ *dynamic.DynamicAgentConfiguration) (Credential, error)
type NewCredentialFunc ¶
type NewCredentialFunc func(authConfig *generic.AuthConfiguration, dynamicConfig *dynamic.DynamicAgentConfiguration) (Credential, error)
Click to show internal directories.
Click to hide internal directories.