Keycloak - Custom form action not visible in flowWrong ordering in generated table in jpaHibernate UserType nullSafeSet - how to know if called for insert/update or selectSort ArrayList of custom Objects by propertyCan someone show me a simple working implementation of PagerSlidingTabStrip?why spill failure happens for Custom Data Type in HadoopsetText on button from another activity androidKeycloak required action check in authentiation flowIs KeyCloak authentication using Custom User Attribute possible?Why onBindViewHolder index isn't incrementing in Recycler View?keycloak to keycloak data sync

Avoiding estate tax by giving multiple gifts

Increase performance creating Mandelbrot set in python

How do I go from 300 unfinished/half written blog posts, to published posts?

How to check is there any negative term in a large list?

Would this custom Sorcerer variant that can only learn any verbal-component-only spell be unbalanced?

Integer addition + constant, is it a group?

Roman Numeral Treatment of Suspensions

How did Arya survive the stabbing?

Tiptoe or tiphoof? Adjusting words to better fit fantasy races

Can the discrete variable be a negative number?

Is `x >> pure y` equivalent to `liftM (const y) x`

Is the destination of a commercial flight important for the pilot?

Purchasing a ticket for someone else in another country?

Why escape if the_content isnt?

How to run a prison with the smallest amount of guards?

What is the difference between "behavior" and "behaviour"?

What is the best translation for "slot" in the context of multiplayer video games?

How to safely derail a train during transit?

Is there a problem with hiding "forgot password" until it's needed?

Go Pregnant or Go Home

Large drywall patch supports

How does it work when somebody invests in my business?

How do I rename a Linux host without needing to reboot for the rename to take effect?

Was Spock the First Vulcan in Starfleet?



Keycloak - Custom form action not visible in flow


Wrong ordering in generated table in jpaHibernate UserType nullSafeSet - how to know if called for insert/update or selectSort ArrayList of custom Objects by propertyCan someone show me a simple working implementation of PagerSlidingTabStrip?why spill failure happens for Custom Data Type in HadoopsetText on button from another activity androidKeycloak required action check in authentiation flowIs KeyCloak authentication using Custom User Attribute possible?Why onBindViewHolder index isn't incrementing in Recycler View?keycloak to keycloak data sync













1















I am trying to implement custom form action for user registration. I have added few custom fields on the form and I wish to validate those fields. After going through the keycloak documentation, I realised that I need to



  • Extend FormAction, FormActionFactory

  • Package the actionfactory in META-INF/services/org.keycloak.authentication.FormActionFactory

  • Deploy the JAR in keycloak/standalone/deployments folder.

I have done all the steps and verified that the provider is getting loaded. Here is the log from keycloak log file



15:35:29,962 WARN [org.keycloak.services] (ServerService Thread Pool -- 46) KC-SERVICES0047: organization-field-validation-action (com.phoenix.keycloak.forms.action.OrganizationFormAction) is implementing the internal SPI form-action. This SPI is internal and may change without notice


But when I go to Authentication execution screen, the provider is not listed.
enter image description here



Here is the code for custom action.



/**
*
*/
package com.phoenix.keycloak.forms.action;

import java.util.ArrayList;
import java.util.List;

import javax.ws.rs.core.MultivaluedMap;

import org.keycloak.Config.Scope;
import org.keycloak.authentication.FormAction;
import org.keycloak.authentication.FormActionFactory;
import org.keycloak.authentication.FormContext;
import org.keycloak.authentication.ValidationContext;
import org.keycloak.events.Details;
import org.keycloak.events.Errors;
import org.keycloak.forms.login.LoginFormsProvider;
import org.keycloak.models.AuthenticationExecutionModel.Requirement;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel;
import org.keycloak.models.utils.FormMessage;
import org.keycloak.provider.ProviderConfigProperty;
import org.keycloak.services.validation.Validation;

/**
* @author Yogesh Jadhav
*
*/
public class OrganizationFormAction implements FormAction, FormActionFactory

private static final String PROVIDER_ID = "organization-field-validation-action";

private static Requirement[] REQUIREMENT_CHOICES = Requirement.REQUIRED, Requirement.DISABLED ;

