Documentation
¶
Index ¶
- func AppendClusterInfoToContext(ctx context.Context, info ClusterInfo) context.Context
- func AppendUserInfoToContext(ctx context.Context, info UserInfo) context.Context
- func AppendWorkerAuthorization(ctx context.Context) context.Context
- func AppendWorkerAuthorizationToHeader(req *http.Request)
- func CarryMetadata(ctx context.Context) context.Context
- func CarryMetadataFromHTTPHeader(ctx context.Context, header http.Header) context.Context
- func ExtractTokenFromContext(ctx context.Context) (string, error)
- func HeaderMatcher(key string) (string, bool)
- func ValidateClusterRegistrationKey() error
- type AssignedKubernetesEnv
- type ClusterInfo
- type Config
- type Interceptor
- type UserInfo
- type WorkerConfig
- type WorkerInterceptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendClusterInfoToContext ¶
func AppendClusterInfoToContext(ctx context.Context, info ClusterInfo) context.Context
AppendClusterInfoToContext appends the cluster info to the context.
func AppendUserInfoToContext ¶
AppendUserInfoToContext appends the user info to the context.
func AppendWorkerAuthorization ¶
AppendWorkerAuthorization appends the authorization to the context for a request from a worker cluster.
func AppendWorkerAuthorizationToHeader ¶
AppendWorkerAuthorizationToHeader appends the authorization to the HTTP header.
func CarryMetadata ¶
CarryMetadata extracts relevant metadata from the incoming context and appends that to the outgoing context.
func CarryMetadataFromHTTPHeader ¶
CarryMetadataFromHTTPHeader extracts relevant metadata from HTTP headers and appends that to the outgoing context.
func ExtractTokenFromContext ¶
ExtractTokenFromContext extracts a token from a context.
func HeaderMatcher ¶
HeaderMatcher is a custom header matcher for GRPC gateway.
func ValidateClusterRegistrationKey ¶ added in v1.9.0
func ValidateClusterRegistrationKey() error
ValidateClusterRegistrationKey validates the cluster registration key.
Types ¶
type AssignedKubernetesEnv ¶
AssignedKubernetesEnv represents the assigned Kubernetes environment.
type ClusterInfo ¶
ClusterInfo manages the cluster info.
func ExtractClusterInfoFromContext ¶
func ExtractClusterInfoFromContext(ctx context.Context) (*ClusterInfo, bool)
ExtractClusterInfoFromContext extracts the cluster info from the context.
type Config ¶
type Config struct {
RBACServerAddr string
// AccessResource is the static resource name to access. This value or GetAccessResource functions must be set.
AccessResource string
// GetAccessResourceForGRPCRequest is a function to get the resource name from a gRPC method.
GetAccessResourceForGRPCRequest func(fullMethod string) string
// GetAccessResourceForHTTPRequest is a function to get the resource name from an HTTP request method and URL.
GetAccessResourceForHTTPRequest func(method string, url url.URL) string
}
Config is the configuration for an Interceptor.
type Interceptor ¶
type Interceptor struct {
// contains filtered or unexported fields
}
Interceptor is an authentication interceptor.
func NewInterceptor ¶
func NewInterceptor(ctx context.Context, c Config) (*Interceptor, error)
NewInterceptor creates a new Interceptor.
func (*Interceptor) InterceptHTTPRequest ¶
InterceptHTTPRequest intercepts an HTTP request and returns an HTTP status code.
func (*Interceptor) Unary ¶
func (a *Interceptor) Unary(excludeMethods ...string) grpc.UnaryServerInterceptor
Unary returns a unary server interceptor.
type UserInfo ¶
type UserInfo struct {
UserID string
InternalUserID string
OrganizationID string
OrganizationTitle string
ProjectID string
ProjectTitle string
AssignedKubernetesEnvs []AssignedKubernetesEnv
TenantID string
// APIKeyID is the ID of the API key. It is set only when the user is authenticated with an API key.
APIKeyID string
// ExcludedFromRateLimiting indicates whether the API key is excluded from rate limiting.
ExcludedFromRateLimiting bool
}
UserInfo manages the user info.
type WorkerConfig ¶
type WorkerConfig struct {
RBACServerAddr string
}
WorkerConfig is the configuration for a WorkerInterceptor.
type WorkerInterceptor ¶
type WorkerInterceptor struct {
// contains filtered or unexported fields
}
WorkerInterceptor is an authentication interceptor for requests from worker clusters.
func NewWorkerInterceptor ¶
func NewWorkerInterceptor(ctx context.Context, c WorkerConfig) (*WorkerInterceptor, error)
NewWorkerInterceptor creates a new WorkerInterceptor.
func (*WorkerInterceptor) InterceptHTTPRequest ¶
func (a *WorkerInterceptor) InterceptHTTPRequest(req *http.Request) (int, ClusterInfo, error)
InterceptHTTPRequest intercepts an HTTP request and returns an HTTP status code.
func (*WorkerInterceptor) Stream ¶
func (a *WorkerInterceptor) Stream() grpc.StreamServerInterceptor
Stream returns a stream server interceptor.
func (*WorkerInterceptor) Unary ¶
func (a *WorkerInterceptor) Unary() grpc.UnaryServerInterceptor
Unary returns a unary server interceptor.