I, as a Students Api user, need the ability to create, update, get one by id, get all, and delete students.
AC1: Students should have an id, Name, Address and SSN.
Code: https://github.com/fdellasoppa/blexercise.git
Database: Run "docker compose up -d" on BL.Students folder. This is for the MongoDb.
In order to test the User Create:
- Use the Login endpoint with username "administrator@localhost" and password "Passw0rd!" seeded in the code
- After that the Create endpoint should work with authorization
In order to create a Student (I couldn't get the login to work in time):
- Get a token with Postman with a POST at https://localhost:7237/connect/token -- Body (x-www-form-urlencoded): grant_type = client_credentials scope = api.read client_id = students client_secret = secret
- Add this token in the Authorize section in Swagger
- You can use the Create Student endpoint now
-
Think about the Use Case, with some interesting business logic. Games or Students CRUD? Can have SSN column for some logic.
-
Think about data storage, decided on Mongo DB as ORMs are not permitted, wondering if I could use NHibernate though (not on the list and good experience with).
-
Start building Api
-
Separate Api between read-only and write apis. Not needed. Only main use case vs users Apis.
-
Considering KeyCloak or Auth0 for auth Decided to start with KeyCloak and use Authorization Code flow. As I already had a KeyCloak instance running locally on Docker.
-
Remembered a project with IdentityServer and MongoDb as storage, this could be a faster solution. Decided on this approach as KeyCloak does not support Mongo database for backup.
-
Searched for options with relational databases without ORMs, found Kysely. Will review in the future.
-
Clean architecture review, created layers for IdentityServer.
-
Finished first working version of the user create.
-
TDD before adding password validations to the model. Added email tests even not really valid (see comment on UserTests).
-
Test docker compose for database: Use "docker compose up -d"
-
Following: https://www.yogihosting.com/aspnet-core-identity-mongodb/ https://www.yogihosting.com/identityserver-aspnet-core-identity-mongodb-database