コード例 #1
0
 public void valid_login() {
   Authentication auth =
       provider.authenticate(new UsernamePasswordAuthenticationToken("scott", "tiger"));
   assertNotNull(auth);
   UserDetails principal = (UserDetails) auth.getPrincipal();
   assertEquals(principal.getClass(), SessionContext.class);
   assertEquals(principal.getUsername(), "scott");
 }
コード例 #2
0
 @Test(expectedExceptions = BadCredentialsException.class)
 public void invalid_login() {
   provider.authenticate(new UsernamePasswordAuthenticationToken("scott", "lion"));
 }