basicauth

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeBasicAuth

func EncodeBasicAuth(username, password string) string

EncodeBasicAuth generates a Basic Authentication header value using the provided username and password according to RFC 7617. It formats the authString as "username:password", encodes it in base64, and returns the Basic Auth header in the format "Basic <base64EncodedString>".

Types

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

BasicAuth is an implementation of grpc.PerRPCCredentials based on the Basic HTTP Authentication Schema.

func New

func New(username, password string) *BasicAuth

func (*BasicAuth) GetRequestMetadata

func (b *BasicAuth) GetRequestMetadata(context.Context, ...string) (map[string]string, error)

GetRequestMetadata gets the request metadata as a map of strings.

func (*BasicAuth) RequireTransportSecurity

func (*BasicAuth) RequireTransportSecurity() bool

RequireTransportSecurity indicates whether the credentials requires transport security.

Jump to

Keyboard shortcuts

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