[keycloak-dev] How to set default value of a boolean ProviderConfigProperty to true

Stian Thorgersen sthorger at redhat.com
Wed Jul 20 02:04:24 EDT 2016


It looks like the default value is only used in the admin console to show a
default value for the option when configuring the authenticator. The
default values are not added to
AuthenticationFlowContext.getAuthenticatorConfig unless the authenticator
is first configured through the admin console. It would be better if it was
though so default values would always be available. Feel free to create an
enhancement JIRA issue for it.

On 19 July 2016 at 16:23, Rashmi Singh <singhrasster at gmail.com> wrote:

> Infact, not only Boolean, it does not seem to work for even properties
> that are STRING_TYPE. I was using 1.9.4 version earlier but now I tried
> with the latest 2.0.0 version too and it does not work on either. What is
> the issue?
>
> On Tue, Jul 19, 2016 at 7:00 AM, Rashmi Singh <singhrasster at gmail.com>
> wrote:
>
>> Bruno, I had tried "true" also but that did not work either. Forgot to
>> mention in my original post. I am not sure why true or "true" doesn't work
>> if that's expected. Is there a bug? Does anyone have a clue on this?
>>
>> On Tue, Jul 19, 2016 at 4:13 AM, Bruno Oliveira <bruno at abstractj.org>
>> wrote:
>>
>>> Hi Rashmi, try "true" instead of true. Take a look at this:
>>> https://github.com/keycloak/keycloak/blob/f6a718f10a3a3a07a6222bea7d8b58e13712479c/testsuite/integration-arquillian/servers/auth-server/services/testsuite-providers/src/main/java/org/keycloak/testsuite/federation/DummyConfigurableUserFederationProviderFactory.java#L53-L58
>>>
>>> In theory, should work.
>>>
>>> On 2016-07-18, Rashmi Singh wrote:
>>> > In my AuthenticatorFactory class, I have the following configuration
>>> added:
>>> >
>>> >  ProviderConfigProperty property;
>>> >         property= new ProviderConfigProperty();
>>> >         property.setName("propname");
>>> >         property.setLabel("Property Name");
>>> >         property.setDefaultValue(true);
>>> >         property.setType(ProviderConfigProperty.BOOLEAN_TYPE);
>>> >         configProperties.add(identityFirstproperty);
>>> >
>>> > I wanted to keep a default value as true and at first it seemed like
>>> the
>>> > following line would do it:
>>> >
>>> >  property.setDefaultValue(true);
>>> >
>>> > But that does not seem to work. The default is still false. How can I
>>> set
>>> > the default to true?
>>>
>>> > _______________________________________________
>>> > keycloak-dev mailing list
>>> > keycloak-dev at lists.jboss.org
>>> > https://lists.jboss.org/mailman/listinfo/keycloak-dev
>>>
>>>
>>> --
>>>
>>> abstractj
>>> PGP: 0x84DC9914
>>>
>>
>>
>
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-dev/attachments/20160720/b2bcfbde/attachment.html 


More information about the keycloak-dev mailing list