auth

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 CarryMetadata added in v0.39.0

func CarryMetadata(ctx context.Context) context.Context

CarryMetadata extracts relevant metadata from the incoming context and append that to the outgoing 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 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
	KubernetesNamespace 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.

Jump to

Keyboard shortcuts

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