小编Hil*_*lls的帖子

了解 Identityserver4 与身份(cookies/令牌,服务器架构)

我在理解大局如何整合时遇到了一些问题。对于初学者来说,这是一个很大的话题。

当与 IdentityServer 结合时,Identity 的 cookie 及其所有默认模板/页面在发布令牌时有何意义?

为什么即使在使用 SPA 客户端时,这些页面也包含在所有示例中?能够通过 API 授权/认证/注册不是重点吗?

我看到很多人建议在它自己的项目中应该有IdentityServer,然后在本地网络上单独的用户数据库,这怎么可能?我还没有找到这样的样本。

为什么需要将用户数据库与资源 API 分开,并且 IdentityServer4 和 Identity 的组合不是它自己的 API?

我感谢您的时间和帮助。

c# asp.net-identity asp.net-core identityserver4

4
推荐指数
2
解决办法
800
查看次数

尝试激活 SecurityStampValidator 时无法解析 ISystemClock 的服务

我尝试将 Identity 添加到我的 Web API,但收到此错误

InvalidOperationException:尝试激活 >'Microsoft.AspNetCore.Identity.SecurityStampValidator`1[WebAPI.Models.User>]' 时无法解析类型 >'Microsoft.AspNetCore.Authentication.ISystemClock' 的服务。

在 Startup.cs 中添加 Identity 后,我有这个

services.AddIdentityCore<User>(options => { });
            new IdentityBuilder(typeof(User), typeof(IdentityRole), services)
                .AddRoleManager<RoleManager<IdentityRole>>()
                .AddSignInManager<SignInManager<User>>()
                .AddEntityFrameworkStores<DataContext>();

app.UseAuthentication();
Run Code Online (Sandbox Code Playgroud)

usermodel 类是空的。一切都加载到数据库中。有什么不见了?我感谢您的时间和帮助。

c# asp.net-core-webapi asp.net-core-identity

3
推荐指数
1
解决办法
2442
查看次数

路径不适用于 Blazor 中允许的 IdentityServer CORS 端点,但适用于 Postman

在单独的项目中具有带有 IdentityServer4 和 Blazor 客户端的 Identity 用户数据库 API。我可以通过 Postman 注册一个新用户。在 Blazor 客户端中运行以下代码时(用于修补和学习)

@page "/registrer"
@using Models
@using System.Net.Http
@using IdentityModel.Client
@inject HttpClient Http

    <EditForm Model="@registerUserModel" OnValidSubmit="@HandleValidSubmit">
        <DataAnnotationsValidator />
        <ValidationSummary />

        <InputText id="email" type="email" @bind-Value="@registerUserModel.Email" />
        <InputText id="password" type="password" @bind-Value="@registerUserModel.Password" />
        <InputText id="confirmPassword" type="password" @bind-Value="@registerUserModel.ConfirmPassword" />

        <button type="submit">Registrer deg</button>
    </EditForm>

@code {
    private RegisterUserModel registerUserModel = new RegisterUserModel();

    public async Task HandleValidSubmit()
    {
        var newUser = new RegisterUserModel
        {
            Email = registerUserModel.Email,
            Password = registerUserModel.Password,
            ConfirmPassword = registerUserModel.ConfirmPassword
        };

        var client …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core identityserver4 blazor

2
推荐指数
1
解决办法
7049
查看次数