I’ve got a REST API set-up with JWT authentication. I would like to add an audit trail of who is making the requests to the API. Perhaps log IP addresses of hosts connecting or better again parse the JWT payload to pull out the name of the owner of the token.
I’m not aware of an internal log in UD that will capture this so wondering if I can build this functionality into the REST API instance I have.
Just to be clear i’m parsing the $Request object not the claimsparincipal …
it’s something really basic … i just pass the $request object to a simple function then extract datas that are of interest for me, like that
Just wrap that in a function, then adapat at your will here is an example of what i’m interested in … (there are more but, this might help you )
$Request.HttpContext.Request.Method #do something with that
$Request.HttpContext.Request.QueryString.Value #do something with that
If ( $Request.HttpContext.Request.Method -eq "GET" ) {
$Request.HttpContext.Request.QueryString.Value
}