auth

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccessTokenLength = 32
)

Variables

View Source
var (
	ErrHostnameNotFound   = xerrors.New("auth: hostname not found")
	ErrSessionNotFound    = xerrors.New("auth: session not found")
	ErrInvalidCertificate = xerrors.New("auth: invalid certificate")
	ErrInvalidToken       = xerrors.New("auth: invalid token")
	ErrUserNotFound       = xerrors.New("auth: user not found")
	ErrNotAllowed         = xerrors.New("auth: not allowed")
)

Functions

func Authenticate

func Authenticate(req *http.Request) (*database.User, error)

func AuthenticateForSocket

func AuthenticateForSocket(ctx context.Context, token, host string) (*database.User, error)

func Init

func Init(conf *config.Config, sessionStore session.Store, userDatabase database.UserDatabase, tokenDatabase database.TokenDatabase, revokedCert revokedCertClient)

Init is initializing authenticator. You must call first before calling Authenticate.

func InitInterceptor

func InitInterceptor(conf *config.Config, user database.UserDatabase, token database.TokenDatabase)

func NewAccessToken

func NewAccessToken(name, userId, issuer string) (*database.AccessToken, error)

func StreamInterceptor

func StreamInterceptor(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error

func UnaryInterceptor

func UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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