Files
Core.Thalos.DAL.API/Core.Cerberos.Provider/Providers/Helper.cs
Sergio Matias Urquin c34987797a Add project files.
2025-04-29 18:55:44 -06:00

28 lines
1.0 KiB
C#

// ***********************************************************************
// <copyright file="Helper.cs">
// Heath
// </copyright>
// ***********************************************************************
using Microsoft.AspNetCore.Http;
using System.Security.Claims;
namespace Core.Cerberos.Provider.Providers
{
/// <summary>
/// Provides helper methods for common operations.
/// </summary>
public static class Helper
{
/// <summary>
/// Retrieves the email address of the authenticated user from the HTTP context.
/// </summary>
/// <param name="httpContextAccessor">The IHttpContextAccessor instance to access the current HTTP context.</param>
/// <returns>The email address of the authenticated user, or an empty string if not available.</returns>
public static string GetEmail(IHttpContextAccessor httpContextAccessor)
{
return httpContextAccessor.HttpContext?.User?.FindFirst(ClaimTypes.Email)?.Value ?? "";
}
}
}