auth

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const ContextKey = "user"

Variables

This section is empty.

Functions

func Middleware

func Middleware(provider Provider) mux.MiddlewareFunc

Types

type Provider

type Provider func(token, metaRemoteIP string) Result

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.

type Result

type Result struct {
	SDKAddress string
	// contains filtered or unexported fields
}

wish i could make this non-exported, but then you can't create new providers outside the package don't make this struct directly. instead use NewResult

func FromRequest

func FromRequest(r *http.Request) Result

func NewResult

func NewResult(user *models.User, err error) Result

func (Result) AuthAttempted

func (r Result) AuthAttempted() bool

func (Result) Authenticated

func (r Result) Authenticated() bool

func (Result) Err

func (r Result) Err() error

func (Result) User

func (r Result) User() *models.User

Jump to

Keyboard shortcuts

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