public async Task <IActionResult> GenerateToken([FromBody] CatalogLogin model)
        {
            var claims = new[]
            {
                new Claim(ClaimTypes.Email, model.Email),
                new Claim(JwtRegisteredClaimNames.Iss, configuration["AdminTokenAuthentication:Issuer"])
            };

            var key              = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(configuration["AdminTokenAuthentication:SecretKey"]));
            var creds            = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
            var expirationBuffer = configuration["AdminTokenAuthentication:Expiration"] != null?int.Parse(configuration["AdminTokenAuthentication:Expiration"]) : 3;

            var expiryDate = DateTime.UtcNow.AddMinutes(expirationBuffer);
            var token      = new JwtSecurityToken(configuration["AdminTokenAuthentication:Issuer"],
                                                  configuration["AdminTokenAuthentication:Audience"],
                                                  claims,
                                                  expires: expiryDate,
                                                  signingCredentials: creds);

            if (model.Email == "*****@*****.**" && model.Password == "12345678")
            {
                var result = await Task.FromResult(new
                {
                    access_token = new JwtSecurityTokenHandler().WriteToken(token),
                    expirationBuffer,
                    expiryDate
                });

                return(Ok(result));
            }
            return(Unauthorized());
        }
        public async Task <IActionResult> Login([FromBody] CatalogLogin login)
        {
            var claims = new Claim[] {
                new Claim(ClaimTypes.Email, login.Email),
                new Claim(JwtRegisteredClaimNames.Iss, configuration["AdminTokenAuthentication:Issuer"])
            };
            var identity = new ClaimsIdentity(CookieAuthenticationDefaults.AuthenticationScheme, ClaimTypes.Name, ClaimTypes.Role);

            identity.AddClaim(new Claim(ClaimTypes.Email, login.Email));
            var principal = new ClaimsPrincipal(identity);
            await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal, new AuthenticationProperties { IsPersistent = false });

            return(Ok(await Task.FromResult(0)));
        }