5
votes

We have implemented a custom authenticator for supporting a workflow to reset password via a SMS OTP. The authenticator uses the phone number stored in a user attribute.

We wish to store the credentials for the SMS provider in the Realm Settings, so we're looking for a way to add some additional configuration attributes to Realm Settings,in a separate tag like Login,Theme etc. It would be ideal if the Authentication Provider can "declare" these configuration attributes. If not, is there any other way to extend the Realm Settings ?

1
I'm looking for this as well on the realm level. The authentication provider can definitely make configurations available and they might be more appropriate there.Jerry Saravia
Same desire, different use case: We'd like to make some attributes available for templates. E.g. mainApplicationURL=https://www.example.com/home.html for the prod realm, and mainApplicationURL=https://test.internal.example.com/home.html for the test realm...Peter V. Mørch
There is also: lists.jboss.org/pipermail/keycloak-dev/2016-August/007977.html - it doesn't look like it is possible....Peter V. Mørch

1 Answers

-1
votes

Here is an example of how you'd add the configurable properties to the authenticator. Once the authenticator is added to the flow you'll be able to set configurations for that specific instance of the authenticator. if you add the authenticator to another flow it'll have another set of configs specific to that instance in that other flow.

public class MyFactory implements AuthenticatorFactory {
    @Override
    public boolean isConfigurable() {
        return true;
    }

    private static final List<ProviderConfigProperty> configProperties = new ArrayList<>();

    static {
        ProviderConfigProperty someCheck = new ProviderConfigProperty(
                "some.check.property.name",
                "Some Check",
                "This does some check. You'll see this in the UI.",
                ProviderConfigProperty.BOOLEAN_TYPE,
                true);
        configProperties.add(someCheck);

    }


    @Override
    public List<ProviderConfigProperty> getConfigProperties() {
        return configProperties;
    }

}