Authentication 自己的身份验证和自动化服务器asp net内核
我想创建我自己的本地身份验证服务器,但我不知道该怎么做 大多数文章都是关于OAuth、Identity4Server、google、facebook等身份验证的,但我找不到任何关于定制解决方案的文章。 Msdn在这方面也很差 此时此刻,我有这样的想法:Authentication 自己的身份验证和自动化服务器asp net内核,authentication,asp.net-core,Authentication,Asp.net Core,我想创建我自己的本地身份验证服务器,但我不知道该怎么做 大多数文章都是关于OAuth、Identity4Server、google、facebook等身份验证的,但我找不到任何关于定制解决方案的文章。 Msdn在这方面也很差 此时此刻,我有这样的想法: public void ConfigureServices(IServiceCollection services) { services.AddMvc().SetCompatibilityVersion(Comp
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(o =>
{
o.MetadataAddress = "http://localhost:5000";
o.Authority = "http://localhost:5000";
o.Audience = "http://localhost:5001";
o.RequireHttpsMetadata = false;
o.TokenValidationParameters = new TokenValidationParameters
{
ValidIssuer = "http://localhost:5000",
ValidAudience = "http://loclhost:5001",
};
})
;
}
我是否正确地认为授权是我的IdentityServer的地址?
那么为什么我在使用:
[HttpGet, Authorize, Route("/")]
public async Task<IActionResult> Get()
{
return Content("You are autorized.");
}
[HttpGet,Authorize,Route(“/”)]
公共异步任务Get()
{
返回内容(“您已自动调整大小”);
}
有任何请求到达我的授权服务器吗
我是否需要创建自己的身份验证方案,将请求发布到authoirty服务器,或者JwtBearer authenticationscheme中有内置机制?IdentityServer只是自定义解决方案的构建块。它有助于将所有中间件连接在一起,因此您不必从头开始
如果您想编写自定义身份验证解决方案,我的建议是从IdentityServer开始,然后从那里对其进行自定义。看看这个。我对这个解决方案不满意。我想要类似的东西,但如果我的配置与Artie所说的相同,我的服务将不会调用auth服务