- // final ILoginContext loginContext = SecureRapActivator
- // .createLoginContext(SecureRapActivator.CONTEXT_SPRING);
- // tryLogin: while (subject == null && !display.isDisposed()) {
- // try {
- // loginContext.login();
- // subject = loginContext.getSubject();
- //
- // // add security context to session
- // if (httpSession.getAttribute(SPRING_SECURITY_CONTEXT_KEY) == null)
- // httpSession.setAttribute(SPRING_SECURITY_CONTEXT_KEY,
- // SecurityContextHolder.getContext());
- // // add thread locale to RWT session
- // log.info("Locale " + LocaleUtils.threadLocale.get());
- // RWT.setLocale(LocaleUtils.threadLocale.get());
- //
- // // Once the user is logged in, she can have a longer session
- // // timeout
- // RWT.getRequest().getSession()
- // .setMaxInactiveInterval(sessionTimeout);
- // if (log.isDebugEnabled())
- // log.debug("Authenticated " + subject);
- // } catch (LoginException e) {
- // BadCredentialsException bce = wasCausedByBadCredentials(e);
- // if (bce != null) {
- // MessageDialog.openInformation(display.getActiveShell(),
- // "Bad Credentials", bce.getMessage());
- // // retry login
- // continue tryLogin;
- // }
- // return processLoginDeath(display, e);
- // }
- // }
-
- final String username = subject.getPrincipals().iterator().next()
- .getName();