Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Authentication 如何记录检查了哪些保险单和索赔_Authentication_Logging_.net Core - Fatal编程技术网

Authentication 如何记录检查了哪些保险单和索赔

Authentication 如何记录检查了哪些保险单和索赔,authentication,logging,.net-core,Authentication,Logging,.net Core,(这是我的第一个问题,非常感谢您帮助我正确回答这个问题并提供相应的指导方针) 我正在基于dotnetcore(3.1)构建一个小型web应用程序。为了控制对控制器的访问,我使用这种装饰器: [Authorize(Roles = "Administrator")] public async Task<ActionResult<Stuff>> GetStuff(){ ... [Authorize(Roles = "Administrator")] [Authorize(Po

(这是我的第一个问题,非常感谢您帮助我正确回答这个问题并提供相应的指导方针)

我正在基于dotnetcore(3.1)构建一个小型web应用程序。为了控制对控制器的访问,我使用这种装饰器:

[Authorize(Roles = "Administrator")]
public async Task<ActionResult<Stuff>> GetStuff(){
...
[Authorize(Roles = "Administrator")]
[Authorize(Policy = "CustomAccessPolicy")]
public async Task<ActionResult<Stuff>> GetStuff(){
...
如果我在没有管理员角色的情况下提出相同的请求,我会得到以下结果:

[12:46:59 INF] Request starting HTTP/1.1 GET http://localhost:5002/api/getstuff/  
[12:56:36 INF] Authorization failed.
现在,为了解决我的问题,让我们添加另一个装饰器:

[Authorize(Roles = "Administrator")]
public async Task<ActionResult<Stuff>> GetStuff(){
...
[Authorize(Roles = "Administrator")]
[Authorize(Policy = "CustomAccessPolicy")]
public async Task<ActionResult<Stuff>> GetStuff(){
...
我如何才能获得保单/索赔/授权检查的准确日志

我相信这可能是一个配置问题(某个组件的日志级别?),或者我需要重新实现某些方法/绑定到某些事件

非常感谢