Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding more attributes to Realm Settings

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 ?

like image 699
Shriharsh Saboji Avatar asked Aug 16 '26 13:08

Shriharsh Saboji


1 Answers

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

}
like image 141
Jerry Saravia Avatar answered Aug 18 '26 04:08

Jerry Saravia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!