Created
August 16, 2018 07:39
-
-
Save cpoDesign/26482f97e2dc8e35625bcd7b08cafb54 to your computer and use it in GitHub Desktop.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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