Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrACINotFound = errors.New("aci not found") ErrPermissionDenied = errors.New("permission denied") ErrInvalidACI = errors.New("invalid aci") )
View Source
var ( ErrAuthNotFound = errors.New("auth not found") ErrUsernameExist = errors.New("username already exist") ErrInvalidPassword = errors.New("invalid password") ErrPasswordNotMatch = errors.New("password not match") ErrInternal = errors.New("internal error") ErrInvalidPasswordPolicy = errors.New("invalid password policy") )
Functions ¶
This section is empty.
Types ¶
type ACIRepository ¶
type ACIRepository interface { Create(ctx context.Context, aci *ACI) error GetById(ctx context.Context, id string) (*ACI, error) GetByResource(ctx context.Context, resource string) ([]*ACI, error) GetByRoleId(ctx context.Context, roleId string) ([]*ACI, error) GetByPayload(ctx context.Context, payload string) ([]*ACI, error) GetByUserId(ctx context.Context, userId string) ([]*ACI, error) CheckByRoleId(ctx context.Context, roleId string, resource string, payload string) (bool, error) CheckByUserId(ctx context.Context, userId string, resource string, payload string) (bool, error) List(ctx context.Context, query *common.QueryOpts) (*common.ListResult[*ACI], error) Update(ctx context.Context, aci *ACI) error Delete(ctx context.Context, id string) error GetResourcesByUserIdAndPayload(ctx context.Context, userId string, payload string) ([]*ACI, error) GetResourcesByUserIdAndResource(ctx context.Context, userId string, resource string) ([]*ACI, error) }
type ACIUseCase ¶
type ACIUseCase interface { Create(ctx context.Context, aci *ACI) error GetById(ctx context.Context, id string) (*ACI, error) GetByResource(ctx context.Context, resource string) ([]*ACI, error) GetByRoleId(ctx context.Context, roleId string) ([]*ACI, error) GetByPayload(ctx context.Context, payload string) ([]*ACI, error) GetByUserId(ctx context.Context, userId string) ([]*ACI, error) GetResourcesByUserIdAndPayload(ctx context.Context, userId string, payload string) ([]*ACI, error) GetResourcesByUserIdAndResource(ctx context.Context, userId string, resource string) ([]*ACI, error) List(ctx context.Context, query *common.QueryOpts) (*common.ListResult[*ACI], error) Update(ctx context.Context, aci *ACI) error Delete(ctx context.Context, id string) error }
type AuthRepository ¶
type AuthRepository interface { Create(ctx context.Context, auth *Auth) error GetById(ctx context.Context, id string) (*Auth, error) GetStaticUserMap(ctx context.Context) map[string]*Auth GetByUsername(ctx context.Context, username string) (*Auth, error) GetByUsernameAndHpassword(ctx context.Context, username, hpassword string) (*Auth, error) Update(ctx context.Context, auth *Auth) error Delete(ctx context.Context, id string) error List(ctx context.Context, opt *common.QueryOpts) (*common.ListResult[*Auth], error) }
type AuthUseCase ¶
type AuthUseCase interface { SignUp(ctx context.Context, auth *Auth) error SignUpWithProvider(ctx context.Context, provider Provider, token string) error SignIn(ctx context.Context, username, password string) (token *Token, err error) SignInWithProvider(ctx context.Context, provider Provider, token string) (genToken *Token, err error) CheckAuth(ctx context.Context, uid string) (existed bool, err error) CheckAuthWithProvider(ctx context.Context, provider Provider, token string) (existed bool, err error) ChangePassword(ctx context.Context, uid, oldPassword, newPassword string) error ChangeRole(ctx context.Context, uid, roleId string) error Delete(ctx context.Context, id string) error Verify(ctx context.Context, token string) (auth *Auth, err error) List(ctx context.Context, opt *common.QueryOpts) (*common.ListResult[*Auth], error) GetByUsername(ctx context.Context, username string) (*Auth, error) GetById(ctx context.Context, id string) (*Auth, error) GetStaticUserList(ctx context.Context) (list *StaticUserList, err error) }
type JwtGenerator ¶
type StaticUserList ¶ added in v0.1.2
type StaticUserList struct {
List []*Auth `json:"static_users" yaml:"static_users" mapstructure:"static_users"`
}
Click to show internal directories.
Click to hide internal directories.