auth

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAuthInfo = errors.Base("authentication token missing")
)
View Source
var NilMiddleware = Middleware(nilProvider)

NilMiddleware is useful when you need to test your logic without involving real authentication

Functions

func FromRequest

func FromRequest(r *http.Request) (*models.User, error)

FromRequest retrieves user from http.Request that went through our Middleware

func Middleware

func Middleware(provider Provider) mux.MiddlewareFunc

Middleware tries to authenticate user using request header

func MiddlewareWithProvider added in v0.14.3

func MiddlewareWithProvider(rt *sdkrouter.Router, internalAPIHost string) mux.MiddlewareFunc

MiddlewareWithProvider is useful when you want to

Types

type Provider

type Provider func(token, metaRemoteIP string) (*models.User, error)

Provider tries to authenticate using the provided auth token

func NewIAPIProvider

func NewIAPIProvider(rt *sdkrouter.Router, internalAPIHost string) Provider

NewIAPIProvider authenticates a user by hitting internal-api with the auth token and matching the response to a local user. If auth is successful, the user will have a lbrynet server assigned and a wallet that's created and ready to use.

Jump to

Keyboard shortcuts

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