Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to get client list with all auth. keys to be served to a list of services. using token for authentication. This presents how-ever security risk as all active configuration is presented at once.
/// <summary>
/// used to provide definition for gateway service about active keys for clients, to about active client configuration
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
[HttpGet]
public IActionResult GetClientList(string token)
{
if (ValidateToken(token))
{
var clientKey = Guid.NewGuid();
var clientAccessKey = Guid.NewGuid();
var clientAccessKey1 = Guid.NewGuid();
var clientAccessKey2 = Guid.NewGuid();
var activeClientList = new
{
clientKey = new
{
clientAccessKey = DateTime.UtcNow.AddYears(1),
clientAccessKey1 = DateTime.UtcNow.AddDays(90)
}
};
var model = new
{
activeClientList,
updateUrl = "https://mydomain.com/urlPath",
refreshRate = 90,
};
// log message before sending to audit
return Ok(model);
}
else
{
// someone can be trying to hack us, lets log everything
return Ok();
}
}
/// <summary>
/// sed to validate
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
private bool ValidateToken(string token)
{
///todo
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.