[keycloak-user] How to create a Validation Flow to Registration Form using Authentication SPI?

Celso Agra celso.agra at gmail.com
Wed May 24 17:37:00 EDT 2017


Hi all,

Need help please.

I'm trying to create a validation class to add some rules when a user try
to do a registration (just to validate the username).
So, I saw this link:
https://keycloak.gitbooks.io/documentation/server_development/topics/auth-spi.html
and this project:
https://github.com/keycloak/keycloak/tree/master/examples/providers/authenticator

But I still have some questions to know how could I create my own
validation form in the register.ftl

So, My question is:

Should I create just one class as the example of
"org.keycloak.authentication.forms.RegistrationProfile"?
Here is the example below:

*file:* br.gov.pe.sso.keycloak.forms.UsernameFormRegistrationProfile.java

package br.gov.pe.sso.keycloak.forms;
> public class UsernameFormRegistrationProfile implements FormAction,
> FormActionFactory {
> @Override
>     public void validate(ValidationContext context) {
> /*... my validation here!! ...*/
> }
> }


and finally

*file:* META-INF/services/org.keycloak.authentication.FormActionFactory

br.gov.pe.sso.keycloak.forms.UsernameFormRegistrationProfile


So, for now, I just need to create my own jar and add into a specific
folder. is that right? Or should I need to add into keycloak projeto and
then re-generate the war project?
Would be possible to extends the RegistrationProfile class?

I'm sorry for that bunch of questions :)
Thanks a lot!

Best regards

-- 
---
*Celso Agra*


More information about the keycloak-user mailing list