/*
* (non-Javadoc)
*
* @see org.keycloak.provider.Provider#close()
*/
@Override
public void close()


/*
* (non-Javadoc)
*
* @see org.keycloak.provider.ProviderFactory#create(org.keycloak.models.
* KeycloakSession)
*/
@Override
public FormAction create(KeycloakSession arg0)
return this;


/*
* (non-Javadoc)
*
* @see org.keycloak.provider.ProviderFactory#getId()
*/
@Override
public String getId()
return PROVIDER_ID;


/*
* (non-Javadoc)
*
* @see org.keycloak.provider.ProviderFactory#init(org.keycloak.Config.Scope)
*/
@Override
public void init(Scope arg0)


/*
* (non-Javadoc)
*
* @see org.keycloak.provider.ProviderFactory#postInit(org.keycloak.models.
* KeycloakSessionFactory)
*/
@Override
public void postInit(KeycloakSessionFactory arg0)


/*
* (non-Javadoc)
*
* @see
* org.keycloak.authentication.ConfigurableAuthenticatorFactory#getDisplayType()
*/
@Override
public String getDisplayType()
return "Organization Profile Validation";


/*
* (non-Javadoc)
*
* @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
* getReferenceCategory()
*/
@Override
public String getReferenceCategory()
return null;


/*
* (non-Javadoc)
*
* @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
* getRequirementChoices()
*/
@Override
public Requirement[] getRequirementChoices()
return REQUIREMENT_CHOICES;


/*
* (non-Javadoc)
*
* @see
* org.keycloak.authentication.ConfigurableAuthenticatorFactory#isConfigurable()
*/
@Override
public boolean isConfigurable()
return true;


/*
* (non-Javadoc)
*
* @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
* isUserSetupAllowed()
*/
@Override
public boolean isUserSetupAllowed()
return true;


/*
* (non-Javadoc)
*
* @see org.keycloak.provider.ConfiguredProvider#getConfigProperties()
*/
@Override
public List<ProviderConfigProperty> getConfigProperties()
return null;


/*
* (non-Javadoc)
*
* @see org.keycloak.provider.ConfiguredProvider#getHelpText()
*/
@Override
public String getHelpText()
return "Validates organization name and mobile number field.";


/*
* (non-Javadoc)
*
* @see
* org.keycloak.authentication.FormAction#buildPage(org.keycloak.authentication.
* FormContext, org.keycloak.forms.login.LoginFormsProvider)
*/
@Override
public void buildPage(FormContext arg0, LoginFormsProvider arg1)


/*
* (non-Javadoc)
*
* @see
* org.keycloak.authentication.FormAction#configuredFor(org.keycloak.models.
* KeycloakSession, org.keycloak.models.RealmModel,
* org.keycloak.models.UserModel)
*/
@Override
public boolean configuredFor(KeycloakSession arg0, RealmModel arg1, UserModel arg2)
return false;


/*
* (non-Javadoc)
*
* @see org.keycloak.authentication.FormAction#requiresUser()
*/
@Override
public boolean requiresUser()
return false;


/*
* (non-Javadoc)
*
* @see
* org.keycloak.authentication.FormAction#setRequiredActions(org.keycloak.models
* .KeycloakSession, org.keycloak.models.RealmModel,
* org.keycloak.models.UserModel)
*/
@Override
public void setRequiredActions(KeycloakSession arg0, RealmModel arg1, UserModel arg2)


/*
* (non-Javadoc)
*
* @see
* org.keycloak.authentication.FormAction#success(org.keycloak.authentication.
* FormContext)
*/
@Override
public void success(FormContext arg0)


/*
* (non-Javadoc)
*
* @see
* org.keycloak.authentication.FormAction#validate(org.keycloak.authentication.
* ValidationContext)
*/
@Override
public void validate(ValidationContext context)
MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
List<FormMessage> errors = new ArrayList<>();

context.getEvent().detail(Details.REGISTER_METHOD, "form");
String eventError = Errors.INVALID_REGISTRATION;

