auth

package
v0.0.0-...-4515e61 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2019 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeLoginEndpoint

func MakeLoginEndpoint(l *zap.Logger, m *Manager, e encode.Encoder) http.HandlerFunc

MakeLoginEndpoint creates a new http endpoint for a normal login

func MakeRecaptchaLoginEndpoint

func MakeRecaptchaLoginEndpoint(l *zap.Logger, m *Manager, e encode.Encoder) http.HandlerFunc

MakeRecaptchaLoginEndpoint creates a new http endpoint for a recaptcha login

func MakeRefreshTokenEndpoint

func MakeRefreshTokenEndpoint(l *zap.Logger, m *Manager, e encode.Encoder, pubKey rsa.PublicKey) http.HandlerFunc

MakeRefreshTokenEndpoint creates a new http endpoint for refreshing an access token with a given refresh token

Types

type Credentials

type Credentials interface {
	Name() string
	Password() string
}

Credentials to login and to fetch access and refresh token

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager for authenticating a user

func NewManager

func NewManager(prvKey *rsa.PrivateKey, r Repository, u user.Manager, v *recaptcha.Verifier, saKey key.Manager) *Manager

NewManager for user authentication

func (*Manager) Login

func (m *Manager) Login(ctx context.Context, c Credentials) (*Token, error)

Login logs a user in with their connected wcf user credentials

func (*Manager) RecaptchaLogin

func (m *Manager) RecaptchaLogin(ctx context.Context, c Credentials) (*Token, error)

RecaptchaLogin logs a user in with a check for recaptcha A recaptcha login is only available for default user logins

func (*Manager) RefreshToken

func (m *Manager) RefreshToken(ctx context.Context, accessToken token.Token, refreshToken token.Token) (*Token, error)

RefreshToken returns a new access and refresh token

type Repository

type Repository interface {
	LoginAttemptsCountSince(ctx context.Context, id string, t time.Time) (uint64, error)
	AddLoginAttempt(ctx context.Context, id string, t time.Time) error
}

Repository for the authentication service

type ServerCredentials

type ServerCredentials interface {
	GameSerialHash() string
	Password() string
}

ServerCredentials for logins on the server

type Token

type Token struct {
	// contains filtered or unexported fields
}

Token to return to the client

func (*Token) MarshalJSON

func (t *Token) MarshalJSON() ([]byte, error)

MarshalJSON for a token

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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