Add project files.
This commit is contained in:
		
							
								
								
									
										27
									
								
								Core.Cerberos.Provider/Providers/Helper.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								Core.Cerberos.Provider/Providers/Helper.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| // *********************************************************************** | ||||
| // <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 ?? ""; | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin