auth

package
v0.0.0-...-9fe20ad Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientIDKey contextKey = iota
	EndpointKey
	ConfigKey
	ServiceKey
)

Variables

This section is empty.

Functions

func AuthenticateToken

func AuthenticateToken(accessToken string) (*data.User, error)

func CreateRefreshToken

func CreateRefreshToken(user data.User) (string, error)

func CreateToken

func CreateToken(user data.User) (string, error)

func CredMatcher

func CredMatcher(headerName string) (mdName string, ok bool)

func NewAuthClient

func NewAuthClient(authEndpoint string) (*grpc.ClientConn, authpb.AuthServiceClient)

func NewSHA256

func NewSHA256(data string) string

NewSHA256 ...

func NewUsersClient

func NewUsersClient(usersEndpoint string) (*grpc.ClientConn, userspb.UsersServiceClient)

func RefreshAccessToken

func RefreshAccessToken(refreshToken string) (string, error)

func UUID

func UUID() (string, error)

Types

type BasicAuthentication

type BasicAuthentication struct {
	Login    string
	Password string
}

func (*BasicAuthentication) GetRequestMetadata

func (a *BasicAuthentication) GetRequestMetadata(context.Context, ...string) (map[string]string, error)

func (*BasicAuthentication) RequireTransportSecurity

func (a *BasicAuthentication) RequireTransportSecurity() bool

type BearerAuthentication

type BearerAuthentication struct {
	Token string
}

func (*BearerAuthentication) GetRequestMetadata

func (a *BearerAuthentication) GetRequestMetadata(context.Context, ...string) (map[string]string, error)

func (*BearerAuthentication) RequireTransportSecurity

func (a *BearerAuthentication) RequireTransportSecurity() bool

type UserMetaData

type UserMetaData struct {
	Id       int64
	Username string
}

Jump to

Keyboard shortcuts

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