Override Keycloak classes?

I have a custom registerform and added custom validation by having my own implementation of FormAction and FormActionFactory, but I need to add a few other customisation.
For example, Keycloak has;

RegistrationPage.FIELD_EMAIL, Messages.INVALID_EMAIL

But I need to add RegistrationPage.SPECIAL_NUMBER, Messages.INVALID_SPECIAL_NUMBER
among other things. What is the advised course of action?
Should I create my own class and extend RegistrationPage? Or should I create a new RegistrationPage and add my own Strings? Or any other preferable way?

The same for;

public void success(FormContext context) {
   UserModel user = context.getUser();
   MultivaluedMap<String, String> formData =  

I need to add extra fields to UserModel, should I just create my own UserModel or duplicate the UserModel class add then add my own attributes?

1 Like

Is there a solution for you?