Show / Hide Table of Contents

Class 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.

Inheritance
System.Object
UserDataClaimMiddleware
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Celerik.NetCore.Web
Assembly: cs.temp.dll.dll
Syntax
public class UserDataClaimMiddleware

Constructors

UserDataClaimMiddleware(RequestDelegate, IHostingEnvironment)

Initializes a new instance of the class.

Declaration
public UserDataClaimMiddleware(RequestDelegate next, IHostingEnvironment environment)
Parameters
Type Name Description
RequestDelegate next

The object that can process the HTTP request.

IHostingEnvironment environment

Provides information about the web hosting environment.

Methods

Invoke(HttpContext)

Process the request for this middleware.

Declaration
public Task Invoke(HttpContext context)
Parameters
Type Name Description
HttpContext context

Object with all HTTP-specific information.

Returns
Type Description
Task

The task result.

In This Article
Back to top Generated by DocFX