Documentation
¶
Index ¶
- func GenerateRandomString(length int) string
- func SetupSocialLogin(app *flow.Engine)
- type SocialUserRepository
- type User
- type UserRepository
- func (r *UserRepository) FindByCredentials(ctx context.Context, credentials map[string]string) (auth.Authenticatable, error)
- func (r *UserRepository) FindByID(ctx context.Context, id string) (auth.Authenticatable, error)
- func (r *UserRepository) SaveUser(user *User)
- func (r *UserRepository) ValidateCredentials(ctx context.Context, user auth.Authenticatable, credentials map[string]string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomString ¶
GenerateRandomString 生成指定长度的随机字符串
Types ¶
type SocialUserRepository ¶
type SocialUserRepository struct {
// contains filtered or unexported fields
}
SocialUserRepository 是社交用户存储库示例
func NewSocialUserRepository ¶
func NewSocialUserRepository() *SocialUserRepository
NewSocialUserRepository 创建新的社交用户存储库
func (*SocialUserRepository) CreateUser ¶
func (r *SocialUserRepository) CreateUser(ctx context.Context, user interface{}) error
CreateUser 创建新用户
func (*SocialUserRepository) FindUserBySocialID ¶
func (r *SocialUserRepository) FindUserBySocialID(ctx context.Context, provider, socialID string) (interface{}, error)
FindUserBySocialID 通过社交ID查找用户
func (*SocialUserRepository) SaveUser ¶
func (r *SocialUserRepository) SaveUser(user *User)
SaveUser 保存用户
type User ¶
type User struct {
ID string
Username string
Email string
Avatar string
Password string
Provider string
ProviderID string
Roles []string
Permissions []string
IsActive bool
}
User 是一个用户模型示例
func (*User) GetAuthIdentifier ¶
GetAuthIdentifier 实现 Authenticatable 接口
func (*User) GetAuthUsername ¶
GetAuthUsername 实现 Authenticatable 接口
func (*User) GetPermissions ¶
GetPermissions 实现 Authenticatable 接口
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository 是用户存储库示例
func (*UserRepository) FindByCredentials ¶
func (r *UserRepository) FindByCredentials(ctx context.Context, credentials map[string]string) (auth.Authenticatable, error)
FindByCredentials 通过凭证查找用户
func (*UserRepository) FindByID ¶
func (r *UserRepository) FindByID(ctx context.Context, id string) (auth.Authenticatable, error)
FindByID 通过ID查找用户
func (*UserRepository) ValidateCredentials ¶
func (r *UserRepository) ValidateCredentials(ctx context.Context, user auth.Authenticatable, credentials map[string]string) (bool, error)
ValidateCredentials 验证用户凭证
Click to show internal directories.
Click to hide internal directories.