fd3ce9f96a
* #103: Adding checks to prevent .wav files from being uploaded: * #103: Added method to create song and moving some code around * #103: Fixed build issue * tsk-103: Cleanup of temporary files * tsk-103: Formatting changes * tsk-103: Minor changes * tsk-103: Fixing build issue * tsk-103: Refactored enum * CORE-23734: Refactoring * tsk-103: Confirmed functionality is working * Removed commented code * Removed commented code
38 lines
854 B
C#
38 lines
854 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
namespace Icarus.Controllers.V1;
|
|
|
|
public class BaseController : ControllerBase
|
|
{
|
|
#region Fiends
|
|
protected IConfiguration? _config;
|
|
#endregion
|
|
|
|
|
|
#region Methods
|
|
[ApiExplorerSettings(IgnoreApi = true)]
|
|
[Obsolete("Asymmetric key signing for tokens have been deprecated")]
|
|
protected string ParseBearerTokenFromHeader()
|
|
{
|
|
var token = string.Empty;
|
|
const string tokenType = "Bearer";
|
|
const string otherTokenType = "Jwt";
|
|
|
|
var req = Request;
|
|
var auth = req.Headers.Authorization;
|
|
var val = auth.ToString();
|
|
|
|
if ((val.Contains(tokenType) || val.Contains(otherTokenType)) && val.Split(" ").Count() > 1)
|
|
{
|
|
var split = val.Split(" ");
|
|
token = split[1];
|
|
}
|
|
|
|
|
|
return token;
|
|
}
|
|
|
|
#endregion
|
|
}
|