简体   繁体   English

Wso2 saml 授予 session 超时将如何工作

[英]Wso2 saml grant how session timeout will work

I am integrating java app with SAML and on successfull login and I am generating oauth2 token by saml grant type and storing it in client side and also in redis. For further requests I am referring redis and if the token gets expired, I'm generating new token and again storing in both client and redis.我正在将 java 应用程序与 SAML 集成并成功登录,我正在通过 saml 授权类型生成 oauth2 令牌并将其存储在客户端以及 redis 中。对于进一步的请求,我指的是 redis,如果令牌过期,我正在生成新令牌并再次存储在客户端和 redis 中。

But how to implement session timeout incase of this use-case.但是如何在这个用例中实现 session 超时。 I need to implement two timeouts: 1)idle timeout 2)session expiry(irrespective of idle session timeout).我需要实现两个超时:1)空闲超时 2)会话到期(不考虑空闲 session 超时)。

Suppose if the session is configured with idle timeout of 12 hours and session expiry of 72 hours.假设如果 session 配置了 12 小时的空闲超时和 72 小时的 session 到期。 So, how the above scenario should be implemented as in wso2 IS configuration I can able to see only idle timeout in session configuration, there is no session expiry in total irrespective of idle timeout.那么,在 wso2 IS 配置中应该如何实现上述场景我只能在 session 配置中看到空闲超时,无论空闲超时如何,总共没有 session 到期。 So, how can I sync both redis and wso2 session considering above requirement.那么,考虑到上述要求,我如何同步 redis 和 wso2 session。

Ans also does the idle timeout expiry will get extend by generating token for the second time in WSO2 IS? Ans 还会通过在 WSO2 IS 中第二次生成令牌来延长空闲超时到期时间吗?

The (idle) session timeout is applicable when you create an SSO session on the browser.当您在浏览器上创建 SSO session 时,(空闲)session 超时适用。 But the SAML2 Bearer Grant does not create an SSO session, therefore it is not possible to have any session timeouts.但是 SAML2 Bearer Grant 不会创建 SSO session,因此不可能有任何 session 超时。

For this requirement, I would suggest below.对于这个要求,我建议如下。

  • Use the SAML assertion to generate an access token and refresh token pair使用 SAML 断言生成访问令牌和刷新令牌对
  • Set access token expiry with the expected idle session timeout value使用预期的空闲 session 超时值设置访问令牌到期
  • Set refresh token expiry with the expected session timeout value使用预期的 session 超时值设置刷新令牌到期
  • If the user is active on the application and access token is going to expire, use the refresh grant and obtain a new access token如果用户在应用程序上处于活动状态并且访问令牌即将过期,请使用刷新授权并获取新的访问令牌
  • Now, you will not be able to extend this beyond the refresh token validity which you call as session timeout现在,您将无法将其扩展到您称为 session 超时的刷新令牌有效性之外

PS: Following config is required in order to avoid refresh token's validity getting extended upon refresh grant requests. PS:需要以下配置以避免刷新令牌的有效性在刷新授权请求时得到延长。 Ref参考

[oauth.token_renewal]
extend_refresh_token_expiry_time_on_renewal = false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM