auth

package
v2.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckError added in v2.1.1

func CheckError(err error)

func CheckPassword

func CheckPassword(password string, hash string) bool

func CreateToken

func CreateToken(claims map[string]interface{}) (string, error)

func GetAccountType

func GetAccountType(token string) (string, error)

func GetAuthenticatedAccount added in v2.1.1

func GetAuthenticatedAccount(authToken string) (string, string)

func GetBearerToken

func GetBearerToken(req *http.Request) string

func HashPassword

func HashPassword(password string) string

func NewTokenAuth

func NewTokenAuth() *jwtauth.JWTAuth

func RegisterAdmin

func RegisterAdmin(email string, password string, firstName string, lastName string, token string) (model.Admin, error)

func RegisterDoctor

func RegisterDoctor(email string, password string, name string, firstname string, address AddressInput) (model.Doctor, error)

func RegisterPatient

func RegisterPatient(email string, password string) (model.Patient, error)

func VerifyToken

func VerifyToken(tokenString string) bool

Types

type AddressInput

type AddressInput struct {
	Street  string `json:"street"`
	ZipCode string `json:"zip_code"`
	Country string `json:"country"`
	City    string `json:"city"`
}

type AdminInput

type AdminInput struct {
	Password string `json:"password"`
	Name     string `json:"name"`
	LastName string `json:"last_name"`
	Email    string `json:"email"`
	Token    string `json:"token"`
}

type AuthenticatedAccountResponse added in v2.2.2

type AuthenticatedAccountResponse struct {
	ID   string
	Code int
	Err  error
}

func AuthMiddlewareAccount added in v2.1.1

func AuthMiddlewareAccount(w http.ResponseWriter, r *http.Request) AuthenticatedAccountResponse

func AuthMiddlewareDoctor added in v2.0.2

func AuthMiddlewareDoctor(w http.ResponseWriter, r *http.Request) AuthenticatedAccountResponse

func AuthMiddlewarePatient added in v2.1.1

func AuthMiddlewarePatient(w http.ResponseWriter, r *http.Request) AuthenticatedAccountResponse

type BlackListDeviceResponse added in v2.1.11

type BlackListDeviceResponse struct {
	Code int
	Err  error
}

func BlackListDevice added in v2.1.11

func BlackListDevice(token string, ownerID string) BlackListDeviceResponse

type CheckAccountStatusResponse

type CheckAccountStatusResponse struct {
	Status bool
	Code   int
	Err    error
}

func CheckAccountEnable

func CheckAccountEnable(id string) CheckAccountStatusResponse

type CodeEmailResponse added in v2.1.0

type CodeEmailResponse struct {
	Code int
	Err  error
}

func Email2faAuth added in v2.1.0

func Email2faAuth(email string) CodeEmailResponse

type CreatePatientAccountResponse

type CreatePatientAccountResponse struct {
	Id   string
	Code int
	Err  error
}

func CreatePatientAccount

func CreatePatientAccount(email string) CreatePatientAccountResponse

type CreateSaveCodeResponse

type CreateSaveCodeResponse struct {
	SaveCode model.SaveCode
	Code     int
	Err      error
}

func CreateBackupCodes

func CreateBackupCodes(id string, r *http.Request) CreateSaveCodeResponse

type DoctorInput

type DoctorInput struct {
	Password  string       `jon:"password"`
	Email     string       `json:"email"`
	Name      string       `json:"name"`
	Firstname string       `json:"firstname"`
	Address   AddressInput `json:"address"`
}

type GetDoctorByIdResponse

type GetDoctorByIdResponse struct {
	Doctor model.Doctor
	Code   int
	Err    error
}

func GetDoctorById

func GetDoctorById(id string) GetDoctorByIdResponse

type GetDoctorsResponse

type GetDoctorsResponse struct {
	Doctors []model.Doctor
	Code    int
	Err     error
}

func GetDoctors

func GetDoctors(page int, size int) GetDoctorsResponse

type Login2faEmailInput added in v2.1.0

type Login2faEmailInput struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Token2fa string `json:"token_2fa"`
}

type Login2faEmailResponse added in v2.1.0

type Login2faEmailResponse struct {
	Token string
	Code  int
	Err   error
}

func Login2faEmail added in v2.1.0

func Login2faEmail(input Login2faEmailInput, nameDevice string) Login2faEmailResponse

type Login2faSaveCodeInput added in v2.1.0

type Login2faSaveCodeInput struct {
	Email      string `json:"email"`
	Password   string `json:"password"`
	BackupCode string `json:"backup_code"`
}

type Login2faSaveCodeesponse added in v2.1.0

type Login2faSaveCodeesponse struct {
	Token string
	Code  int
	Err   error
}

func Login2faSaveCode added in v2.1.0

func Login2faSaveCode(input Login2faSaveCodeInput, nameDevice string) Login2faSaveCodeesponse

type Login2faThirdPartyInput added in v2.1.0

type Login2faThirdPartyInput struct {
	Email    string `json:"email"`
	Password string `json:"password"`
	Token2fa string `json:"token_2fa"`
}

type Login2faThirdPartyResponse added in v2.1.0

type Login2faThirdPartyResponse struct {
	Token string
	Code  int
	Err   error
}

func Login2faThirdParty added in v2.1.0

func Login2faThirdParty(input Login2faThirdPartyInput, nameDevice string) Login2faThirdPartyResponse

type LoginInput

type LoginInput struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type LoginResponse

type LoginResponse struct {
	Token string
	Code  int
	Err   error
}

func Login

func Login(input LoginInput, t string, nameDevice string) LoginResponse

type MissingPasswordResponse

type MissingPasswordResponse struct {
	Code int
	Err  error
}

func MissingPassword

func MissingPassword(email string) MissingPasswordResponse

type ModifyAccountStatusResponse

type ModifyAccountStatusResponse struct {
	Patient model.Patient
	Doctor  model.Doctor
	Code    int
	Err     error
}

func ModifyStatusAccount

func ModifyStatusAccount(id string, status bool) ModifyAccountStatusResponse

type PatientInput

type PatientInput struct {
	Password string `json:"password"`
	Email    string `json:"email"`
}

type RegisterAndLoginResponse

type RegisterAndLoginResponse struct {
	Token string
	Code  int
	Err   error
}

func RegisterAndLoginAdmin

func RegisterAndLoginAdmin(email string, password string, firstName string, lastName string, token string) RegisterAndLoginResponse

func RegisterAndLoginDoctor

func RegisterAndLoginDoctor(email string, password string, name string, firstname string, address AddressInput, nameDevice string) RegisterAndLoginResponse

func RegisterAndLoginPatient

func RegisterAndLoginPatient(email string, password string, nameDevice string) RegisterAndLoginResponse

type ResetPasswordResponse

type ResetPasswordResponse struct {
	Code int
	Err  error
}

func ResetPassword

func ResetPassword(password string, uuid string) ResetPasswordResponse

type UpdatePasswordInput added in v2.1.0

type UpdatePasswordInput struct {
	OldPassword string `json:"old_password"`
	NewPassword string `json:"new_password"`
}

type UpdatePasswordResponse added in v2.1.0

type UpdatePasswordResponse struct {
	Code int
	Err  error
}

func UpdatePassword added in v2.1.0

func UpdatePassword(input UpdatePasswordInput, ownerId string) UpdatePasswordResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL