ColdFusion SessionTracker 并强制会话结束 [英] ColdFusion SessionTracker and forcing the session to end
问题描述
我正在使用 ColdFusion 9 coldfusion.runtime.SessionTracker
使用以下代码监控当前登录的用户.
I'm using the ColdFusion 9 coldfusion.runtime.SessionTracker
to monitor currently logged in users using the following code.
app = application.getApplicationSettings().name;
sessiontracker = createObject("java","coldfusion.runtime.SessionTracker");
sessionCollection = sessionTracker.getSessionCollection(app);
它返回 jsessionid
的 struct
和所有当前活动会话的会话变量.
Which returns a struct
of jsessionid
's and the session's variables for all the currently active sessions.
如果我有 jsessionid
有效地强制用户退出,是否可以强制结束会话?
Is it possible to force a session to end given I have the jsessionid
effectively forcing the user to be logged out?
谢谢,
理查德
推荐答案
所以当用户登录时,我会在他们的会话中设置一个 user
结构,以便删除他们的登录状态.使用 sessionTracker
我可以获取特定用户的会话,然后删除当前会话中的 user
结构.
So when a user logs in I'm setting a user
structure in their session, so to remove their logged in state. Using sessionTracker
I can get a specific user's session and just delete the user
structure in their current session.
app = application.getApplicationSettings().name;
sessiontracker = createObject("java","coldfusion.runtime.SessionTracker");
sessionCollection = sessionTracker.getSessionCollection(app);
userSession = sessiontracker.getSession(app, sessionID));
structDelete(userSession, "user");
不确定这是否是最好的方法,但它似乎对我有用.希望对大家有所帮助.
Not sure if this is the best way of doing it but it seems to work for me. Hope it helps people.
这篇关于ColdFusion SessionTracker 并强制会话结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!