authentication

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthProviderEntity added in v0.3.1

type AuthProviderEntity interface {
	orm.Entity
	GetUniqueFieldName() string
	GetPassword() string
}

type Authentication

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

func NewAuthenticationService

func NewAuthenticationService(
	secret string,
	accessTokenTTL int,
	refreshTokenTTL int,
	ormService *orm.Engine,
	cacheService *orm.RedisCache,
	passwordService *password.Password,
	jwtService *jwt.JWT,
) *Authentication

func (*Authentication) Authenticate

func (t *Authentication) Authenticate(uniqueValue string, password string, entity AuthProviderEntity) (accessToken string, refreshToken string, err error)

func (*Authentication) GenerateTokenPair added in v0.3.1

func (t *Authentication) GenerateTokenPair(id uint64, accessKey string, ttl int) (string, error)

func (*Authentication) LogoutAllSessions added in v0.3.1

func (t *Authentication) LogoutAllSessions(id uint64)

func (*Authentication) LogoutCurrentSession added in v0.3.1

func (t *Authentication) LogoutCurrentSession(accessKey string)

func (*Authentication) RefreshToken

func (t *Authentication) RefreshToken(refreshToken string) (newAccessToken string, newRefreshToken string, err error)

func (*Authentication) VerifyAccessToken

func (t *Authentication) VerifyAccessToken(accessToken string, entity orm.Entity) (map[string]string, error)

Jump to

Keyboard shortcuts

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