[keycloak-dev] Provider's "disabled" and "enabled" flags
Sebastian Laskawiec
slaskawi at redhat.com
Thu Aug 29 07:11:42 EDT 2019
I created https://issues.jboss.org/browse/KEYCLOAK-11227 to track this.
On Wed, Aug 28, 2019 at 12:51 PM Stian Thorgersen <sthorger at redhat.com>
wrote:
> That's correct a provider won't be initialised if it's disabled so there's
> no need for this in the provider itself.
>
> One thing to not here is that providers that have an expensive init should
> consider lazy init itself. We don't have support for that built in directly
> so the providers need to do that themselves for now. Take a look at the jpa
> connection factory for an example.
>
> On Tue, 27 Aug 2019, 21:47 Stefan Guilhen, <sguilhen at redhat.com> wrote:
>
>> Hi Sebastian,
>>
>> I agree with you here. The session factory is already checking the
>> "enabled" property, so any provider factory checking the same property (or
>> the "disabled' variant) seems redundant to me. So +1 to removing the
>> checks
>> from the provider factories.
>>
>> On Tue, Aug 27, 2019 at 9:37 AM Sebastian Laskawiec <slaskawi at redhat.com>
>> wrote:
>>
>> > Hey,
>> >
>> > As Stefan noticed, some providers (including the one I created a few
>> weeks
>> > back) check "disabled" flag from the configuration [1][2]. Stefan
>> pointed
>> > out, that our Subsystem (and Keycloak internals) already check the
>> > "enabled" flag [3] on the SPI level. If the SPI is disabled, it won't be
>> > initialized at all, so all the disabled/enabled checks in
>> > ProviderFactory#init seems to be redundant.
>> >
>> > If I didn't miss anything and you all agree with me, I'd like to remove
>> > this kind of checks.
>> >
>> > Thanks,
>> > Sebastian
>> >
>> > [1]
>> >
>> >
>> https://github.com/keycloak/keycloak/blob/5f9feee3f86e3d856063c8b6d355e30c962258f7/services/src/main/java/org/keycloak/truststore/FileTruststoreProviderFactory.java#L66
>> > [2]
>> >
>> >
>> https://github.com/keycloak/keycloak/blob/3afbdd3ea3d8eb1ef339f2c0c46fb57783f4b79b/services/src/main/java/org/keycloak/vault/PlainTextVaultProviderFactory.java#L41
>> > [3]
>> >
>> >
>> https://github.com/keycloak/keycloak/blob/505cf5b25184c59ca85de63b082eb12383eba1ab/services/src/main/java/org/keycloak/services/DefaultKeycloakSessionFactory.java#L272
>> > _______________________________________________
>> > keycloak-dev mailing list
>> > keycloak-dev at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/keycloak-dev
>> >
>>
>>
>> --
>>
>> Stefan Guilhen
>>
>> Principal Software Engineer
>>
>> Red Hat <https://www.redhat.com/>
>>
>> sguilhen at redhat.com IM: sguilhen
>> @RedHat <https://twitter.com/redhat> Red Hat
>> <https://www.linkedin.com/company/red-hat> Red Hat
>> <https://www.facebook.com/RedHatInc>
>> <https://www.redhat.com/>
>> _______________________________________________
>> keycloak-dev mailing list
>> keycloak-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/keycloak-dev
>>
>
More information about the keycloak-dev
mailing list