Angular AddApiAuthorization的默认设置(脚手架角度和标识服务器4)
我正在使用Angular+IdentityServer4的脚手架示例Angular AddApiAuthorization的默认设置(脚手架角度和标识服务器4),angular,identityserver4,asp.net-core-3.1,Angular,Identityserver4,Asp.net Core 3.1,我正在使用Angular+IdentityServer4的脚手架示例 dotnet new angular -o <output_directory_name> -au Individual 微软的脚手架方式: public void配置服务(IServiceCollection服务) { services.AddDbContext 这是否意味着一切正常?脚手架应用程序的默认值为 授权码的类型 ClientId将与应用程序名称相对应。可以在appsettings.json(客户端)
dotnet new angular -o <output_directory_name> -au Individual
微软的脚手架方式:
public void配置服务(IServiceCollection服务)
{
services.AddDbContext
这是否意味着一切正常?脚手架应用程序的默认值为
授权码的类型
ClientId将与应用程序名称相对应。可以在appsettings.json
(客户端)和api authorization.constants.ts
(应用程序名称)中更改该名称
默认情况下,客户端机密不会应用于客户端
此外,还启用了pkce
没有默认凭据
将添加名为{ProjectName}API
的其他作用域
您可以拨打https://localhost:{port}/_configuration/{clientId}
以获取信息
services.AddIdentityServer()
.AddDeveloperSigningCredential()
.AddApiAuthorization((配置)=>
{
config.Clients[0]。AccessTokenLifetime=3600
});
如果要编辑默认客户端
更新
从appsetting.json
"IdentityServer": {
"Clients": {
"{ClientId}": { //To edit the clientId change here
"Profile": "IdentityServerSPA"
}
}
}
注意:如上所述,如果您更改ClientId
请确保在api authorization.constants.ts
中更改ApplicationName
,谢谢!我编辑了我的问题,因为我不确定我得到的是预期的。还有一件事:设置ClientId:“受信任”
在appsettings.json中,由于某种原因,似乎没有更改客户端id,有什么想法吗?可能无法通过appsettings.json编辑默认客户端,或者至少必须在addapiaauthorization中进行设置,因为scaffold项目使用的是addapiaauthorization
扩展而不是AddInMemoryClients
ad从appsettings.json
编辑客户端属性不会更改您的客户端。因为客户端是通过配置文件解析的。我将更新答案,以显示如何从appsettings.json
编辑clientId
。您可以看一看。@不,对不起,我遗漏了一点。将其添加为回答中的第6点谢谢!接受答案
"IdentityServer": {
"Clients": {
"{ClientId}": { //To edit the clientId change here
"Profile": "IdentityServerSPA"
}
}
}