Asp.net 如何在identity server 4中获取设备代码流的用户代码
我试图使用已经在IdentityServer4中实现的设备代码流,但是在文档中,我找不到任何关于设备代码流的有用信息。我找到了一个设备代码流的例子,但我不明白什么是用户代码,如何获取或保存它 下面是用于获取授权上下文的基本服务Asp.net 如何在identity server 4中获取设备代码流的用户代码,asp.net,asp.net-core,identityserver4,Asp.net,Asp.net Core,Identityserver4,我试图使用已经在IdentityServer4中实现的设备代码流,但是在文档中,我找不到任何关于设备代码流的有用信息。我找到了一个设备代码流的例子,但我不明白什么是用户代码,如何获取或保存它 下面是用于获取授权上下文的基本服务 private readonly IDeviceFlowInteractionService _interaction; public DeviceController( IDeviceFlowInteractionService int
private readonly IDeviceFlowInteractionService _interaction;
public DeviceController(
IDeviceFlowInteractionService interaction)
{
_interaction = interaction;
_clientStore = clientStore;
_resourceStore = resourceStore;
_events = eventService;
_logger = logger;
}
private async Task<DeviceAuthorizationViewModel> BuildViewModelAsync(string userCode, DeviceAuthorizationInputModel model = null)
{
var request = await _interaction.GetAuthorizationContextAsync(userCode);
// Some code ...
return null;
}
私有只读IDeviceFlowInteractionService\u交互;
公共设备控制器(
IDEVICEFlowInteraction(服务交互)
{
_互动=互动;
_clientStore=clientStore;
_resourceStore=resourceStore;
_事件=事件服务;
_记录器=记录器;
}
专用异步任务BuildViewModelAsync(字符串用户代码,DeviceAuthorizationInputModel model=null)
{
var request=wait_interaction.GetAuthorizationContextAsync(用户代码);
//一些代码。。。
返回null;
}
正如您在上面所看到的,我使用了GetAuthorizationContext,它有参数userCode,但我不知道如何获取此代码?或者在哪里保存它。在文档中,我没有找到任何关于用户代码的信息。由一名IdentityServer维护人员构建,展示了如何利用设备流
客户端需要向设备授权端点发出请求,以生成代码。由的第38行指示,生成代码后,应将其显示给用户
然后,用户可以在web应用程序中输入代码,以提交到上面构建的DeviceController