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)
- 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 ¶ added in v0.67.0
func AppendClusterInfoToContext(ctx context.Context, info ClusterInfo) context.Context
AppendClusterInfoToContext appends the cluster info to the context.
func AppendUserInfoToContext ¶ added in v0.51.0
AppendUserInfoToContext appends the user info to the context.
func AppendWorkerAuthorization ¶ added in v0.68.0
AppendWorkerAuthorization appends the authorization to the context for a request from a worker cluster.
func AppendWorkerAuthorizationToHeader ¶ added in v0.74.0
AppendWorkerAuthorizationToHeader appends the authorization to the HTTP header.
func CarryMetadata ¶ added in v0.39.0
CarryMetadata extracts relevant metadata from the incoming context and appends that to the outgoing context.
func CarryMetadataFromHTTPHeader ¶ added in v0.58.0
CarryMetadataFromHTTPHeader extracts relevant metadata from HTTP headers and appends that to the outgoing context.
func ExtractTokenFromContext ¶ added in v0.61.0
ExtractTokenFromContext extracts a token from a context.
func HeaderMatcher ¶ added in v0.34.0
HeaderMatcher is a custom header matcher for GRPC gateway.
Types ¶
type AssignedKubernetesEnv ¶ added in v0.73.0
AssignedKubernetesEnv represents the assigned Kubernetes environment.
type ClusterInfo ¶ added in v0.67.0
ClusterInfo manages the cluster info.
func ExtractClusterInfoFromContext ¶ added in v0.67.0
func ExtractClusterInfoFromContext(ctx context.Context) (*ClusterInfo, bool)
ExtractClusterInfoFromContext extracts the cluster info from the context.
type Config ¶ added in v0.43.0
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 ¶ added in v0.22.0
InterceptHTTPRequest intercepts an HTTP request and returns an HTTP status code.
func (*Interceptor) Unary ¶
func (a *Interceptor) Unary() grpc.UnaryServerInterceptor
Unary returns a unary server interceptor.
type UserInfo ¶ added in v0.23.0
type UserInfo struct { UserID string OrganizationID string ProjectID string AssignedKubernetesEnvs []AssignedKubernetesEnv TenantID string }
UserInfo manages the user info.
type WorkerConfig ¶ added in v0.67.0
type WorkerConfig struct {
RBACServerAddr string
}
WorkerConfig is the configuration for a WorkerInterceptor.
type WorkerInterceptor ¶ added in v0.67.0
type WorkerInterceptor struct {
// contains filtered or unexported fields
}
WorkerInterceptor is an authentication interceptor for requests from worker clusters.
func NewWorkerInterceptor ¶ added in v0.67.0
func NewWorkerInterceptor(ctx context.Context, c WorkerConfig) (*WorkerInterceptor, error)
NewWorkerInterceptor creates a new WorkerInterceptor.
func (*WorkerInterceptor) InterceptHTTPRequest ¶ added in v0.74.0
func (a *WorkerInterceptor) InterceptHTTPRequest(req *http.Request) (int, ClusterInfo, error)
InterceptHTTPRequest intercepts an HTTP request and returns an HTTP status code.
func (*WorkerInterceptor) Stream ¶ added in v0.83.0
func (a *WorkerInterceptor) Stream() grpc.StreamServerInterceptor
Stream returns a stream server interceptor.
func (*WorkerInterceptor) Unary ¶ added in v0.67.0
func (a *WorkerInterceptor) Unary() grpc.UnaryServerInterceptor
Unary returns a unary server interceptor.