Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am using Opengeo Suite and through client SDK I created an application.

When I run the application, browser automatically shows the login panel. After entering the username and password, it takes me to my application. But there is no way to logout and it don't even get a cookie called JSESSIONID. So I didn't get how to make a logout function for this. It logout or what I don't know, but when I close the broswer and enter the url again in new browser, it ask the password again. If I don't close the browser and just close the tab and try to open the application again, it didn't ask the password.

So should I have to ask to close the browser again again to login the application with another user.

Your help will be appreciable.

Thanks

Akhil

share|improve this question
    
What Server version are you using? [Tomcat 6, JBoss 5.1 on: Server 2003, Server 2008, CentOS 5, Ubuntu Server 9] –  Mapperz May 21 '13 at 13:21
    
opengeo suite 3.0.2 geoserver 2.2-SNAPSHOT –  user2273001 May 21 '13 at 13:21
    
that is the software version but what operating system are you running it on? –  Mapperz May 21 '13 at 13:23
    
I am using tomcat 6 –  user2273001 May 22 '13 at 11:33

2 Answers 2

If your application is based of the included demo application in the OpenGeo suite it uses Basic Authetication. What this means is that when you first go to the website the server tells your browser that you need to login. Your browser then asks the user for a username and password. If the server accepts that username and password then the browser remembers that password every time you access the site after that. In order to "log out" you need to get the browser to forget the username and password. The only way to do that is close the browser.

You can get around this by modifying your app to use form based authentication instead of just basic authentication. If your using the OpenGeo Suite I assume you are using Jetty. Please check here for the relevant documentation and examples http://www.eclipse.org/jetty/documentation/current/configuring-security.html#configuring-security-authentication

To start and help find the relevent parts of the documentation you need to set the web.xml file of your web application to look something like this

<login-config>
  <auth-method>FORM</auth-method>
  <realm-name>Test Realm</realm-name>
  <form-login-config>
     <form-login-page>/logon.html?param=test</form-login-page>
     <form-error-page>/logonError.html?param=test</form-error-page>
  </form-login-config>
</login-config>

The web.xml file can normally be found in the WEB-INF directory in the root of your web application.

You will then need to create the login and logon error pages. When you have done that you will be able to create a logout page by including something like the following. (Example is for a JSP page. i.e. logout.jsp)

    <!DOCTYPE html>
<HTML>
<BODY>
<%
    HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
    try {
        request.logout();
    } catch (ServletException ex) {
        throw new IOException(ex);
    }
%>
</BODY>
</HTML>

Please note that this code won't display anything to the user to tell them they have logged out ect. You will need to add this yourself.

share|improve this answer

From what you describe it sounds like the login dialog you get is the browser's HTTP Basic Auth dialog. There is no logout for this, but there are workarounds. See http://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.