Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthStrategy ¶
AuthStrategy defines the behaviour required for a token validation strategy.
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator coordinates multiple AuthStrategy implementations against an HTTP request.
func NewAuthenticator ¶
func NewAuthenticator(strategies map[string]AuthStrategy) *Authenticator
NewAuthenticator builds an Authenticator instance using the provided strategies map.
func (*Authenticator) Strategy ¶
func (a *Authenticator) Strategy(header string) (AuthStrategy, bool)
Strategy returns a specific AuthStrategy by header key if it exists.
func (*Authenticator) Validate ¶
func (a *Authenticator) Validate(request *http.Request) (bool, error)
Validate walks through all registered strategies and validates any matching token on the request.
func (*Authenticator) ValidateStrategy ¶
ValidateStrategy restricts validation to a single allowed strategy header. Only the strategy registered under allowedHeader is considered; all other headers are skipped.
type DeployTokenAuthService ¶
type DeployTokenAuthService struct {
// contains filtered or unexported fields
}
DeployTokenAuthService is a struct that maintains and validates deploy tokens.
func NewDeployTokenAuthService ¶
func NewDeployTokenAuthService(token string) *DeployTokenAuthService
NewDeployTokenAuthService initializes a new deploy token authentication service. Accepts a token string and returns a pointer to a DeployTokenAuthService.
type JWTAuthService ¶
type JWTAuthService struct {
// contains filtered or unexported fields
}
JWTAuthService manages JSON Web Token authentication.
func NewJWTAuthService ¶
func NewJWTAuthService(secret string) *JWTAuthService
NewJWTAuthService initializes a new JWT authentication service. It takes a secret key string and returns a pointer to a JWTAuthService.
type KeycloakAuthService ¶
type KeycloakAuthService struct {
Url string
Realm string
ClientId string
PrivilegedGroups []string
// contains filtered or unexported fields
}
func NewKeycloakAuthService ¶
func NewKeycloakAuthService(config *config.ServerConfig) (*KeycloakAuthService, error)
NewKeycloakAuthService initializes a new Keycloak authentication service using the given server config. It validates the Keycloak URL and returns an error if the config is nil or the URL is malformed.
func (*KeycloakAuthService) Init ¶
func (k *KeycloakAuthService) Init(keycloakURL, realm, clientId string, privilegedGroups []string) error
Init initializes KeycloakAuthService with Keycloak URL, realm and client ID. It validates the base URL and pre-builds the userinfo endpoint URL to prevent SSRF via tainted input.