Release v1.0.0 #16
.envDbInitializer.csDependencyInjection.csPersistence.csprojUberDbContext.cs
.gitea/workflows
ApiDto
ApiDto.csproj
Common
Requests
Responses
Application
Application.csprojDependencyInjection.cs
Backend.slnCommon
Behaviors
Exceptions
Mappings
Cqrs
Campus
Queries
Discipline
Queries
Faculty
Queries
Group
Queries
LectureHall
Queries
Professor
Queries
Schedule
Interfaces
Domain/Schedule
Campus.csDiscipline.csFaculty.csGroup.csLectureHall.csLesson.csLessonAssociation.csProfessor.csSpecificWeek.csTypeOfOccupation.cs
Endpoint
Common
Attributes
BadRequestResponseAttribute.csLocalhostAttribute.csMaintenanceModeIgnoreAttribute.csNotFoundResponseAttribute.csTokenAuthenticationAttribute.cs
Exceptions
Interfaces
Services
Configuration
EnvironmentManager.cs
General
Swagger
Controllers
BaseController.cs
Endpoint.csprojConfiguration
V1
CampusController.csDisciplineController.csFacultyController.csGroupController.csLectureHallController.csProfessorController.csScheduleController.cs
WeatherForecastController.csMiddleware
Program.csWeatherForecast.csPersistence
Contexts
Schedule
EntityTypeConfigurations
Schedule
19
Endpoint/Common/Attributes/LocalhostAttribute.cs
Normal file
19
Endpoint/Common/Attributes/LocalhostAttribute.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
|
using System.Net;
|
||||||
|
|
||||||
|
namespace Mirea.Api.Endpoint.Common.Attributes;
|
||||||
|
|
||||||
|
public class LocalhostAttribute : ActionFilterAttribute
|
||||||
|
{
|
||||||
|
public override void OnActionExecuting(ActionExecutingContext context)
|
||||||
|
{
|
||||||
|
var ip = context.HttpContext.Connection.RemoteIpAddress;
|
||||||
|
if (ip == null || !IPAddress.IsLoopback(ip))
|
||||||
|
{
|
||||||
|
context.Result = new UnauthorizedResult();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
base.OnActionExecuting(context);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user