问题描述
我正在使用 custom storage provider 处理 .NET 5 POC,并使用 OpenIDDict 添加 authorization server。我能够使自定义商店实现工作,但我无法连接授权服务器以使用自定义商店实现,因为文档仅存在于 EntityFramework 实现。
这是我的启动配置服务片段
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IUserStore<ApplicationUser>,UserStore>();
services.AddTransient<IRoleStore<ApplicationRole>,RoleStore>();
services.AddIdentity<ApplicationUser,ApplicationRole>()
.AddDefaultTokenProviders();
string connectionString = Configuration.GetConnectionString("DefaultConnection");
services.AddTransient<sqlConnection>(e => new sqlConnection(connectionString));
services.AddOpenIddict()
.AddServer(options =>
{
options.AllowClientCredentialsFlow();
options.SetTokenEndpointUris("connect/token");
// Encryption and signing of tokens
options
.AddEphemeralEncryptionKey()
.AddEphemeralSigningKey();
// Register scopes (permissions)
options.RegisterScopes("api");
options.UseAspNetCore().EnabletokenEndpointPassthrough();
});
services.AddControllers();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1",new OpenApiInfo { Title = "ServerAPI",Version = "v1" });
});
}
典型的 EF 实现如下
关于自定义商店实现应该是什么的任何指示? 此外,此处为自定义授权服务器提供的文档似乎已经过时且不再维护https://kevinchalet.com/2016/07/13/creating-your-own-openid-connect-server-with-asos-creating-your-own-authorization-provider/。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)