[PD2] Gateway login, logout and auth middleware done.

Co-authored-by: tsousa111 <tiagao2001@hotmail.com>
This commit is contained in:
Afonso Franco 2024-05-30 00:54:19 +01:00
parent aa90bfddce
commit 69559f41ca
Signed by: afonso
SSH key fingerprint: SHA256:PQTRDHPH3yALEGtHXnXBp3Orfcn21pK20t0tS1kHg54
7 changed files with 277 additions and 28 deletions

View file

@ -53,10 +53,16 @@ type (
}
PostRegister struct {
UID string `json:"uid"`
Password string `json:"password"`
Certificate []byte `json:"certificate"`
}
PostLogin struct {
UID string `json:"uid"`
Password string `json:"password"`
}
ReportError struct {
ErrorMessage string `json:"error"`
}
@ -107,6 +113,21 @@ func NewMsgInfo(num int, fromUID string, subject []byte, timestamp time.Time) Ms
}
}
func NewPostRegister(UID string,Password string,Certificate []byte) PostRegister {
return PostRegister{
UID: UID,
Password: Password,
Certificate: Certificate,
}
}
func NewPostLogin(UID string,Password string) PostLogin {
return PostLogin{
UID: UID,
Password: Password,
}
}
func NewAnswerGetMsg(fromUID, toUID string, subject []byte, body []byte, timestamp time.Time, last bool) AnswerGetMsg {
return AnswerGetMsg{
FromUID: fromUID,