https://github.com/codeflow-inc/authentication
An API for user authentication and authorization built with ASP.NET Core, Entity Framework Core, and ASP.NET Core Identity. The project provides a foundation for managing user authentication, role-based access control, and JWT token issuance.
https://github.com/codeflow-inc/authentication
csharp docker dotnet entity-framework identity
Last synced: about 2 months ago
JSON representation
An API for user authentication and authorization built with ASP.NET Core, Entity Framework Core, and ASP.NET Core Identity. The project provides a foundation for managing user authentication, role-based access control, and JWT token issuance.
- Host: GitHub
- URL: https://github.com/codeflow-inc/authentication
- Owner: CodeFlow-Inc
- Created: 2025-01-24T11:35:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-03T21:33:15.000Z (over 1 year ago)
- Last Synced: 2025-03-22T02:13:28.002Z (over 1 year ago)
- Topics: csharp, docker, dotnet, entity-framework, identity
- Language: C#
- Homepage:
- Size: 82 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AuthApi
An API for user authentication and authorization built with **ASP.NET Core**, **Entity Framework Core**, and **ASP.NET Core Identity**. The project provides a foundation for managing user authentication, role-based access control, and JWT token issuance.
## Features
- User registration and login.
- JWT token generation and validation for secure API access.
- Role-based access control.
- Extendable user and role models for custom attributes.
- Clean Architecture design pattern for scalability and maintainability.
## Getting Started
### Prerequisites
Before starting, ensure you have the following installed:
- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)
- [Docker](https://www.docker.com/)
## Project Structure
The project follows **Clean Architecture** principles with the following layers:
- **API**: Handles HTTP requests and responses.
- **Application**: Contains business logic and service implementations.
- **Domain**: Contains core entities and interfaces.
- **Infrastructure**: Handles data persistence and third-party integrations.
## API Endpoints
### Authentication
- **POST /api/auth/register**
Register a new user.
**Request body:**
```json
{
"email": "user@example.com",
"password": "YourStrongPassword123!",
"confirmPassword": "YourStrongPassword123!"
}
```
- **POST /api/auth/login**
Authenticate a user and return a JWT token.
**Request body:**
```json
{
"email": "user@example.com",
"password": "YourStrongPassword123!"
}
```
### Roles
- **GET /api/auth/roles**
Retrieve the roles assigned to the authenticated user.
## Security
- Passwords are hashed using **ASP.NET Core Identity**'s default algorithms.
- JWT tokens are used for stateless authentication and have configurable expiration.
- Follow best practices for storing the JWT secret in environment variables or secure stores like Azure Key Vault.
## Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
## Future Enhancements
- Implement password recovery functionality.