This is a simple User Management API built using ASP.NET Core to demonstrate the use of authentication and session management in a back-end development project. This API provides the functionality to authenticate users through a login endpoint, retrieve a session key, and use it to access user-related data.
This project is part of the Back-End Development with .NET course on Coursera from Microsoft. The API allows users to:
- Login using their credentials (email and password).
- Retrieve a SessionKey after successful login.
- Use the SessionKey to make authenticated requests to the
/users
endpoint and access user data.
- Login Endpoint (
/login
): Allows users to log in with their email and password. - Session Management: After a successful login, the API returns a session key that the user must include in subsequent requests to authenticate and retrieve user data.
- User Endpoint (
/users
): A protected endpoint that returns the list of users, accessible only with a valid session key.
- Endpoint:
/login
- Method:
POST
- Description: Logs in the user with email and password, and returns a session key.
curl -X POST https://your-api-url/login \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "password": "password123"}'
### Authenticated Request
After you have the **SessionKey**, you can make an authenticated request to `/users`.
```bash
curl -X GET https://your-api-url/users \
-H "SessionKey: your-session-key"