*/
package org.argeo.security.ui.rap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.eclipse.rap.rwt.RWT;
-import org.eclipse.rap.rwt.application.IEntryPoint;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.rap.rwt.application.EntryPoint;
/**
* RAP entry point which authenticates the subject as anonymous, for public
* unauthenticated access.
*/
-public class AnonymousEntryPoint implements IEntryPoint {
- private final static Log log = LogFactory.getLog(AnonymousEntryPoint.class);
+public class AnonymousEntryPoint implements EntryPoint {
+ // private final static Log log =
+ // LogFactory.getLog(AnonymousEntryPoint.class);
/**
* How many seconds to wait before invalidating the session if the user has
* not yet logged in.
*/
private Integer loginTimeout = 1 * 60;
- private Integer sessionTimeout = 15 * 60;
@Override
public int createUI() {
// around too long
RWT.getRequest().getSession().setMaxInactiveInterval(loginTimeout);
- if (log.isDebugEnabled())
- log.debug("Anonymous THREAD=" + Thread.currentThread().getId()
- + ", sessionStore=" + RWT.getSessionStore().getId());
+ // if (log.isDebugEnabled())
+ // log.debug("Anonymous THREAD=" + Thread.currentThread().getId()
+ // + ", sessionStore=" + RWT.getSessionStore().getId());
// create display
- final Display display = PlatformUI.createDisplay();
+ // final Display display = PlatformUI.createDisplay();
// log in
-// final ILoginContext loginContext = SecureRapActivator
-// .createLoginContext(SecureRapActivator.CONTEXT_SPRING_ANONYMOUS);
-// Subject subject = null;
-// try {
-// loginContext.login();
-// subject = loginContext.getSubject();
-// } catch (LoginException e) {
-// throw new ArgeoException(
-// "Unexpected exception during authentication", e);
-// }
-//
-// // identify after successful login
-// if (log.isDebugEnabled())
-// log.debug("Authenticated " + subject);
-// final String username = subject.getPrincipals().iterator().next()
-// .getName();
-//
-// // Once the user is logged in, she can have a longer session timeout
-// RWT.getRequest().getSession().setMaxInactiveInterval(sessionTimeout);
-//
-// // Logout callback when the display is disposed
-// display.disposeExec(new Runnable() {
-// public void run() {
-// log.debug("Display disposed");
-// logout(loginContext, username);
-// }
-// });
-//
-// //
-// // RUN THE WORKBENCH
-// //
-// Integer returnCode = null;
-// try {
-// returnCode = Subject.doAs(subject, new PrivilegedAction<Integer>() {
-// public Integer run() {
-// RapWorkbenchAdvisor workbenchAdvisor = new RapWorkbenchAdvisor(
-// null);
-// int result = PlatformUI.createAndRunWorkbench(display,
-// workbenchAdvisor);
-// return new Integer(result);
-// }
-// });
-// logout(loginContext, username);
-// } finally {
-// display.dispose();
-// }
+ // final ILoginContext loginContext = SecureRapActivator
+ // .createLoginContext(SecureRapActivator.CONTEXT_SPRING_ANONYMOUS);
+ // Subject subject = null;
+ // try {
+ // loginContext.login();
+ // subject = loginContext.getSubject();
+ // } catch (LoginException e) {
+ // throw new ArgeoException(
+ // "Unexpected exception during authentication", e);
+ // }
+ //
+ // // identify after successful login
+ // if (log.isDebugEnabled())
+ // log.debug("Authenticated " + subject);
+ // final String username = subject.getPrincipals().iterator().next()
+ // .getName();
+ //
+ // // Once the user is logged in, she can have a longer session timeout
+ // RWT.getRequest().getSession().setMaxInactiveInterval(sessionTimeout);
+ //
+ // // Logout callback when the display is disposed
+ // display.disposeExec(new Runnable() {
+ // public void run() {
+ // log.debug("Display disposed");
+ // logout(loginContext, username);
+ // }
+ // });
+ //
+ // //
+ // // RUN THE WORKBENCH
+ // //
+ // Integer returnCode = null;
+ // try {
+ // returnCode = Subject.doAs(subject, new PrivilegedAction<Integer>() {
+ // public Integer run() {
+ // RapWorkbenchAdvisor workbenchAdvisor = new RapWorkbenchAdvisor(
+ // null);
+ // int result = PlatformUI.createAndRunWorkbench(display,
+ // workbenchAdvisor);
+ // return new Integer(result);
+ // }
+ // });
+ // logout(loginContext, username);
+ // } finally {
+ // display.dispose();
+ // }
return 1;
}
-// private void logout(ILoginContext secureContext, String username) {
-// try {
-// secureContext.logout();
-// log.info("Logged out " + (username != null ? username : "")
-// + " (THREAD=" + Thread.currentThread().getId() + ")");
-// } catch (LoginException e) {
-// log.error("Erorr when logging out", e);
-// }
-// }
+ // private void logout(ILoginContext secureContext, String username) {
+ // try {
+ // secureContext.logout();
+ // log.info("Logged out " + (username != null ? username : "")
+ // + " (THREAD=" + Thread.currentThread().getId() + ")");
+ // } catch (LoginException e) {
+ // log.error("Erorr when logging out", e);
+ // }
+ // }
}