Looking for a way to capture user password in case of Tomcat form-based authentication so that i can send the username/password combination to another application.
This is what i have so far:-
Principal principal = req.getUserPrincipal();
PropertyDescriptor[] pds;
pds = PropertyUtils.getPropertyDescriptors(principal.getClass());
for(int i = 0; i < pds.length; i++){
try {
String name = pds[i].getName();
Object value = PropertyUtils.getProperty(principal,name);
} catch (Exception e) {
e.printStackTrace();
}
}
How can i grab the password out of object?
Would highly appreciate if anyone can provide recommendation around the same.
Check the name property to see it equals
passwordand the corresponding value will be your password.