public void testAuthenticationObfuscatedSentObfuscated() throws Exception
{
String user = "user1";
String password = "password1";
PasswordAuthenticator authenticator = new PasswordAuthenticator(preparePasswords(new String[]{user, PasswordAuthenticator.obfuscatePassword(password)}));
Object credentials = new String[]{user, PasswordAuthenticator.obfuscatePassword(password)};
// Send the password in clear
Subject subject = authenticator.authenticate(credentials);
assertNotNull(subject);
Set principals = subject.getPrincipals();
assertEquals(principals.size(), 1);
Principal principal = (Principal)principals.iterator().next();
assertEquals(principal.getName(), user);