- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 MVC 应用程序,其授权由身份服务器管理。当我第一次访问我的网站时,它被重定向到身份服务器登录页面,然后我再次被重定向到我的网站。
我的问题是,如果我注销身份服务器,当我再次访问我的网站(使用身份服务器授权)时,我被重定向到身份服务器,但登录是自动完成的,允许我访问我的网站而无需将用户/密码放入身份服务器。
我想这是因为 cookie 在客户端中仍然存在(如果我在浏览器中手动删除所有 cookie,则需要用户/密码)。
如何禁用自动登录(强制始终需要用户名/密码)?
我的启动客户端配置是这样的:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
LoginPath = new PathString("/Home/Logged/"),
AuthenticationType = "Cookies",
ExpireTimeSpan = TimeSpan.FromDays(2),
SlidingExpiration = true,
CookieName = ".AspNet.MyApp"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
ClientId = "MyApp",
Authority = IS_URL,
RedirectUri = localHostURL + "/Home/Logged/",
PostLogoutRedirectUri = localHostURL + "/Account/Login/",
ResponseType = "code id_token token",
Scope = "openid profile read write sampleApi",
SignInAsAuthenticationType = "Cookies",
UseTokenLifetime = true,
Notifications = new OpenIdConnectAuthenticationNotifications
{
SecurityTokenValidated = async n =>
{
var nid = new ClaimsIdentity(
n.AuthenticationTicket.Identity.AuthenticationType,
"given_name",
"role");
// get userinfo data
var userInfoClient = new UserInfoClient(
new System.Uri(n.Options.Authority + "/connect/userinfo"),
n.ProtocolMessage.AccessToken);
var userInfo = await userInfoClient.GetAsync();
userInfo.Claims.ToList().ForEach(ui => nid.AddClaim(new Claim(ui.Item1, ui.Item2)));
//keep the id_token for logout
nid.AddClaim(new Claim("id_token", n.ProtocolMessage.IdToken));
// add access token for sample API
nid.AddClaim(new Claim("access_token", n.ProtocolMessage.AccessToken));
// keep track of access token expiration
nid.AddClaim(new Claim("expires_at", TimeSpan.FromDays(2).ToString()));
// add some other app specific claim
nid.AddClaim(new Claim("app_specific", "some data"));
n.AuthenticationTicket = new AuthenticationTicket(
nid,
n.AuthenticationTicket.Properties);
},
RedirectToIdentityProvider = n =>
{
if (n.ProtocolMessage.RequestType == OpenIdConnectRequestType.LogoutRequest)
{
var idTokenHint = n.OwinContext.Authentication.User.FindFirst("id_token");
if (idTokenHint != null)
{
n.ProtocolMessage.IdTokenHint = idTokenHint.Value;
}
}
return Task.FromResult(0);
}
}
});
提前致谢!
最佳答案
要从身份服务器注销,您需要重定向到结束 session 端点。
通常是 /connect/endsession
。只有这样才能清除身份验证 session cookie。
查看规范: https://openid.net/specs/openid-connect-session-1_0.html#RPLogout
关于c# - 如何在thinktecture IdentityServer中禁用自动登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40490992/
我上周正在研究这个主题,不幸的是我无法弄清楚。我了解身份验证和授权之间的区别。 我将感谢有关该主题的任何指导。 我一般需要的是为几个由 apis 驱动的网站实现单点登录,这些网站也应该处理身份验证。用
集成外部提供商(即Google与Thinktecture Identity Server v3)时出现问题。出现以下错误:“客户端应用程序未知或未获得授权。” 是否有人对此错误有任何想法。 最佳答案
我开始在我的项目中使用 ThinkTecture.IdentityModel,但我遇到了一个严重的问题。请帮助我。 错误 1“类型‘System.IdentityModel.Tokens.Securi
我在 IdentityServer 中设置了以下客户端: new Client { ClientName = "My web application", Enabled = true,
在我的依赖方应用程序 (ASP.NET MVC4) 中,我有一个注销链接,可以让我退出 IdentityServer。我正在登陆它的“成功注销”页面,其中包含返回我的应用程序的链接。我想要做的是单击
我无法从 Thinktecture 授权服务器获取访问 token 。成功获得授权代码后,我尝试向 token 端点发出 POST 请求,但总是收到 400 Bad Request 和此响应:消息:“
我确信答案是显而易见的,但目前我还不知道。 当我的代码尝试调用/connect/userinfo 并且消息是“insufficient_scope”时,我得到了 403。 https://github
我正在尝试使用 Thinktecture 示例构建示例 Web 应用程序 ResourceAuthorization来自 github。 现在我在用授权属性装饰的 Controller 中有一个 Ac
我正在使用 thinktecture identityserver安全 token 服务我正在尝试设置一个场景,其中我有一个使用 WCF 服务的客户端。我被困在遇到下一个错误的地方: MessageS
如 leastprivilege 中所述,有两种方法可以使用 Thinktecture.IdentityModel 设置声明授权检查。一种是设置过滤器。另一种是为要检查的 Action 添加属性。 我
如何在Thinktecture IdentityServer v3中启用日志记录? 我目前正在得到一个通用错误页面,说“有一个意外错误”。 我能够弄清楚,ErrorPageFilterAttribut
Thinktecture IdentityServer V3 是否支持 SAML 还是仅支持 OAuth? 最佳答案 IdentityServer v3 支持任何与 Katana 兼容的 Owin 中
我有一个现有的数据库,其中包含用户凭据以及这些用户凭据可以访问的应用程序的 map 。在身份服务器中,我将每个应用程序设置为客户端,并且用户可以成功进行身份验证。但是,任何用户都会获得任何应用程序的授
我正在制作 Thinktecture IdentityServer v3 的演示。目的是让身份服务器作为它自己的网站在 Azure 网站下运行。 将会有其他(多个)Azure 网站使用身份服务器对用户
我想使用 ASP.NET SimpleMembership 对使用我的 WebAPI 的用户进行身份验证。 Thinktecture 有一个很棒的身份验证库,名为 Thinktecture.Ident
我正在使用 Thinktecture.IdentityServer.v2 应用程序为几个内部应用程序执行 SSO,但我想为每个应用程序自定义登录页面以获得更流畅的用户体验。我似乎找不到办法做到这一点。
我正在尝试遵循简单指南 mvcGettingStarted .现在,我已经实现了 GoogleAuthentication 和 FacebookAuthentication 提供程序,一切都按预期工作
你好,我一直在努力弄清楚如何将 IdentityServer3 配置为一个 Multi-Tenancy 联合提供程序,它可以转换和丰富从 ADSF、Google+、Microsoft 帐户返回的声明。
我有几个仍在开发中的 mvc 应用程序,它们使用带有 SimpleMembership 的表单来注册和验证用户,这些应用程序使用相同的数据库,并且我从简单的成员资格到 UserProfile 表周围都
我正在 Windows Server 2008 R2 Standard 上的 qa 环境中运行 thinktecture IdentityServer v2 以及两个依赖方。 IdentityServ
我是一名优秀的程序员,十分优秀!