Custom user federation with custom login page

Hello,

i’m trying to get a custom user federation with a custom system. I could get working as far as the login flow is the standard user/password pair but know i’ve to collect another information, which is a string, to complete the user validation.
I’m implementing a storage provider that implements CredentialInputValidator and on isValid i call the target system for validate the user password pair.
I can get the username this way:

StorageId sid = new StorageId(user.getId());
String username = sid.getExternalId()

The password this way:

credentialInput.getChallengeResponse()

But how i can get a new “foo” field which i put on my custom login template?

Another question, is it possible to add a captcha and how with such kind of custom federated login system?

Thanks for the attention and any answer are very welcome