Membriana offers the following functionalities:
- Web-Based Platform: Accessible from any device with an internet connection.
- Member Management: Register, update, and track members.
- Payment Tracking: Record payments, due dates, and payment statuses.
- Automated Billing: Send notifications and reminders for pending payments.
- Pricing Management: Configure different membership types with custom pricing.
- Multi-User Access: Role-based access for admins, operators, and other users.
- Payment Gateway Integration: Connect with online payment platforms.
User related tables are automatically generated by Identity.EntityFrameworkCore.
The AuthenticationController uses Identity's UserManager<AppUser> to manage the login and registration functionalities.
In frontend controllers, JwtAuthorizationFilter ensures that the endpoints requests have a JWT key in their cookies.
Then, the JwtCookieHandler checks if there's a JWT token stored in the current request's cookies (using IHttpContextAccessor) and, if it exists, adds it to the Authorization header as a Bearer Token before sending the request to the API.
In the backend, any endpoint with [Authorize] decodes the token, verifies the signature, checks expiration and returns 401 Unauthorized if any validation fails.
The backend makes sure that the authorization is done with JWT, as builder.Services.AddAuthentication().AddJwtBearer() is injected in Program.cs and expects IdentityModel.Tokens.
Finally, API Filters are used in the API endpoints to ensure that users can only access data belonging to their organization.
Important
Create a file named appsettings.json in the Mvc project directory, modifying the following template code:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ApiBaseUrl": "API_BASE_URL"
}The following table details the parameters which need to be modified:
| Parameter | Key | Details | Example |
|---|---|---|---|
API_BASE_URL |
ApiBaseUrl |
URL where the API is running. | https://localhost:7076 |
Important
Create a file named appsettings.json in the Api project directory, modifying the following template code:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Data Source=.\\SQLEXPRESS; Initial Catalog=membriana_db; Integrated Security=True",
"LOCAL_SERVER_NAME": "Data Source=CUSTOM_PATH\\SQLEXPRESS; Initial Catalog=membriana_db; Integrated Security=True",
"EXTERNAL_SERVER_NAME": "Data Source=SERVER_ADDRESS_OR_IP; Initial Catalog=membriana_db; User ID=USERNAME; Password=PASSWORD; Connect Timeout=30; TrustServerCertificate=True;"
},
"Jwt": {
"Key": "SECRET_KEY",
"Issuer": "Membriana.Api",
"Audience": "Membriana.Mvc",
"ExpireMinutes": 60
}
}The following table details the parameters which need to be modified:
| Parameter | Key | Details |
|---|---|---|
LOCAL_SERVER_NAME |
ConnectionStrings |
Name of the local server string. |
CUSTOM_PATH |
ConnectionStrings |
Path where SQL Express was installed. |
EXTERNAL_SERVER_NAME |
ConnectionStrings |
Name of the external server string. |
SERVER_ADDRESS_OR_IP |
ConnectionStrings |
URL address or IP of the external server. |
USERNAME |
ConnectionStrings |
Username to access the external server. |
PASSWORD |
ConnectionStrings |
Password to access the external server. |
SECRET_KEY |
Jwt |
Random string for signing JWTs. |
Tip
You can replace DefaultConnection in Program.cs by the choosen LOCAL_SERVER_NAME or EXTERNAL_SERVER_NAME. But you may also remove the whole default connection line from appsettings.json and replace the LOCAL_SERVER_NAME or EXTERNAL_SERVER_NAME by DefaultConnection.
Important
Install each of the following NuGet Packages for the respective projects according to the following table:
| Projects | NuGet Package | Version | Purpose |
|---|---|---|---|
| Domain | AspNetCore.Mvc.Core | Latest | ValidateNever annotation. |
| Domain | EntityFrameworkCore | Latest | ORM for database generation. |
| Domain | EntityFrameworkCore.SqlServer | Latest | Enables Microsoft SQL Server. |
| Domain | EntityFrameworkCore.Tools | Latest | Enables migrations. |
| Domain, Infrastructure | Identity.EntityFrameworkCore | 8.0.14 | User authentication. |
| Infrastructure | EntityFrameworkCore.Design | 9.0.5 | Enables migrations. |
| Api | JwtBearer | 8.0.16 | JWT Authentication. |
| Api | Tokens.Jwt | 8.11.0 | JWT Authentication. |
| Application, Mvc | AutoMapper | 12.0.1 | DTOs and Views mapping. |
Tip
In order to install the packages using Visual Studio interface, open the solution, right click the project, select Manage NuGet Packages... and install each package.
This is an open source project licensed under the General GNU Public License. Contributions are welcome! Please fork the repository and create a pull request with your improvements or suggestions. Make sure to check the contibution guide before.