5.2. GetUser: Log in using username and password

Implement this function:

GetUser(username string, password string) (userdataptr *User, err error)
  • Obtains the User struct of a user who has already been initialized and returns a pointer to it.

  • Returns an error if user has not been initialized or user credentials are invalid.

  • Returns an error if the User struct cannot be obtained due to malicious action or the integrity of the User struct has been compromised.

Parameters
  • username (string) – Username

  • password (string) – Password

Return type

userdataptr, error

Warning

Do not forget that your design must satisfy all requirements, including:

  1. The client application must be stateless (see Stateless).

  2. You cannot use global variables to store user information (see Golang).

  3. Users can have multiple active user sessions at once (see User Sessions).