http

package
v0.0.0-...-ad31fdb Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const UUID_ANY = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"

noinspection GoSnakeCaseUsage

Variables

View Source
var (
	SkinScope = Scope("skin")
)

Functions

func CreateAuthenticationMiddleware

func CreateAuthenticationMiddleware(checker Authenticator) mux.MiddlewareFunc

func CreateRequestEventsMiddleware

func CreateRequestEventsMiddleware(emitter Emitter, prefix string) mux.MiddlewareFunc

func NotFoundHandler

func NotFoundHandler(response http.ResponseWriter, _ *http.Request)

func StartServer

func StartServer(server *http.Server, logger slf.Logger)

Types

type Api

type Api struct {
	SkinsRepo SkinsRepository
}

func (*Api) Handler

func (ctx *Api) Handler() *mux.Router

type Authenticator

type Authenticator interface {
	Authenticate(req *http.Request) error
}

type CapesRepository

type CapesRepository interface {
	FindCapeByUsername(username string) (*model.Cape, error)
}

type Emitter

type Emitter interface {
	dispatcher.Emitter
}

type JwtAuth

type JwtAuth struct {
	Emitter
	Key []byte
}

func (*JwtAuth) Authenticate

func (t *JwtAuth) Authenticate(req *http.Request) error

func (*JwtAuth) NewToken

func (t *JwtAuth) NewToken(scopes ...Scope) ([]byte, error)

type MojangTexturesProvider

type MojangTexturesProvider interface {
	GetForUsername(username string) (*mojang.SignedTexturesResponse, error)
}

type MojangUuidsProvider

type MojangUuidsProvider interface {
	GetUuid(username string) (*mojang.ProfileInfo, error)
}

type Scope

type Scope string

type SkinsRepository

type SkinsRepository interface {
	FindSkinByUsername(username string) (*model.Skin, error)
	FindSkinByUserId(id int) (*model.Skin, error)
	SaveSkin(skin *model.Skin) error
	RemoveSkinByUserId(id int) error
	RemoveSkinByUsername(username string) error
}

type Skinsystem

type Skinsystem struct {
	Emitter
	SkinsRepo               SkinsRepository
	CapesRepo               CapesRepository
	MojangTexturesProvider  MojangTexturesProvider
	TexturesSigner          TexturesSigner
	TexturesExtraParamName  string
	TexturesExtraParamValue string
}

func (*Skinsystem) Handler

func (ctx *Skinsystem) Handler() *mux.Router

type TexturesSigner

type TexturesSigner interface {
	SignTextures(textures string) (string, error)
	GetPublicKey() (*rsa.PublicKey, error)
}

type UUIDsWorker

type UUIDsWorker struct {
	MojangUuidsProvider
}

func (*UUIDsWorker) Handler

func (ctx *UUIDsWorker) Handler() *mux.Router

Jump to

Keyboard shortcuts

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