request

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package request implements the functions, types, and interfaces for the module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFromGRPCMetadata

func NewFromGRPCMetadata(md metadata.MD, fullMethodName string) security.Request

NewFromGRPCMetadata creates a security.Request from gRPC metadata and a full method name. This is useful for gRPC requests when the full Kratos transport context is not available or needed.

func NewFromHTTPRequest

func NewFromHTTPRequest(r *http.Request) security.Request

NewFromHTTPRequest creates a security.Request from a standard http.Request. This is useful when the full Kratos transport context is not available or needed.

func NewFromServerContext

func NewFromServerContext(ctx context.Context) (security.Request, error)

NewFromServerContext extracts a security.Request from the server context.

func NewMetaValue

func NewMetaValue(values ...string) *securityv1.MetaValue

NewMetaValue creates a MetaValue protobuf message.

func ToGRPC

func ToGRPC(m Metadata) metadata.MD

ToGRPC converts Metadata to gRPC metadata.

func ToHTTP

func ToHTTP(m Metadata) http.Header

ToHTTP converts Metadata to HTTP headers.

Types

type Metadata

type Metadata map[string][]string

Metadata represents a collection of metadata key-value pairs. It implements both metadataifaces.Meta and the internal valueSource interface.

func FromGRPC

func FromGRPC(md metadata.MD) Metadata

FromGRPC creates Metadata from gRPC metadata.

func FromHTTP

func FromHTTP(h http.Header) Metadata

FromHTTP creates Metadata from HTTP headers.

func FromProto

func FromProto(protoMeta map[string]*securityv1.MetaValue) Metadata

FromProto creates Metadata from protobuf metadata.

func FromRequest

func FromRequest(p security.Request) Metadata

FromRequest creates Metadata from a security.Request provider.

func (Metadata) Append

func (m Metadata) Append(key string, values ...string)

func (Metadata) Clone

func (m Metadata) Clone() metadataifaces.Meta

func (Metadata) Get

func (m Metadata) Get(key string) string

func (Metadata) GetAll

func (m Metadata) GetAll() map[string][]string

func (Metadata) Set

func (m Metadata) Set(key string, value string)

func (Metadata) ToProto

func (m Metadata) ToProto() map[string]*securityv1.MetaValue

ToProto converts the Metadata map to its Protobuf representation.

func (Metadata) Values

func (m Metadata) Values(key string) []string

Jump to

Keyboard shortcuts

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