1 20 package org.apache.cactus.sample.servlet.unit; 21 22 import org.apache.cactus.ServletTestCase; 23 import org.apache.cactus.WebRequest; 24 import org.apache.cactus.client.authentication.BasicAuthentication; 25 26 31 public class TestBasicAuthentication extends ServletTestCase 32 { 33 39 public void beginBasicAuthentication(WebRequest theRequest) 40 { 41 theRequest.setRedirectorName("ServletRedirectorSecure"); 42 theRequest.setAuthentication( 43 new BasicAuthentication("testuser", "testpassword")); 44 } 45 46 50 public void testBasicAuthentication() 51 { 52 assertEquals("testuser", request.getUserPrincipal().getName()); 53 assertEquals("testuser", request.getRemoteUser()); 54 assertTrue("User not in 'test' role", request.isUserInRole("test")); 55 } 56 } 57 | Popular Tags |