using System.Text.Json; using Dapr.Client; using DigestAuthenticationOnWCF; using FrameworkDAL.DTO.MessagingQueue; using GB5Shared.DTO.Framework.Authentication; using GB5Shared.DTO.Framework.ResponseStandard; using GB5Shared.DTO.Framework.SuccessORError; using Microsoft.AspNetCore.Mvc; using static GB5Shared.GB5Constant.Constant; namespace FrameworkSL.Controllers.ServerService { [ApiController] [Route("[controller]")] public class ServerService : ControllerBase { [HttpGet("authenticate")] public async Task> Authentication() { //SerializationJson json = new(); try { SuccessDTO successDTO = new(); var base64Converter = new Base64Converter(); var privateHashEncoder = new PrivateHashEncoder(Guid.NewGuid().ToString(), new MD5Encoder()); AuthenticationDTO Header = new AuthenticationDTO(); NonceGenerator Nn = new NonceGenerator(privateHashEncoder, base64Converter); Header.Nonce = Nn.Generate(Guid.NewGuid().ToString()); Header.KeycloakUrl = "http://localhost:5000/Keycloak/KeyCloakAuthenticateUser"; Header.Opaque = Guid.NewGuid().ToString(); Header.Qop = "Auth"; Header.Realm = "Private Data"; successDTO.Body = Newtonsoft.Json.JsonConvert.SerializeObject(Header); return await GB5Shared.ResponseStandard.Response.CreateSuccessResponse( successDTO.Body, CacheKeyLevel.NOT_REQUIRED, null! ); } catch (Exception) { throw; } } } }