Kết nối hệ thống API được tích hợp chứng thực qua IdentityServer - easywebhub/NetCoreIdentityServer GitHub Wiki
##Tham khảo
##Config server API
app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
{
Authority = "http://id.easyadmincp.com",
RequireHttpsMetadata = false,
ApiName = "apis_fullaccess", // token trả về phải có aud chứa Resource này ( ApiName) thì mới xác thực, Không qui định thì là ALL, ko ràng buộc
AllowedScopes = { "apis_fullaccess__read", "apis_fullaccess__write" } // client phải request token với 1 trong các scope này mới dc chứng thực, KHONG QUI DINH -> ALL, ko ràng buộc
});
##Config autho by scope to an API
services.AddAuthorization(options =>
{
options.AddPolicy("APIWRITE", policy => policy.RequireClaim("scope", "apis_fullaccess__write"));
});
##Thiết lập Client application
Sử dụng thư viện oidc để xác thực với identityserver.
link: https://github.com/IdentityModel/oidc-client-js
Tham khảo: https://identityserver4.readthedocs.io/en/release/quickstarts/7_javascript_client.html