This was the API for The Wall before deciding to use AWS Lambdas and DynamoDB instead.
This is a .NET Core REST API that uses JWT authentication. A token is returned on successful login, which can be used to access protected routes.
- GenerateSecurityToken Returns a JWT Token signed with a private key. The claim used is the username and the encryption algorithm is Sha256.
- CRUD functions
For mongoDB database, using the MongoDB.Driver library.
- Authenticate
Returns true if username and password exist in the users document.
Adds token validation for controllers with the [Authorize]
property.
Mock controller to test the JWT service
- GET - api/sampleToken
Returns a new JWT token with "fakeUsername" as username claim.
- POST - users/authenticate
Calls the Authenticate function of the User Service. Returns user credentials and JWT token if successful.
Template controller that comes from project creation.
Added the [Authorize]
property to test the Authentication Middleware
- GET - /weatherforecast
Returns the sample weather forecast only if the JWT token is valid.