Adding more attributes to Realm Settings
Asked Answered
A

1

7

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 ?

Arte answered 20/11, 2017 at 9:51 Comment(3)
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.Recollected
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...Dejection
There is also: lists.jboss.org/pipermail/keycloak-dev/2016-August/007977.html - it doesn't look like it is possible....Dejection
R
0

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;
    }

}
Recollected answered 15/10, 2018 at 18:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.