Obtaining the current user
If your application requires user authentication for some functionalities, you generally need to get information about the current user. ABP provides the ICurrentUser
service to obtain detailed information for the currently logged-in user. For web applications, the implementation of ICurrentUser
is completely integrated with ASP.NET Core's authentication system, so you can easily get claims of the current user.
See the following code block for simple usage of the ICurrentUser
service:
using System; using Volo.Abp.DependencyInjection; using Volo.Abp.Users; namespace DemoApp { public class MyService : ITransientDependency { private readonly ICurrentUser _currentUser; public MyService(ICurrentUser currentUser) { ...