aspose file tools*
The moose likes JForum and the fly likes Logout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JForum
Bookmark "Logout" Watch "Logout" New topic
Author

Logout

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi,

I have implemented the SSO and it is working well. The problem i have is. If i logout out of my web application i want the user to also be logged out from the jforum.

How can this be performed?

I did try

SessionContext session2 = JForumExecutionContext.getRequest().getSessionContext();
session2.invalidate();

but this didn't work and just threw a nullpointer exception.

Thanks

Paul
[originally posted on jforum.net by jonesp123]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
I have tried this

JForumExecutionContext executionContext = JForumExecutionContext.get();

// Create a ForumContext
ForumContext forumContext = new JForumContext(request.getContextPath(),
".page",
new WebRequestContext(request),
new WebResponseContext(response));

executionContext.setForumContext(forumContext);

// If you have a valid JDBC connection at this point, you can
// set it as well
executionContext.setConnection(null);

// Set back the new execution context, so we can use it
JForumExecutionContext.set(executionContext);

UserAction us = new UserAction();
us.logout();


but get this exception

java.lang.NullPointerException: charsetName

java.lang.NullPointerException: charsetName

at java.lang.String.<init>(String.java:403)

at java.lang.String.<init>(String.java:433)

at org.apache.coyote.tomcat5.CoyoteRequest.setCharacterEncoding(CoyoteRequest.java:1523)

at org.apache.coyote.tomcat5.CoyoteRequestFacade.setCharacterEncoding(CoyoteRequestFacade.java:240)

at net.jforum.context.web.WebRequestContext.<init>(WebRequestContext.java:123)

[originally posted on jforum.net by jonesp123]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
what I did is, embedding the user/logout page in an iframe of the surrounding logout page. This way - when the user pressed "logout" on the surrounding page, it would also logout the user internally, using its own logout mechanism
[originally posted on jforum.net by Sid]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
sorry for being stupid, could you elaborate on this. I am quite new to jforum.

Thanks for your help.
[originally posted on jforum.net by jonesp123]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
You do know the mechanism for module and action?

The module is "user", the action is "logout". Simply login and then move the mouse over the logout button to get the clue:
http://www.jforum.net/user/logout.page

For logging out a user of the surounding website we have a "confirmation" page. There we ask if the user REALLY wants to log out.

On this page we have an <iframe src="http://yourforumurl/user/logout.page"></iframe> tag in it. This is how the user is being logged out.

I hope I was being more clear on it now
[originally posted on jforum.net by Sid]
vinayak yedage
Greenhorn

Joined: Jun 19, 2013
Posts: 3
hi,

i am facing same issue

I have implemented the SSO and it is working well. but i am facing one problem that when i click on logout it still show showing user is logged in

How can this be performed?

i did many try outs but still problem is not solved

JForumExecutionContext.getRequest().getSessionContext().invalidate(); //in UserAction.java -logout method

auto.login.enabled = false // in SystemGlobals.properties

i change redirect link in logout method but when user click on back it shows same page with user logged in

but this didnt work

SystemGlobals.properties file contains : -

authentication.type = sso
login.authenticator = net.jforum.sso.LDAPAuthenticator
auto.login.enabled = false
sso.implementation = net.jforum.sso.RemoteUserSSO
sso.password.attribute = password
sso.email.attribute = email
sso.default.email = sso@user
sso.default.password = sso
sso.redirect =
ldap.security.protocol =
ldap.authentication = EXTERNAL
ldap.factory = com.sun.jndi.ldap.LdapCtxFactory
ldap.login.prefix = sAMAccountName=
ldap.login.suffix = OU=PLM,OU=TGSPUNE,DC=tgspune,DC=local
ldap.server.url = ldap://intgs-dc-02
ldap.field.email = mail
ldap.lookup.prefix = sAMAccountName=
ldap.lookup.suffix = OU=PLM,OU=TGSPUNE,DC=tgspune,DC=local

header.htm contains follwing htm code
<#if sso && logged>
<a id="logout" style="color:#ffffff;" class="mainmenu" href="${JForumContext.encodeURL("/user/logout")}"> ${I18n.getMessage("ForumBase.logout")} [${session.username}] </a>
</#if>

UserAction.java contains follwing logout code
public void logout()
{
System.out.println("--------------------------------");
UserSession userSession = SessionFacade.getUserSession();
SessionFacade.storeSessionData(userSession.getSessionId(), JForumExecutionContext.getConnection());
SessionFacade.makeUnlogged();
SessionFacade.remove(userSession.getSessionId());
userSession.setAutoLogin(false);
// JForumExecutionContext.getRequest().getSessionContext().invalidate();
// Disable auto login
//System.out.println("SessionFacade length : - "+SessionFacade.getAllSessions().size());
userSession.makeAnonymous();
SessionFacade.add(userSession);
JForumExecutionContext.setRedirect(this.request.getContextPath()
+ "/forums/list"
+ SystemGlobals.getValue(ConfigKeys.SERVLET_EXTENSION));
}


if anybody faces this problem then please reply

Thanks and regards
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Logout
 
Similar Threads
Browser Closing without signout from site
sso(my app) 1stuser login and logout and 2nduser login it show Connected users:1st userinfo,2nduser
logout problem
sso(my app) 1stuser login and logout 2nd user login it show Connected users:1st login userinfo
Cascade-save HELP !!!!