Windows Identity Foundation:如何在ASP.net中获取新的安全令牌 [英] Windows Identity Foundation: How to get new security token in ASP.net

查看:181
本文介绍了Windows Identity Foundation:如何在ASP.net中获取新的安全令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个使用Windows Identity Foundation的ASP.net应用程序。我的ASP.net应用程序使用基于声明的身份验证和被动重定向到安全令牌服务。这意味着当用户访问应用程序时,它们会自动重定向到安全令牌服务,在安全令牌服务中,他们会收到一个安全令牌,用于向应用程序标识它们。

I'm writing an ASP.net application that uses Windows Identity Foundation. My ASP.net application uses claims-based authentication with passive redirection to a security token service. This means that when a user accesses the application, they are automatically redirected to the Security Token Service where they receive a security token which identifies them to the application.

在ASP中。 net,安全令牌存储为cookie。

In ASP.net, security tokens are stored as cookies.

我想有一些用户可以在我的应用程序中点击,删除该cookie并将它们重定向到安全令牌服务获取新令牌。简而言之,让您轻松注销并以其他用户身份登录。我尝试删除代码中包含令牌的cookie,但它仍然以某种方式存在。

I want to have something the user can click on in my application that will delete the cookie and redirect them to the Security Token Service to get a new token. In short, make it easy to log out and log in as another user. I try to delete the token-containing cookie in code, but it persists somehow.

如何删除令牌,以便用户可以再次登录并获得新的token?

How do I remove the token so that the user can log in again and get a new token?

推荐答案

我找到了解决方案。简洁地说:

I found the solution. To put it succinctly:


   Dim smartWsFederationAuthenticationModule As  _
        Microsoft.IdentityModel.Web.WSFederationAuthenticationModule = _
        HttpContext.Current.ApplicationInstance.Modules("WSFederationAuthenticationModule")
    smartWsFederationAuthenticationModule.SignOut(True)


有关详情,请访问此处: http://garrettvlieger.com/blog/2010/03/refreshing-claims-in-a-wif-claims-aware-application/

See here for more information: http://garrettvlieger.com/blog/2010/03/refreshing-claims-in-a-wif-claims-aware-application/

我也看到,我可以得到WIF框架的一些其他部分的句柄,以及。这绝对值得读。

I also see that I can get handles to some other parts of the WIF framework this was, as well. It's definitely worth the read.

这篇关于Windows Identity Foundation:如何在ASP.net中获取新的安全令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