Documentation
¶
Index ¶
- func FromContext(ctx context.Context) (jwt.MapClaims, bool)
- func NewContext(ctx context.Context, claim jwt.MapClaims) context.Context
- func NewPrivateIdentityRouter() *napnap.Router
- func NewPublicIdentityRouter() *napnap.Router
- func ValidateModule(ctx context.Context, code string) bool
- type Account
- type AccountRepo
- func (repo *AccountRepo) Delete(ctx context.Context, userID int) error
- func (repo *AccountRepo) Get(ctx context.Context, entity *Account) (*Account, error)
- func (repo *AccountRepo) GetAccountByID(ctx context.Context, userID int) (*Account, error)
- func (repo *AccountRepo) Insert(ctx context.Context, entity *Account, tx *sqlx.Tx) error
- func (repo *AccountRepo) Update(ctx context.Context, entity *Account) error
- func (repo *AccountRepo) UpdateAccountFailPassword(ctx context.Context, entity *Account) error
- func (repo *AccountRepo) UpdateLastLoginTime(ctx context.Context, entity *Account) error
- type AuthorizationResult
- type ChangePwdOption
- type Claim
- type EditRole
- type EditUserRole
- type FindRolesOptions
- type GetLoginLogOption
- type JWTMiddleware
- type JwtOptions
- type LoginLog
- type MembershipService
- func (ms *MembershipService) CreateRole(ctx context.Context, role *Role) error
- func (ms *MembershipService) CreateUser(ctx context.Context, user *User) error
- func (ms *MembershipService) GenerateToken(ctx context.Context, userID int) (*AuthorizationResult, error)
- func (ms *MembershipService) GetLoginLogs(ctx context.Context, opt *GetLoginLogOption) ([]*LoginLog, int, error)
- func (ms *MembershipService) GetRoleByName(ctx context.Context, name string) (*Role, error)
- func (ms *MembershipService) GetRoles(ctx context.Context) ([]*Role, error)
- func (ms *MembershipService) GetUserByID(ctx context.Context, userID int) (*User, error)
- func (ms *MembershipService) GetUserCount(ctx context.Context, opt UserOption) (int, error)
- func (ms *MembershipService) GetUserRoles(ctx context.Context, userID int) ([]string, error)
- func (ms *MembershipService) GetUsers(ctx context.Context, opt UserOption) ([]*User, error)
- func (ms *MembershipService) Login(ctx context.Context, username string, password string) (bool, int, error)
- func (ms *MembershipService) Logout(ctx context.Context, consumerID string) error
- func (ms *MembershipService) UpdateAccountLock(ctx context.Context, userid int) error
- func (ms *MembershipService) UpdateAccountPassword(ctx context.Context, opt *ChangePwdOption) error
- func (ms *MembershipService) UpdateRole(ctx context.Context, originalName string, role *Role) error
- func (ms *MembershipService) UpdateUserRole(ctx context.Context, eul EditUserRole) error
- func (ms *MembershipService) UpdateUserprofiles(ctx context.Context, entity *UserProfile) error
- type Role
- type RoleRepo
- func (repo *RoleRepo) AddUserToRole(ctx context.Context, userID int, roleID int, tx *sqlx.Tx) error
- func (repo *RoleRepo) DeleteAllUserRoles(ctx context.Context, userID int) error
- func (repo *RoleRepo) DeleteRole(ctx context.Context, id int) error
- func (repo *RoleRepo) DeleteRoleByUser(ctx context.Context, userID int, tx *sqlx.Tx) error
- func (repo *RoleRepo) FindRoles(ctx context.Context, opts FindRolesOptions) ([]*Role, error)
- func (repo *RoleRepo) GetRoleByID(ctx context.Context, roleID int) (*Role, error)
- func (repo *RoleRepo) GetRoleByName(ctx context.Context, roleName string) (*Role, error)
- func (repo *RoleRepo) GetRolesByUser(ctx context.Context, userID int) ([]string, error)
- func (repo *RoleRepo) InsertRole(ctx context.Context, entity *Role) error
- func (repo *RoleRepo) UpdateRole(ctx context.Context, originalName string, entity *Role) error
- func (repo *RoleRepo) UpdateRoleByUser(ctx context.Context, userID, roleID int) error
- type Rule
- type User
- type UserAmount
- type UserOption
- type UserProfile
- type UserProfileRepo
- func (repo *UserProfileRepo) Delete(id int) error
- func (repo *UserProfileRepo) GetUserByID(ctx context.Context, userID int) (*User, error)
- func (repo *UserProfileRepo) GetUserByName(ctx context.Context, userName string) (*User, error)
- func (repo *UserProfileRepo) GetUserCount(ctx context.Context, opt UserOption) (int, error)
- func (repo *UserProfileRepo) GetUsers(ctx context.Context, opt UserOption) ([]*User, error)
- func (repo *UserProfileRepo) Insert(ctx context.Context, entity *UserProfile, tx *sqlx.Tx) error
- func (repo *UserProfileRepo) Update(ctx context.Context, entity *UserProfile) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPublicIdentityRouter ¶
Types ¶
type Account ¶
type Account struct { ID string UserID int `db:"user_id"` Username string PasswordHash string `db:"password_hash"` PasswordSalt string `db:"password_salt"` IsLockedOut bool `db:"is_locked_out"` LastLoginTime *time.Time `db:"last_login_time"` FailedPasswordAttemptCount int `db:"failed_password_attempt_count"` CreatedAt *time.Time `json:"created_at,omitempty" db:"created_at"` UpdatedAt *time.Time `json:"updated_at" db:"updated_at"` }
type AccountRepo ¶
type AccountRepo struct {
// contains filtered or unexported fields
}
func NewAccountRepo ¶
func NewAccountRepo(db *sqlx.DB) *AccountRepo
func (*AccountRepo) GetAccountByID ¶
func (*AccountRepo) Update ¶
func (repo *AccountRepo) Update(ctx context.Context, entity *Account) error
func (*AccountRepo) UpdateAccountFailPassword ¶
func (repo *AccountRepo) UpdateAccountFailPassword(ctx context.Context, entity *Account) error
func (*AccountRepo) UpdateLastLoginTime ¶
func (repo *AccountRepo) UpdateLastLoginTime(ctx context.Context, entity *Account) error
type AuthorizationResult ¶
type ChangePwdOption ¶
type EditUserRole ¶
type FindRolesOptions ¶
type FindRolesOptions struct {
Name string
}
type GetLoginLogOption ¶
type JWTMiddleware ¶
type JWTMiddleware struct {
// contains filtered or unexported fields
}
func NewJWTMiddleware ¶
func NewJWTMiddleware(opts JwtOptions) *JWTMiddleware
func (*JWTMiddleware) Invoke ¶
func (jwtMW *JWTMiddleware) Invoke(c *napnap.Context, next napnap.HandlerFunc)
type JwtOptions ¶
type MembershipService ¶
type MembershipService struct { Code string // contains filtered or unexported fields }
func NewMembershipService ¶
func NewMembershipService(db *sqlx.DB, cfg *config.Configuration) *MembershipService
func (*MembershipService) CreateRole ¶
func (ms *MembershipService) CreateRole(ctx context.Context, role *Role) error
func (*MembershipService) CreateUser ¶
func (ms *MembershipService) CreateUser(ctx context.Context, user *User) error
func (*MembershipService) GenerateToken ¶
func (ms *MembershipService) GenerateToken(ctx context.Context, userID int) (*AuthorizationResult, error)
func (*MembershipService) GetLoginLogs ¶
func (ms *MembershipService) GetLoginLogs(ctx context.Context, opt *GetLoginLogOption) ([]*LoginLog, int, error)
func (*MembershipService) GetRoleByName ¶
func (*MembershipService) GetRoles ¶
func (ms *MembershipService) GetRoles(ctx context.Context) ([]*Role, error)
func (*MembershipService) GetUserByID ¶
func (*MembershipService) GetUserCount ¶
func (ms *MembershipService) GetUserCount(ctx context.Context, opt UserOption) (int, error)
func (*MembershipService) GetUserRoles ¶
func (*MembershipService) GetUsers ¶
func (ms *MembershipService) GetUsers(ctx context.Context, opt UserOption) ([]*User, error)
func (*MembershipService) Logout ¶
func (ms *MembershipService) Logout(ctx context.Context, consumerID string) error
func (*MembershipService) UpdateAccountLock ¶
func (ms *MembershipService) UpdateAccountLock(ctx context.Context, userid int) error
func (*MembershipService) UpdateAccountPassword ¶
func (ms *MembershipService) UpdateAccountPassword(ctx context.Context, opt *ChangePwdOption) error
func (*MembershipService) UpdateRole ¶
func (*MembershipService) UpdateUserRole ¶
func (ms *MembershipService) UpdateUserRole(ctx context.Context, eul EditUserRole) error
func (*MembershipService) UpdateUserprofiles ¶
func (ms *MembershipService) UpdateUserprofiles(ctx context.Context, entity *UserProfile) error
type RoleRepo ¶
type RoleRepo struct {
// contains filtered or unexported fields
}
func NewRoleRepo ¶
func (*RoleRepo) AddUserToRole ¶
func (*RoleRepo) DeleteAllUserRoles ¶
func (*RoleRepo) DeleteRoleByUser ¶
func (*RoleRepo) GetRoleByID ¶
func (*RoleRepo) GetRoleByName ¶
func (*RoleRepo) GetRolesByUser ¶
func (*RoleRepo) InsertRole ¶
func (*RoleRepo) UpdateRole ¶
type User ¶
type User struct { ID int `json:"id"` DisplayName string `json:"display_name" db:"display_name"` Username string `json:"username"` Password string `json:"password,omitempty" db:"password_hash"` Roles []string `json:"roles"` LastLoginTime *time.Time `json:"last_login_time,omitempty" db:"last_login_time"` TimeZone string `json:"time_zone" db:"time_zone"` IsLockedOut int `json:"is_locked_out" db:"is_locked_out"` ClientIP string `json:"client_ip"` CreatedAt *time.Time `json:"created_at,omitempty" db:"created_at"` UpdatedAt *time.Time `json:"updated_at" db:"updated_at"` }
type UserAmount ¶
type UserAmount struct {
Count int `db:"count"`
}
type UserOption ¶
type UserProfile ¶
type UserProfileRepo ¶
type UserProfileRepo struct {
// contains filtered or unexported fields
}
func NewUserProfileRepo ¶
func NewUserProfileRepo(db *sqlx.DB) *UserProfileRepo
func (*UserProfileRepo) Delete ¶
func (repo *UserProfileRepo) Delete(id int) error
func (*UserProfileRepo) GetUserByID ¶
func (*UserProfileRepo) GetUserByName ¶
func (*UserProfileRepo) GetUserCount ¶
func (repo *UserProfileRepo) GetUserCount(ctx context.Context, opt UserOption) (int, error)
func (*UserProfileRepo) GetUsers ¶
func (repo *UserProfileRepo) GetUsers(ctx context.Context, opt UserOption) ([]*User, error)
func (*UserProfileRepo) Insert ¶
func (repo *UserProfileRepo) Insert(ctx context.Context, entity *UserProfile, tx *sqlx.Tx) error
func (*UserProfileRepo) Update ¶
func (repo *UserProfileRepo) Update(ctx context.Context, entity *UserProfile) error
Click to show internal directories.
Click to hide internal directories.