Documentation
¶
Overview ¶
Package basic - пакет с реализацией авторизации по логин/паролю.
Подразумевается, что пароли в базе данных хранятся в виде SHA256 хэшей и сами пароли тоже присылаются хэшированными.
Примеры использования приведены в пакетах с реализациями интерфейса AuthProvider.
Index ¶
- func Auth(ctx context.Context, login, password string, platform structs.Platform, ...) (*structs.Account, error)
- func AuthWithInfo(ctx context.Context, login, password string, platform structs.Platform, ...) (*structs.Account, proto.Message, error)
- func Logout(ctx context.Context, role structs.Role, id int64) error
- func SetDefaultAuth(f AuthProvider)
- type AuthProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Auth ¶
func Auth(ctx context.Context, login, password string, platform structs.Platform, versions []string, disabled ...structs.Role) (*structs.Account, error)
Auth - вызов метода Auth у провайдера по умолчанию
func AuthWithInfo ¶
func AuthWithInfo(ctx context.Context, login, password string, platform structs.Platform, versions []string, disabled ...structs.Role) (*structs.Account, proto.Message, error)
AuthWithInfo - вызов метода AuthWithInfo у провайдера по умолчанию
func SetDefaultAuth ¶
func SetDefaultAuth(f AuthProvider)
SetDefaultAuth - установка провайдера по умолчанию
Types ¶
type AuthProvider ¶
type AuthProvider interface {
// Auth - получение аккаунта по логину/паролю
Auth(ctx context.Context, login, password string, platform structs.Platform,
versions []string, disabled ...structs.Role) (*structs.Account, error)
// AuthWithInfo - получение аккаунта и полного ответа(полная структура аккаунта,
// упакованная в ответ на запрос согласно определению API) на запрос авторизации по логину/паролю
AuthWithInfo(ctx context.Context, login, password string, platform structs.Platform,
versions []string, disabled ...structs.Role) (*structs.Account, proto.Message, error)
Logout(ctx context.Context, role structs.Role, id int64) error
}
AuthProvider - интерфейс провайдера авторизации по логин/паролю
Click to show internal directories.
Click to hide internal directories.