auth

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(w http.ResponseWriter, r *http.Request) string

func AuthMiddlewareDoctor added in v2.0.2

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

func AuthenticateRequest

func AuthenticateRequest(w http.ResponseWriter, req *http.Request) (string, bool)

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 GetAuthenticatedDoctor added in v2.0.2

func GetAuthenticatedDoctor(w http.ResponseWriter, r *http.Request) string

func GetAuthenticatedUser

func GetAuthenticatedUser(w http.ResponseWriter, r *http.Request) 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 CheckAccountStatusResponse

type CheckAccountStatusResponse struct {
	Status bool
	Code   int
	Err    error
}

func CheckAccountEnable

func CheckAccountEnable(id string) CheckAccountStatusResponse

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() GetDoctorsResponse

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(email string, password string, uuid string) ResetPasswordResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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