【问题标题】:Thinktecture Implicit Flow: Signout/Logout a userThinktecture 隐式流程:注销/注销用户
【发布时间】:2013-06-26 21:47:20
【问题描述】:

我按照这个例子来让隐式流程工作。

http://weblogs.thinktecture.com/cweyer/2012/11/oauth2-in-thinktecture-identityserver-v2-implicit-grant-flow-with-javascript.html

我的问题是,我将如何注销用户?我希望有人知道,因为我找不到任何例子。现在我可以触发授权窗口并正确处理它并为我的请求使用访问令牌,但我不知道如何制作它以便我可以切换用户。

【问题讨论】:

    标签: thinktecture-ident-server thinktecture-ident-model


    【解决方案1】:

    要注销,您必须使用注销方法创建自定义控制器。

    public void Logout()
    {
       // You should be able to revoke thinktecture token like this. (haven't tested this out)
       var sam = FederatedAuthentication.SessionAuthenticationModule;  
       sam.SignOut();
    
       // Or you should be able to logoff like this when using a membership provider. (this way works for me)
       //_yourMembership.Logout();
       Thread.CurrentPrincipal = null;
       HttpContext.Current.User = null;
    }
    

    以下是令牌撤销示例: https://github.com/brockallen/BrockAllen.MembershipReboot/blob/master/src/BrockAllen.MembershipReboot/Authentication/SamAuthenticationService.cs

    【讨论】:

      猜你喜欢
      • 2021-11-23
      • 1970-01-01
      • 1970-01-01
      • 2014-06-07
      • 1970-01-01
      • 2018-07-27
      • 2012-06-15
      • 2017-07-06
      • 1970-01-01
      相关资源
      最近更新 更多