if (Validation.isBlank(formData.getFirst("user.attributes.companyName")))
errors.add(new FormMessage("user.attributes.companyName", "missingOrganizationNameMessage"));


if (Validation.isBlank(formData.getFirst("user.attributes.contactPersonMobile")))
errors.add(new FormMessage("user.attributes.contactPersonMobile", "missingContactPersonMobileMessage"));


if (errors.size() > 0)
context.error(eventError);
context.validationError(formData, errors);
return;

else
context.success();






Not able to figure out what went wrong here.










share|improve this question


























    1















    I am trying to implement custom form action for user registration. I have added few custom fields on the form and I wish to validate those fields. After going through the keycloak documentation, I realised that I need to



    • Extend FormAction, FormActionFactory

    • Package the actionfactory in META-INF/services/org.keycloak.authentication.FormActionFactory

    • Deploy the JAR in keycloak/standalone/deployments folder.

    I have done all the steps and verified that the provider is getting loaded. Here is the log from keycloak log file



    15:35:29,962 WARN [org.keycloak.services] (ServerService Thread Pool -- 46) KC-SERVICES0047: organization-field-validation-action (com.phoenix.keycloak.forms.action.OrganizationFormAction) is implementing the internal SPI form-action. This SPI is internal and may change without notice


    But when I go to Authentication execution screen, the provider is not listed.
    enter image description here



    Here is the code for custom action.



    /**
    *
    */
    package com.phoenix.keycloak.forms.action;

    import java.util.ArrayList;
    import java.util.List;

    import javax.ws.rs.core.MultivaluedMap;

    import org.keycloak.Config.Scope;
    import org.keycloak.authentication.FormAction;
    import org.keycloak.authentication.FormActionFactory;
    import org.keycloak.authentication.FormContext;
    import org.keycloak.authentication.ValidationContext;
    import org.keycloak.events.Details;
    import org.keycloak.events.Errors;
    import org.keycloak.forms.login.LoginFormsProvider;
    import org.keycloak.models.AuthenticationExecutionModel.Requirement;
    import org.keycloak.models.KeycloakSession;
    import org.keycloak.models.KeycloakSessionFactory;
    import org.keycloak.models.RealmModel;
    import org.keycloak.models.UserModel;
    import org.keycloak.models.utils.FormMessage;
    import org.keycloak.provider.ProviderConfigProperty;
    import org.keycloak.services.validation.Validation;

    /**
    * @author Yogesh Jadhav
    *
    */
    public class OrganizationFormAction implements FormAction, FormActionFactory

    private static final String PROVIDER_ID = "organization-field-validation-action";

    private static Requirement[] REQUIREMENT_CHOICES = Requirement.REQUIRED, Requirement.DISABLED ;

    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.provider.Provider#close()
    */
    @Override
    public void close()


    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.provider.ProviderFactory#create(org.keycloak.models.
    * KeycloakSession)
    */
    @Override
    public FormAction create(KeycloakSession arg0)
    return this;


    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.provider.ProviderFactory#getId()
    */
    @Override
    public String getId()
    return PROVIDER_ID;


    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.provider.ProviderFactory#init(org.keycloak.Config.Scope)
    */
    @Override
    public void init(Scope arg0)


    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.provider.ProviderFactory#postInit(org.keycloak.models.
    * KeycloakSessionFactory)
    */
    @Override
    public void postInit(KeycloakSessionFactory arg0)


    /*
    * (non-Javadoc)
    *
    * @see
    * org.keycloak.authentication.ConfigurableAuthenticatorFactory#getDisplayType()
    */
    @Override
    public String getDisplayType()
    return "Organization Profile Validation";


    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
    * getReferenceCategory()
    */
    @Override
    public String getReferenceCategory()
    return null;


    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
    * getRequirementChoices()
    */
    @Override
    public Requirement[] getRequirementChoices()
    return REQUIREMENT_CHOICES;


    /*
    * (non-Javadoc)
    *
    * @see
    * org.keycloak.authentication.ConfigurableAuthenticatorFactory#isConfigurable()
    */
    @Override
    public boolean isConfigurable()
    return true;


    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
    * isUserSetupAllowed()
    */
    @Override
    public boolean isUserSetupAllowed()
    return true;


    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.provider.ConfiguredProvider#getConfigProperties()
    */
    @Override
    public List<ProviderConfigProperty> getConfigProperties()
    return null;


    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.provider.ConfiguredProvider#getHelpText()
    */
    @Override
    public String getHelpText()
    return "Validates organization name and mobile number field.";


    /*
    * (non-Javadoc)
    *
    * @see
    * org.keycloak.authentication.FormAction#buildPage(org.keycloak.authentication.
    * FormContext, org.keycloak.forms.login.LoginFormsProvider)
    */
    @Override
    public void buildPage(FormContext arg0, LoginFormsProvider arg1)


    /*
    * (non-Javadoc)
    *
    * @see
    * org.keycloak.authentication.FormAction#configuredFor(org.keycloak.models.
    * KeycloakSession, org.keycloak.models.RealmModel,
    * org.keycloak.models.UserModel)
    */
    @Override
    public boolean configuredFor(KeycloakSession arg0, RealmModel arg1, UserModel arg2)
    return false;


    /*
    * (non-Javadoc)
    *
    * @see org.keycloak.authentication.FormAction#requiresUser()
    */
    @Override
    public boolean requiresUser()
    return false;


    /*
    * (non-Javadoc)
    *
    * @see
    * org.keycloak.authentication.FormAction#setRequiredActions(org.keycloak.models
    * .KeycloakSession, org.keycloak.models.RealmModel,
    * org.keycloak.models.UserModel)
    */
    @Override
    public void setRequiredActions(KeycloakSession arg0, RealmModel arg1, UserModel arg2)


    /*
    * (non-Javadoc)
    *
    * @see
    * org.keycloak.authentication.FormAction#success(org.keycloak.authentication.
    * FormContext)
    */
    @Override
    public void success(FormContext arg0)


    /*
    * (non-Javadoc)
    *
    * @see
    * org.keycloak.authentication.FormAction#validate(org.keycloak.authentication.
    * ValidationContext)
    */
    @Override
    public void validate(ValidationContext context)
    MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
    List<FormMessage> errors = new ArrayList<>();

    context.getEvent().detail(Details.REGISTER_METHOD, "form");
    String eventError = Errors.INVALID_REGISTRATION;

    if (Validation.isBlank(formData.getFirst("user.attributes.companyName")))
    errors.add(new FormMessage("user.attributes.companyName", "missingOrganizationNameMessage"));


    if (Validation.isBlank(formData.getFirst("user.attributes.contactPersonMobile")))
    errors.add(new FormMessage("user.attributes.contactPersonMobile", "missingContactPersonMobileMessage"));


    if (errors.size() > 0)
    context.error(eventError);
    context.validationError(formData, errors);
    return;

    else
    context.success();






    Not able to figure out what went wrong here.










    share|improve this question
























      1












      1








      1








      I am trying to implement custom form action for user registration. I have added few custom fields on the form and I wish to validate those fields. After going through the keycloak documentation, I realised that I need to



      • Extend FormAction, FormActionFactory

      • Package the actionfactory in META-INF/services/org.keycloak.authentication.FormActionFactory

      • Deploy the JAR in keycloak/standalone/deployments folder.

      I have done all the steps and verified that the provider is getting loaded. Here is the log from keycloak log file



      15:35:29,962 WARN [org.keycloak.services] (ServerService Thread Pool -- 46) KC-SERVICES0047: organization-field-validation-action (com.phoenix.keycloak.forms.action.OrganizationFormAction) is implementing the internal SPI form-action. This SPI is internal and may change without notice


      But when I go to Authentication execution screen, the provider is not listed.
      enter image description here



      Here is the code for custom action.



      /**
      *
      */
      package com.phoenix.keycloak.forms.action;

      import java.util.ArrayList;
      import java.util.List;

      import javax.ws.rs.core.MultivaluedMap;

      import org.keycloak.Config.Scope;
      import org.keycloak.authentication.FormAction;
      import org.keycloak.authentication.FormActionFactory;
      import org.keycloak.authentication.FormContext;
      import org.keycloak.authentication.ValidationContext;
      import org.keycloak.events.Details;
      import org.keycloak.events.Errors;
      import org.keycloak.forms.login.LoginFormsProvider;
      import org.keycloak.models.AuthenticationExecutionModel.Requirement;
      import org.keycloak.models.KeycloakSession;
      import org.keycloak.models.KeycloakSessionFactory;
      import org.keycloak.models.RealmModel;
      import org.keycloak.models.UserModel;
      import org.keycloak.models.utils.FormMessage;
      import org.keycloak.provider.ProviderConfigProperty;
      import org.keycloak.services.validation.Validation;

      /**
      * @author Yogesh Jadhav
      *
      */
      public class OrganizationFormAction implements FormAction, FormActionFactory

      private static final String PROVIDER_ID = "organization-field-validation-action";

      private static Requirement[] REQUIREMENT_CHOICES = Requirement.REQUIRED, Requirement.DISABLED ;

      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.Provider#close()
      */
      @Override
      public void close()


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ProviderFactory#create(org.keycloak.models.
      * KeycloakSession)
      */
      @Override
      public FormAction create(KeycloakSession arg0)
      return this;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ProviderFactory#getId()
      */
      @Override
      public String getId()
      return PROVIDER_ID;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ProviderFactory#init(org.keycloak.Config.Scope)
      */
      @Override
      public void init(Scope arg0)


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ProviderFactory#postInit(org.keycloak.models.
      * KeycloakSessionFactory)
      */
      @Override
      public void postInit(KeycloakSessionFactory arg0)


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.ConfigurableAuthenticatorFactory#getDisplayType()
      */
      @Override
      public String getDisplayType()
      return "Organization Profile Validation";


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
      * getReferenceCategory()
      */
      @Override
      public String getReferenceCategory()
      return null;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
      * getRequirementChoices()
      */
      @Override
      public Requirement[] getRequirementChoices()
      return REQUIREMENT_CHOICES;


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.ConfigurableAuthenticatorFactory#isConfigurable()
      */
      @Override
      public boolean isConfigurable()
      return true;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
      * isUserSetupAllowed()
      */
      @Override
      public boolean isUserSetupAllowed()
      return true;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ConfiguredProvider#getConfigProperties()
      */
      @Override
      public List<ProviderConfigProperty> getConfigProperties()
      return null;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ConfiguredProvider#getHelpText()
      */
      @Override
      public String getHelpText()
      return "Validates organization name and mobile number field.";


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.FormAction#buildPage(org.keycloak.authentication.
      * FormContext, org.keycloak.forms.login.LoginFormsProvider)
      */
      @Override
      public void buildPage(FormContext arg0, LoginFormsProvider arg1)


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.FormAction#configuredFor(org.keycloak.models.
      * KeycloakSession, org.keycloak.models.RealmModel,
      * org.keycloak.models.UserModel)
      */
      @Override
      public boolean configuredFor(KeycloakSession arg0, RealmModel arg1, UserModel arg2)
      return false;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.authentication.FormAction#requiresUser()
      */
      @Override
      public boolean requiresUser()
      return false;


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.FormAction#setRequiredActions(org.keycloak.models
      * .KeycloakSession, org.keycloak.models.RealmModel,
      * org.keycloak.models.UserModel)
      */
      @Override
      public void setRequiredActions(KeycloakSession arg0, RealmModel arg1, UserModel arg2)


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.FormAction#success(org.keycloak.authentication.
      * FormContext)
      */
      @Override
      public void success(FormContext arg0)


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.FormAction#validate(org.keycloak.authentication.
      * ValidationContext)
      */
      @Override
      public void validate(ValidationContext context)
      MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
      List<FormMessage> errors = new ArrayList<>();

      context.getEvent().detail(Details.REGISTER_METHOD, "form");
      String eventError = Errors.INVALID_REGISTRATION;

      if (Validation.isBlank(formData.getFirst("user.attributes.companyName")))
      errors.add(new FormMessage("user.attributes.companyName", "missingOrganizationNameMessage"));


      if (Validation.isBlank(formData.getFirst("user.attributes.contactPersonMobile")))
      errors.add(new FormMessage("user.attributes.contactPersonMobile", "missingContactPersonMobileMessage"));


      if (errors.size() > 0)
      context.error(eventError);
      context.validationError(formData, errors);
      return;

      else
      context.success();






      Not able to figure out what went wrong here.










      share|improve this question














      I am trying to implement custom form action for user registration. I have added few custom fields on the form and I wish to validate those fields. After going through the keycloak documentation, I realised that I need to



      • Extend FormAction, FormActionFactory

      • Package the actionfactory in META-INF/services/org.keycloak.authentication.FormActionFactory

      • Deploy the JAR in keycloak/standalone/deployments folder.

      I have done all the steps and verified that the provider is getting loaded. Here is the log from keycloak log file



      15:35:29,962 WARN [org.keycloak.services] (ServerService Thread Pool -- 46) KC-SERVICES0047: organization-field-validation-action (com.phoenix.keycloak.forms.action.OrganizationFormAction) is implementing the internal SPI form-action. This SPI is internal and may change without notice


      But when I go to Authentication execution screen, the provider is not listed.
      enter image description here



      Here is the code for custom action.



      /**
      *
      */
      package com.phoenix.keycloak.forms.action;

      import java.util.ArrayList;
      import java.util.List;

      import javax.ws.rs.core.MultivaluedMap;

      import org.keycloak.Config.Scope;
      import org.keycloak.authentication.FormAction;
      import org.keycloak.authentication.FormActionFactory;
      import org.keycloak.authentication.FormContext;
      import org.keycloak.authentication.ValidationContext;
      import org.keycloak.events.Details;
      import org.keycloak.events.Errors;
      import org.keycloak.forms.login.LoginFormsProvider;
      import org.keycloak.models.AuthenticationExecutionModel.Requirement;
      import org.keycloak.models.KeycloakSession;
      import org.keycloak.models.KeycloakSessionFactory;
      import org.keycloak.models.RealmModel;
      import org.keycloak.models.UserModel;
      import org.keycloak.models.utils.FormMessage;
      import org.keycloak.provider.ProviderConfigProperty;
      import org.keycloak.services.validation.Validation;

      /**
      * @author Yogesh Jadhav
      *
      */
      public class OrganizationFormAction implements FormAction, FormActionFactory

      private static final String PROVIDER_ID = "organization-field-validation-action";

      private static Requirement[] REQUIREMENT_CHOICES = Requirement.REQUIRED, Requirement.DISABLED ;

      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.Provider#close()
      */
      @Override
      public void close()


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ProviderFactory#create(org.keycloak.models.
      * KeycloakSession)
      */
      @Override
      public FormAction create(KeycloakSession arg0)
      return this;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ProviderFactory#getId()
      */
      @Override
      public String getId()
      return PROVIDER_ID;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ProviderFactory#init(org.keycloak.Config.Scope)
      */
      @Override
      public void init(Scope arg0)


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ProviderFactory#postInit(org.keycloak.models.
      * KeycloakSessionFactory)
      */
      @Override
      public void postInit(KeycloakSessionFactory arg0)


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.ConfigurableAuthenticatorFactory#getDisplayType()
      */
      @Override
      public String getDisplayType()
      return "Organization Profile Validation";


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
      * getReferenceCategory()
      */
      @Override
      public String getReferenceCategory()
      return null;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
      * getRequirementChoices()
      */
      @Override
      public Requirement[] getRequirementChoices()
      return REQUIREMENT_CHOICES;


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.ConfigurableAuthenticatorFactory#isConfigurable()
      */
      @Override
      public boolean isConfigurable()
      return true;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.authentication.ConfigurableAuthenticatorFactory#
      * isUserSetupAllowed()
      */
      @Override
      public boolean isUserSetupAllowed()
      return true;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ConfiguredProvider#getConfigProperties()
      */
      @Override
      public List<ProviderConfigProperty> getConfigProperties()
      return null;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.provider.ConfiguredProvider#getHelpText()
      */
      @Override
      public String getHelpText()
      return "Validates organization name and mobile number field.";


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.FormAction#buildPage(org.keycloak.authentication.
      * FormContext, org.keycloak.forms.login.LoginFormsProvider)
      */
      @Override
      public void buildPage(FormContext arg0, LoginFormsProvider arg1)


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.FormAction#configuredFor(org.keycloak.models.
      * KeycloakSession, org.keycloak.models.RealmModel,
      * org.keycloak.models.UserModel)
      */
      @Override
      public boolean configuredFor(KeycloakSession arg0, RealmModel arg1, UserModel arg2)
      return false;


      /*
      * (non-Javadoc)
      *
      * @see org.keycloak.authentication.FormAction#requiresUser()
      */
      @Override
      public boolean requiresUser()
      return false;


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.FormAction#setRequiredActions(org.keycloak.models
      * .KeycloakSession, org.keycloak.models.RealmModel,
      * org.keycloak.models.UserModel)
      */
      @Override
      public void setRequiredActions(KeycloakSession arg0, RealmModel arg1, UserModel arg2)


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.FormAction#success(org.keycloak.authentication.
      * FormContext)
      */
      @Override
      public void success(FormContext arg0)


      /*
      * (non-Javadoc)
      *
      * @see
      * org.keycloak.authentication.FormAction#validate(org.keycloak.authentication.
      * ValidationContext)
      */
      @Override
      public void validate(ValidationContext context)
      MultivaluedMap<String, String> formData = context.getHttpRequest().getDecodedFormParameters();
      List<FormMessage> errors = new ArrayList<>();

      context.getEvent().detail(Details.REGISTER_METHOD, "form");
      String eventError = Errors.INVALID_REGISTRATION;

      if (Validation.isBlank(formData.getFirst("user.attributes.companyName")))
      errors.add(new FormMessage("user.attributes.companyName", "missingOrganizationNameMessage"));


      if (Validation.isBlank(formData.getFirst("user.attributes.contactPersonMobile")))
      errors.add(new FormMessage("user.attributes.contactPersonMobile", "missingContactPersonMobileMessage"));


      if (errors.size() > 0)
      context.error(eventError);
      context.validationError(formData, errors);
      return;

      else
      context.success();






      Not able to figure out what went wrong here.







      java keycloak keycloak-services






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 21 at 15:56









      CuriousMindCuriousMind

      2,23322135




      2,23322135






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Apologies. I was looking at the wrong "Add Execution" option. I realized that each form also has a corresponding "Actions" menu. This menu also has "Add Execution" option.



          enter image description here



          After selecting that option, I could see my Custom Form action is displayed in the restricted list of actions.



          enter image description here






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55284482%2fkeycloak-custom-form-action-not-visible-in-flow%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Apologies. I was looking at the wrong "Add Execution" option. I realized that each form also has a corresponding "Actions" menu. This menu also has "Add Execution" option.



            enter image description here



            After selecting that option, I could see my Custom Form action is displayed in the restricted list of actions.



            enter image description here






            share|improve this answer



























              0














              Apologies. I was looking at the wrong "Add Execution" option. I realized that each form also has a corresponding "Actions" menu. This menu also has "Add Execution" option.



              enter image description here



              After selecting that option, I could see my Custom Form action is displayed in the restricted list of actions.



              enter image description here






              share|improve this answer

























                0












                0








                0







                Apologies. I was looking at the wrong "Add Execution" option. I realized that each form also has a corresponding "Actions" menu. This menu also has "Add Execution" option.



                enter image description here



                After selecting that option, I could see my Custom Form action is displayed in the restricted list of actions.



                enter image description here






                share|improve this answer













                Apologies. I was looking at the wrong "Add Execution" option. I realized that each form also has a corresponding "Actions" menu. This menu also has "Add Execution" option.



                enter image description here



                After selecting that option, I could see my Custom Form action is displayed in the restricted list of actions.



                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 22 at 10:31









                CuriousMindCuriousMind

                2,23322135




                2,23322135





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55284482%2fkeycloak-custom-form-action-not-visible-in-flow%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현