@Test public void testSecurityCheckParameters() { _authenticator.setAuth(new MockWindowsAuthProvider()); SimpleHttpRequest request = new SimpleHttpRequest(); request.addParameter("j_security_check", ""); request.addParameter("j_username", WindowsAccountImpl.getCurrentUsername()); request.addParameter("j_password", ""); SimpleHttpResponse response = new SimpleHttpResponse(); assertTrue(_authenticator.authenticate(request, response)); }
public void testProgrammaticSecurity() throws ServletException { _authenticator.setAuth(new MockWindowsAuthProvider()); SimpleHttpRequest request = new SimpleHttpRequest(); request.setContext((Context) _authenticator.getContainer()); request.login(WindowsAccountImpl.getCurrentUsername(), ""); assertEquals(WindowsAccountImpl.getCurrentUsername(), request.getRemoteUser()); assertTrue(request.getUserPrincipal() instanceof GenericWindowsPrincipal); GenericWindowsPrincipal windowsPrincipal = (GenericWindowsPrincipal) request.getUserPrincipal(); assertTrue(windowsPrincipal.getSidString().startsWith("S-")); }