Remove unused redirectIfNotLoggedIn() method

It's superseded by RequestHandler's processing of @Action(requireLogin = true), and is no longer used anywhere:
[]

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130788873
This commit is contained in:
nickfelt 2016-08-19 14:01:35 -07:00 committed by Ben McIlwain
parent 61bd6159c9
commit 6915e35800
3 changed files with 3 additions and 41 deletions

View file

@ -101,7 +101,6 @@ public class RegistrarServletTestCase {
when(req.getHeader(eq("X-CSRF-Token"))).thenReturn(generateToken("console"));
when(req.getReader()).thenReturn(createJsonPayload(ImmutableMap.of("op", "read")));
when(sessionUtils.isLoggedIn()).thenReturn(true);
when(sessionUtils.redirectIfNotLoggedIn(req, rsp)).thenReturn(true);
when(sessionUtils.checkRegistrarConsoleLogin(req)).thenReturn(true);
when(sessionUtils.getRegistrarClientId(req)).thenReturn(CLIENT_ID);
when(modulesService.getVersionHostname("backend", null)).thenReturn("backend.hostname");

View file

@ -19,7 +19,6 @@ import static google.registry.testing.AppEngineRule.THE_REGISTRAR_GAE_USER_ID;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import com.google.appengine.api.users.User;
@ -77,24 +76,6 @@ public class SessionUtilsTest {
when(req.getSession()).thenReturn(session);
}
@Test
public void testRedirectIfNotLoggedIn_loggedIn_doesNothing() throws Exception {
when(userService.isUserLoggedIn()).thenReturn(true);
assertThat(sessionUtils.redirectIfNotLoggedIn(req, rsp)).isTrue();
verifyZeroInteractions(req, rsp);
}
@Test
public void testRedirectIfNotLoggedIn_notLoggedIn_sendsTemporaryRedirect() throws Exception {
when(userService.isUserLoggedIn()).thenReturn(false);
when(req.getRequestURI()).thenReturn("foo");
when(userService.createLoginURL(eq("foo"))).thenReturn("bar");
assertThat(sessionUtils.redirectIfNotLoggedIn(req, rsp)).isFalse();
verify(rsp).setStatus(eq(302));
verify(rsp).setHeader(eq("Location"), eq("bar"));
verifyNoMoreInteractions(rsp);
}
@Test
public void testCheckRegistrarConsoleLogin_authedButNoSession_createsSession() throws Exception {
when(userService.getCurrentUser()).thenReturn(jart);