客户端集成IdentityServer
学习分享 丨作者 / 郑 子 铭 丨公众号 / DotNet NB / CloudNative NB
任务9:客户端集成IdentityServer
dotnet new webapi --name ClientCredentialApiusing Microsoft.AspNetCore.Authorization;
namespace ClientCredentialApi.Controllers
{
[ApiController]
[Route("[controller]")]
[Authorize]
public class WeatherForecastController : ControllerBasedotnet restoreservices.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options => {
options.Authority = "http://localhost:5000";// 获取授权地址
options.RequireHttpsMetadata = false;
options.ApiName = "api";
});


Last updated