创建访问令牌的类是DefaultTokenService
,它的可访问性级别为public
。
https://github.com/IdentityServer/IdentityServer4/blob/dev/src/IdentityServer4/Services/DefaultTokenService.cs
相关的方法是:
public virtual async Task<Token> CreateAccessTokenAsync(TokenCreationRequest request)
所以它似乎是可能的。
-
还是我看事情都错了?
我可能推迟那个产品的所有者。
-
但我觉得讽刺的是,你可以
- 注册IdentityServer为使用client_credentials客户端授予类型,并允许其访问您的审计日志API资源。
- 有IdentityServer客户从自身
- 获得的access_token然后拨打电话作为IdentityServer客户端审计日志记录API资源,那么这将道岔周围,回调IdentityServer以验证它只是产生的access_token。
这样的方式,其他客户的工作,那么为什么不自己...
编辑
只是为了文档,这里是我所根据leastprivilege的指令:
public AccountController(
IIdentityServerInteractionService interaction,
IClientStore clientStore,
IHttpContextAccessor httpContextAccessor,
ITokenCreationService tokenCreationService,
TestUserStore users = null)
{
_users = users ?? new TestUserStore(Config.Users);
_interaction = interaction;
_account = new AccountService(interaction, httpContextAccessor, clientStore);
_identityServerTools = new IdentityServerTools(httpContextAccessor, tokenCreationService);
}
再次。没有提供文档和示例。 – r1verside
,因为你到处都问得很好 - http://docs.identityserver.io/en/dev/topics/tools.html – leastprivilege
再次谢谢你。顺便说一句,我不能upvote,直到答案得到编辑。一旦它是我会的。 – r1verside