| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| SpringSecurityLoginRedirectHandler |
|
| 1.0;1 |
| 1 | package org.kuali.student.common.ui.client.security; | |
| 2 | ||
| 3 | import org.kuali.student.common.ui.client.util.BrowserUtils; | |
| 4 | ||
| 5 | import com.google.gwt.user.client.Window; | |
| 6 | ||
| 7 | /** | |
| 8 | * This implements the SessionTimeoutHandler. The timeout is handled by redirecting the | |
| 9 | * user to the application root, so the spring login form will be displayed. | |
| 10 | * | |
| 11 | * @author Kuali Student Team | |
| 12 | * | |
| 13 | */ | |
| 14 | 0 | public class SpringSecurityLoginRedirectHandler implements SessionTimeoutHandler { |
| 15 | ||
| 16 | /** | |
| 17 | * This assumes the login mechanism is the standard spring security. | |
| 18 | * | |
| 19 | */ | |
| 20 | @Override | |
| 21 | public boolean isSessionTimeout(Throwable error) { | |
| 22 | 0 | return error.toString().contains("Login"); |
| 23 | } | |
| 24 | ||
| 25 | @Override | |
| 26 | public void handleSessionTimeout() { | |
| 27 | //FIXME: Need a way to get the proper redirect url, for now just reloading the page | |
| 28 | //BrowserUtils.redirect(GWT.getHostPageBaseURL()); | |
| 29 | ||
| 30 | 0 | Window.alert("Your session has timed out and are being redirected to the login page."); |
| 31 | 0 | BrowserUtils.reload(); |
| 32 | 0 | } |
| 33 | ||
| 34 | } |