เก็บ log User บุคคลภายนอก
This commit is contained in:
parent
0043097b2d
commit
dfa9dd3b47
1 changed files with 9 additions and 2 deletions
|
|
@ -160,6 +160,13 @@ namespace BMA.EHR.Recurit.Exam.Service.Core
|
|||
var token = context.Request.Headers["Authorization"];
|
||||
|
||||
var pf = await GetProfileByKeycloakIdAsync(Guid.Parse(keycloakId), token);
|
||||
var _userFullname = string.Empty;
|
||||
var _userName = string.Empty;
|
||||
if (keycloakId != "00000000-0000-0000-0000-000000000000" && pf == null)
|
||||
{
|
||||
_userFullname = context.User?.FindFirst("name")?.Value;
|
||||
_userName = context.User?.FindFirst("preferred_username")?.Value;
|
||||
}
|
||||
|
||||
await _next(context); // ดำเนินการต่อไปยัง Middleware อื่น ๆ
|
||||
|
||||
|
|
@ -260,8 +267,8 @@ namespace BMA.EHR.Recurit.Exam.Service.Core
|
|||
output = responseBodyJson,
|
||||
|
||||
userId = keycloakId,
|
||||
userName = $"{pf?.Prefix ?? ""}{pf?.FirstName ?? ""} {pf?.LastName ?? ""}",
|
||||
user = pf?.CitizenId ?? ""
|
||||
userName = pf != null ? $"{pf?.Prefix ?? ""}{pf?.FirstName ?? ""} {pf?.LastName ?? ""}" : _userFullname ?? "",
|
||||
user = pf != null ? pf?.CitizenId ?? "" : _userName ?? ""
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue