Show / Hide Table of Contents

Namespace Celerik.NetCore.Web

Classes

AuthorizationHeader

CorsConfig

Defines CORS configuration for the current environment.

CorsExtensions

Adds some extension methods related to the Cors functionality.

CorsHandler

Handler to enable CORS. Policies are read from the appsettings.json file.

CorsOptionsMiddleware

Middleware to process OPTIONS requests when CORS is enabled.

This middleware is necessary because POST request don´t work even with CORS enabled. This is because browsers send an OPTIONS request before the POST request which is not proccesed by the Api.

This middleware is added by the CorsHandler class, so you don´t have to worry for adding it from the Startup.cs class.

ExceptionsHandler

Handler to add global exception handling, specifically we do the following:

  1. Log the exception
  2. Writte a propper ApiResponse<TData> object.

HttpContextLogger

Adds extension methods to the HttpContext class in order to log information.

HttpContextLoggerConfig

Defines log configuration for the HttpContextLoger.

LogRequestFilter

Filter to log the lifetime of a controller action. We log the begining and end of the execution.

MicroserviceStartup

The class containing the startup methods for the application.

PermissionAttribute

Custom Attribute to authorize access to an endpoint based on User Permissions.

PermissionFilter

Custom Filter to restrict access to an endpoint based on user permissions.

SwaggerConfig

Defines Swagger configuration for the current environment.

SwaggerExtensions

Adds some extensions methods related to the Swagger functionality.

SwaggerHandler

Handler to enable Swagger. Configuration is read from the appsettings.json file.

SwaggerOperationFilter

Implementation of the IOperationFilter interface to customize Swagger operations, in particular to allow adding the Authorization header paremeter to the endpoints that require authorization.

UserDataClaimMiddleware

Middleware to include the data of the current authenticated user into the user claims. This data is a UserDto object which contains useful information such as the user permissions.

When we receive the Bearer token in the Authentication header, this token contains a claim with the UserId, so we use that id in order to retrieve the full information of the user.

This middleware is necessary because we only trust in the UserId comming from the Authentication header, but the rest of information of the user can change during the token lifecycle, so it is necesary to get a fresh copy of the user information for each request.

ValidateModelStateFilter

Filter to validate the ModelState. In case the model state is invalid, we send out a custom ApiResponse<TData> and log a propper message.

WebResources

Provides localized strings for this layer.

Enums

CorsPolicy

In This Article
Back to top Generated by DocFX