Identity Server 3:记录客户端ID以进行报告 [英] Identity Server 3 : Logging client id for reporting

查看:62
本文介绍了Identity Server 3:记录客户端ID以进行报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找为每个请求记录客户机ID(如果可用)的选项,以便可以将其用于报告目的,以找出每个客户机的请求数.当LogLevel为Information时,Ids会记录令牌请求的客户端ID.查看IDS代码,我们需要从AuthenticationHeader或请求的主体中提取客户端ID.想知道是否已经在id中内置了任何功能来执行此操作.还有其他方法吗?

I am looking at options to log client id for every request (if available), so that it can be used for reporting purpose to find out the number of request per client. Ids logs the client id for token request when LogLevel is Information. Looking at IDS code, we need to extract the client id from AuthenticationHeader or from Body of the request. Wanted to know if there anything that is already built into ids to do this. Any other ways to do this?

推荐答案

绝对!

您需要执行 IEventService .

可以在这些内部扩展方法的源代码中查看正在传输到IEventService的所有事件的概述. IEventServiceExtensions .

An overview of all the events being transmitted to the IEventService can be viewed in the source of these internal extension methods; IEventServiceExtensions.

AccessTokenIssuedEventAuthorizationCodeDetailsRefreshTokenDetails事件将包含

The AccessTokenIssuedEvent, AuthorizationCodeDetails and RefreshTokenDetails events will include the ClientId receiving the token - so you can create an audit log.

IEventService的默认实现是

The default implementation of IEventService is the DefaultEventService, which will use the logging mechanism you're using for IdentityServer, but you can swap that out to log to a DB if you prefer.

这篇关于Identity Server 3:记录客户端ID以进行报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