[英]Combine IdentityServer4 and MVC client
I downloaded the sample IdentityServer and MVC client project from Github. 我从Github下载了示例IdentityServer和MVC客户端项目。 My goal is to create a portal environment, in which a user can authenticate and than proceed to request protected resources.
我的目标是创建一个门户环境,用户可以在其中进行身份验证,然后继续请求受保护的资源。
So what I did is move the Views from the MVC client to the IdentityServer project, changed the Client.cs to support a client on the same port and added the following in the startup from the IdentityServer: 所以我做的是将视图从MVC客户端移动到IdentityServer项目,更改Client.cs以支持同一端口上的客户端,并在IdentityServer的启动中添加以下内容:
var oidcOptions = new OpenIdConnectOptions
{
AuthenticationScheme = "oidc",
SignInScheme = "Cookies",
Authority = "http://localhost:5000",
RequireHttpsMetadata = false,
PostLogoutRedirectUri = "http://localhost:5000/",
ClientId = "mvc",
ClientSecret = "secret",
ResponseType = "code id_token",
GetClaimsFromUserInfoEndpoint = true,
SaveTokens = true
};
My question is are there any reasons, concerning security, I should not implement this and keep it seperated? 我的问题是有任何理由,关于安全问题,我不应该实施这个并保持分离?
There is nothing wrong with this at all from a security perspective. 从安全角度来看,这根本没有任何问题。
However I must warn you that you may run into a problem when dealing with cookies and tokens. 但是,我必须警告您,在处理cookie和令牌时可能会遇到问题。 Running them in separate projects implicitly separates the concerns of the MVC and IDS projects.
在单独的项目中运行它们隐含地分离了MVC和IDS项目的关注点。
something that you might want to do is to fork your request pipeline by using app.Map()
. 您可能想要做的事情是使用
app.Map()
来分叉您的请求管道。 (eg map IDS to "/identity" and the MVC project to "/ui") (例如,将IDS映射到“/ identity”,将MVC项目映射到“/ ui”)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.