basic

package
v0.9.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnection

func NewConnection(address string, creds credentials.PerRPCCredentials) (conn *grpc.ClientConn, err error)

NewConnection initializes a grpc.ClientConn configured for basic authentication.

Types

type Credentials

type Credentials interface {
	credentials.PerRPCCredentials

	UnaryInterceptor() grpc.UnaryServerInterceptor
}

Credentials describes an authorization method.

func NewTokenCredentials

func NewTokenCredentials(token string) (creds Credentials)

NewTokenCredentials initializes ClientCredentials with the token.

func NewUsernameAndPasswordCredentials

func NewUsernameAndPasswordCredentials(username, password string) (creds Credentials)

NewUsernameAndPasswordCredentials initializes username and password Credentials.

type TokenCredentials

type TokenCredentials struct {
	Token string
}

TokenCredentials implements credentials.PerRPCCredentials. It uses a basic token lookup to authenticate users.

func (*TokenCredentials) GetRequestMetadata

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

GetRequestMetadata sets the value for the "token" key.

func (*TokenCredentials) RequireTransportSecurity

func (b *TokenCredentials) RequireTransportSecurity() bool

RequireTransportSecurity is set to true in order to encrypt the communication.

func (*TokenCredentials) UnaryInterceptor

func (b *TokenCredentials) UnaryInterceptor() grpc.UnaryServerInterceptor

UnaryInterceptor sets the UnaryServerInterceptor for the server and enforces basic authentication.

type UsernameAndPasswordCredentials

type UsernameAndPasswordCredentials struct {
	Username string
	Password string
}

UsernameAndPasswordCredentials implements credentials.PerRPCCredentials. It uses a basic username and password lookup to authenticate users.

func (*UsernameAndPasswordCredentials) GetRequestMetadata

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

GetRequestMetadata sets the value for the username and password.

func (*UsernameAndPasswordCredentials) RequireTransportSecurity

func (b *UsernameAndPasswordCredentials) RequireTransportSecurity() bool

RequireTransportSecurity is set to true in order to encrypt the communication.

func (*UsernameAndPasswordCredentials) UnaryInterceptor

UnaryInterceptor sets the UnaryServerInterceptor for the server and enforces basic authentication.

Jump to

Keyboard shortcuts

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