auth

package
v0.80.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 9

Documentation

Index

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

func AppendUserInfoToContext(ctx context.Context, info UserInfo) context.Context

AppendUserInfoToContext appends the user info to the context.

func AppendWorkerAuthorization added in v0.68.0

func AppendWorkerAuthorization(ctx context.Context) context.Context

AppendWorkerAuthorization appends the authorization to the context for a request from a worker cluster.

func AppendWorkerAuthorizationToHeader added in v0.74.0

func AppendWorkerAuthorizationToHeader(req *http.Request)

AppendWorkerAuthorizationToHeader appends the authorization to the HTTP header.

func CarryMetadata added in v0.39.0

func CarryMetadata(ctx context.Context) context.Context

CarryMetadata extracts relevant metadata from the incoming context and appends that to the outgoing context.

func CarryMetadataFromHTTPHeader added in v0.58.0

func CarryMetadataFromHTTPHeader(ctx context.Context, header http.Header) context.Context

CarryMetadataFromHTTPHeader extracts relevant metadata from HTTP headers and appends that to the outgoing context.

func ExtractTokenFromContext added in v0.61.0

func ExtractTokenFromContext(ctx context.Context) (string, error)

ExtractTokenFromContext extracts a token from a context.

func HeaderMatcher added in v0.34.0

func HeaderMatcher(key string) (string, bool)

HeaderMatcher is a custom header matcher for GRPC gateway.

Types

type AssignedKubernetesEnv added in v0.73.0

type AssignedKubernetesEnv struct {
	ClusterID string
	Namespace string
}

AssignedKubernetesEnv represents the assigned Kubernetes environment.

type ClusterInfo added in v0.67.0

type ClusterInfo struct {
	ClusterID string
	TenantID  string
}

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

func (a *Interceptor) InterceptHTTPRequest(req *http.Request) (int, UserInfo, error)

InterceptHTTPRequest intercepts an HTTP request and returns an HTTP status code.

func (*Interceptor) Unary

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.

func ExtractUserInfoFromContext added in v0.23.0

func ExtractUserInfoFromContext(ctx context.Context) (*UserInfo, bool)

ExtractUserInfoFromContext extracts the user info from the context.

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) Unary added in v0.67.0

Unary returns a unary server interceptor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL