在令牌中设置滑动到期 - 使用STS的MVC应用程序 [英] Setting sliding expiration in a token - MVC app using STS

查看:94
本文介绍了在令牌中设置滑动到期 - 使用STS的MVC应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部,


我们正在使用STS开发MVC应用程序。我们使用WIF工具创建了一个简单的STS应用程序进行开发。


我希望能够在我的令牌中设置一个滑动过期(在RP中)。


我看到代码
喜欢这里


不幸的是,这是事件处理程序和示例,虽然有帮助,没有说明如何实现处理程序!


在我的global.asax中,Application_Start()我有:

  sam = new SessionAuthenticationModule(); 
sam.SessionSecurityTokenReceived + =
new EventHandler< SessionSecurityTokenReceivedEventArgs>(sam_SessionSecurityTokenReceived);

(sam是用类范围定义的。)


我不是确定这是否正确。我不知道如何验证是否因为global.asax中的调试问题而调用了事件。


在某个地方如何捕获此事件是否有更完整的示例?我会以正确的方式去做吗?


TIA!我很感激帮助! Rich

解决方案

使用


FederatedAuthentication.SessionAuthenticationModule.SecurityTokenReceived。


另见:


http://blogs.msdn.com/b/vbertocci/archive/2010/06/16/warning-sliding-sessions-are-closer-than-they -appear.aspx


Hi, All,

We are developing an MVC app using STS. We used the WIF tools to create a simple STS app for development.

I would like to be able to set a sliding expiration in my token (in the RP).

I see code like here.

Unfortunately, this is the event handler and the example, while helpful, doesn't show how to implement the handler!

In my global.asax, Application_Start() I have:

sam = new SessionAuthenticationModule();
    sam.SessionSecurityTokenReceived += 
      new EventHandler<SessionSecurityTokenReceivedEventArgs>(sam_SessionSecurityTokenReceived);

(sam is defined with a class scope.)

I'm not sure if this is correct. I do not know how to verify if the event was ever called because of debugging issues in global.asax.

Is there a more complete example somewhere of how to trap this event? Am I going about it the right way?

TIA! I appreciate the help! Rich

解决方案

use

FederatedAuthentication.SessionAuthenticationModule.SecurityTokenReceived.

also see here:

http://blogs.msdn.com/b/vbertocci/archive/2010/06/16/warning-sliding-sessions-are-closer-than-they-appear.aspx


这篇关于在令牌中设置滑动到期 - 使用STS的MVC应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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