Documentation ¶
Index ¶
- Variables
- func CreateMemberToken(userid, roleId int, secretKey string, loginType string) (string, error)
- func GenerateEmail() error
- func IsDeleted(db *gorm.DB) *gorm.DB
- type Action
- type Auth
- func (auth *Auth) CheckMemberLogin(memberlogin MemberLoginCheck) (TblMember, error)
- func (auth *Auth) Checklogin(Username string, Password string) (string, int, error)
- func (auth *Auth) CreateToken() (string, error)
- func (auth *Auth) GenerateMemberToken(memberid int, loginType string, secretKey string) (token string, err error)
- func (permission *Auth) IsGranted(modulename string, permisison Action) (bool, error)
- func (auth *Auth) MemberVerifyToken(token string, secret string) (memberid int, groupid int, loginType string, err error)
- func (auth *Auth) UpdateMemberOTP(otp OTP) (int, time.Time, error)
- func (auth *Auth) VerifyToken(token string, secret string) (userid int, loginType string, err error)
- type Authentication
- type Config
- type MemberLoginCheck
- type OTP
- type TblMember
- type TblModule
- type TblModulePermission
- type TblRolePermission
- type Type
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorPassword = errors.New("invalid password") ErrorToken = errors.New("invalid token") ErrorOtpExpiry = errors.New("otp expired") ErrorConvertTime = errors.New("could not convert interface to time.Time") ErrorMemberLogin = errors.New("select any one of the config for member login") ErrorInactive = errors.New("user disabled please contact admin") ErrorInvalidOTP = errors.New("invalid OTP") ErrorInactiveMember = errors.New("inactive member") ErrorTokenExpiry = errors.New("token expired") )
View Source
var Authmodel authmodel
Functions ¶
func CreateMemberToken ¶ added in v0.0.6
Create meber token
func GenerateEmail ¶
func GenerateEmail() error
Types ¶
type Auth ¶
type Auth struct { UserId int ExpiryTime int ExpiryFlg bool SecretKey string DB *gorm.DB AuthFlg bool PermissionFlg bool RoleId int RoleName string DataAccess int }
func (*Auth) CheckMemberLogin ¶
func (auth *Auth) CheckMemberLogin(memberlogin MemberLoginCheck) (TblMember, error)
func (*Auth) Checklogin ¶
Check UserName Password - userlogin
func (*Auth) CreateToken ¶
CreateToken creates a token
func (*Auth) GenerateMemberToken ¶ added in v0.0.6
func (auth *Auth) GenerateMemberToken(memberid int, loginType string, secretKey string) (token string, err error)
member token
func (*Auth) MemberVerifyToken ¶ added in v0.0.6
func (auth *Auth) MemberVerifyToken(token string, secret string) (memberid int, groupid int, loginType string, err error)
verify token
func (*Auth) UpdateMemberOTP ¶ added in v0.0.6
update otp
type Authentication ¶
type Config ¶
type Config struct { UserId int //(optional) if you use login function this userid no need ExpiryTime int //It should be an hour not a mintues, UTC time only ExpiryFlg bool //if you want to check token expiry time enable expiryflg true otherwise expirytime not check SecretKey string //jwt secretkey DB *gorm.DB //database connection DataBaseType Type RoleId int RoleName string OTPAttempt int //how many times otp attempt }
type MemberLoginCheck ¶
type TblMember ¶
type TblMember struct { Id int Uuid string FirstName string LastName string Email string MobileNo string IsActive int ProfileImage string ProfileImagePath string LastLogin int MemberGroupId int Password string Username string Otp int OtpExpiry time.Time LoginTime time.Time IsDeleted int DeletedOn time.Time DeletedBy int CreatedOn time.Time CreatedBy int ModifiedOn time.Time ModifiedBy int }
type TblModulePermission ¶
type TblRolePermission ¶
Click to show internal directories.
Click to hide internal directories.