23 lines
701 B
C#
23 lines
701 B
C#
namespace TIAMWebApp.Server.Services
|
|
{
|
|
public class AuthService
|
|
{
|
|
public string GetAuthTokenFromRequest(HttpRequest request)
|
|
{
|
|
// Check if the Authorization header is present
|
|
if (request.Headers.ContainsKey("Authorization"))
|
|
{
|
|
// Extract the token from the Authorization header
|
|
var authHeader = request.Headers["Authorization"].ToString();
|
|
if (authHeader.StartsWith("Bearer ", System.StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
return authHeader.Substring("Bearer ".Length).Trim();
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
}
|
|
}
|