Pair programming exercise for dotnet server side candidates. Feel free to use google and whatever other tools you would normally use. Please note that you are not expected to solve everything.
If this project is running remotely in a self contained Github Codespace. Please follow this guide for making API calls.
- Click the PORTS tab. This lists all of the ports you have forwarded.
- Right-click the port you want to connect to and click Copy Local Address.
- Finding the GITHUB_TOKEN. In the terminal in your codespace, enter echo $GITHUB_TOKEN. The token is a string beginning ghu_. Copy the token.
- When making a HTTP request add the header X-Github-Token and paste the copyed github token as its value.
Create a simple username and password authentication API. Service interface below.
public interface IUserService
{
UserEntity CreateUser(string userId, string password);
UserEntity UpdatePassword(string userId, string oldPassword, string newPassword);
bool Authenticate(string userId, string password);
List<UserEntity> ListUsers();
}
Update the API by updating the UserController class to use new implementation of user service.
Start with task one and progress as far as time allows. Independent of how far down the tasklist you get do task '7. Commit' when getting close to out of time. Remember to leave 10 min for wrapup at the end.
Do whatever you are comfortable with. Some hints
- Feel free to ask questions at any time.
- Start by trying to get an overview of how the code hangs together.
- Discuss a plan for implementing interface and or changes that could be made to existing code. what is needed to pass tests? security considerations?`
For this task you only need to implement these methods of IUserService:
- CreateUser
- Authenticate
And corresponding endpoints in UserController class:
- CreateUser
- Authenticate
Add a simple implementation of the change password function defined in the interface and corresponding endpoint for updating user password.
Add some password validation rules
Add hashing and salting of password stored in DB
For this task you need to implement the ListUsers methods of IUserService: And corresponding endpoint ListUsers in AdminController class:
Independently of how far down the task list do this when time is close to running out.
Create branch and commit changes. Branch name should be on the follownig format YYYY-MM-DD-SS where
- YYYY - Year
- MM - Month
- DD - Day
- SS - Serial number, given by interviewer
DO NOT USE PERSONAL INFO IN COMMITED DATA
- How did you feel it went?
- What did we do well and what do we need to improve?
- If you had another change what would you improve?
- How long do you think you need to complete the task?