Windows标识基础 - 登出或更新索赔 [英] Windows identity foundation - sign out or update claims

查看:219
本文介绍了Windows标识基础 - 登出或更新索赔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Windows身份验证基础管理登录我们的网站。

I am using Windows Identity foundation to manage login to our site.

当我一个用户登录正在使用他的要求投入索赔的一些信息。
这是所有工作正常,但现在我需要管理这样的情景:

When a user logs in i am using some information in his request to put into the claims. It is all working fine, but now I need to manage this scenario:


  1. 用户已经登录,athenticated并具有一个有效的令牌。

  2. 但是用户决定再次浏览中(通过从其他网站重定向)

  3. 因此,他在他的请求信息是不同的。

  4. 我想要么

    • 登入他出来 - 所以,他自然会创建一个新的令牌他新的信息

    • 或更新其现有的令牌。

  1. user is already logged in, athenticated and has a valid token.
  2. But user decides to browses in again (via a redirect from another site)
  3. So his information in his request is different.
  4. I want to either
    • Sign him out - so that he naturally creates a new token with his new information
    • OR update his existing token.

所以我的问题是:


  1. 我如何注销Windows标识基础

  2. 的<李>或者我如何更新现有索赔

我已经试过这段代码:

  public void ExpireClaims(HttpContextBase httpContextBase)
    {
        var module =
            httpContextBase.ApplicationInstance.Modules["WSFederationAuthenticationModule"] as
            WSFederationAuthenticationModule;
        if (module == null)
        {
            return;
        }
        module.SignOut(true);
    }



但模块常是空。

But module is alway null.

和我想这样的:

  public void FederatedSignOut(string replyUrl)
    {
        WSFederationAuthenticationModule.FederatedSignOut(null, new Uri(replyUrl));
    }



但我得到一个空引用execption当我做到这一点。

But i get a null reference execption when i do this.

非常感谢。

推荐答案

从本质上登出只是删除的cookie如此

Essentially sign-out is just deleting the cookie so:

FormsAuthentication.SignOut

FederatedAuthentication.SessionAuthenticationModule.SignOut

FederatedAuthentication.SessionAuthenticationModule.DeleteSessionTokenCookie

将工作。

FederatedPassiveSignInStatus (应该在你的工具箱)。属性 SignOutAction 设置为 FederatedSignOut 和控制将清除出你的STS会话也是如此。

Or use the FederatedPassiveSignInStatus (should be in your Toolbox). Set the property SignOutAction to FederatedSignOut and the control will clear out your STS session as well.

这篇关于Windows标识基础 - 登出或更新索赔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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