'How to add authentication token on Swagger UI in asp.net framework without converting to asp.net core

Hello I would like to seek advice or recommendation on how to add a authentication token on swagger ui without converting my project into asp.net core since I would be only using asp.net. I have check some guides on the internet with JWT or similar to that but it's framework is on asp.net core. I have added a sample controller below and also a sample goal that on my mind this is from a asp.net core.

Sample Goal

    using System.Web.Http;
using Newtonsoft.Json.Linq;
using ABSRestService.QFlowFFP;
using System.Configuration;
using System;
using System.Net;
using ABSRestService.Models;
using Swashbuckle.Swagger.Annotations;

namespace ABSRestService.Controllers
{

    [RoutePrefix("api/extensions")]
    public class AppointmentTypeController : ApiController
    {
        /// <summary>
        
        /// </summary>
        /// <remarks>
        /// This API will provide all the  Enabled Appointment Type
        ///   Sample request:
        ///     GET /AppointmentType
        /// </remarks>
        /// <returns>
        /// All the  Enabled Appointment Type
        /// </returns>
        [HttpGet]
        [Route("AppointmentType")]
        [SwaggerResponse(200, type: typeof(AppointmentTypeResponse), description: "List of one enabled Appointment Type")]
        [SwaggerResponse(500, type: typeof(InternalServerResponse), description: "When exception occurs")]
        public JObject AppointmentType()
        {
            try
            {
                string websiteAppointmentTypeNameCtName = ConfigurationManager.AppSettings["WebsiteAppointmentTypeNameCTName"];
                string websiteAppointmentTypeFlagCtName = ConfigurationManager.AppSettings["WebsiteAppointmentTypeFlagCTName"];
                string absAptDisplayOrder = ConfigurationManager.AppSettings["AbsAptDisplayOrder"];
                string appointmentTypeDesc = ConfigurationManager.AppSettings["AppointmentTypeDesc"];
                string showAppTypeInOne = ConfigurationManager.AppSettings["ShowAppTypeInOne"];
                string languageCode = ConfigurationManager.AppSettings["LanguageCode"];
                QFlowFFPClient client = new QFlowFFPClient();
                AppointmentType1[] appointmentType = client.GetAllOneAppointmentTypes(
                    websiteAppointmentTypeFlagCtName,
                    websiteAppointmentTypeNameCtName,
                    absAptDisplayOrder,
                    appointmentTypeDesc,
                    showAppTypeOne,
                    languageCode);
                return JObject.FromObject(new
                {
                    status = HttpStatusCode.OK,
                    response = appointmentType
                });
            }
            catch (Exception ex)
            {
                return JObject.FromObject(new
                {
                    status = HttpStatusCode.InternalServerError,
                    response = ex.Message
                });
            }
        }
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source