[keycloak-user] Read and Write Theme to a DB

Yegui Cai caiyegui at gmail.com
Tue Jul 17 08:05:16 EDT 2018


Dmitry, you are right. The interface can not intercept theme resources.

On Tue, Jul 10, 2018 at 10:44 AM Yegui Cai <caiyegui at gmail.com> wrote:

> Sure. as long as i can create a simple sample.
>
> On Tue, Jul 10, 2018 at 9:26 AM Dmitry Telegin <dt at acutus.pro> wrote:
>
>> On Tue, 2018-07-10 at 09:14 -0400, Yegui Cai wrote:
>> > Hi Dmitry.
>> >
>> > Thanks a lot for your hints. By "wring a theme", I mean storing the
>> > theme in DB.
>> >
>> > Another approach which may be helpful for my purpose is maybe
>> > changing the theme based on the info stored in DB. It looks like I
>> > need to implement ThemeResourceProvider and its factory. Am i
>> > correct?
>>
>> AFAIK, ThemeResourceProvider is used to *add* resources on the fly, not
>> sure if it can *override* existing resources. You are free to try it
>> however, and tell us about the results :)
>>
>> Dmitry
>>
>> >
>> > Best,
>> > Yegui
>> >
>> > On Tue, Jul 10, 2018 at 8:15 AM Dmitry Telegin <dt at acutus.pro> wrote:
>> > > Hi Yegui,
>> > >
>> > > Yes, this is possible, but you'll need to implement a couple of
>> > > SPIs
>> > > [1]:
>> > >
>> > > - Theme SPI from keycloak-server-spi-private. It's an internal SPI,
>> > > so
>> > > you won't find much docs on it, but everything is more or less
>> > > clear
>> > > from the code - see org.keycloak.theme.Theme* and default
>> > > implementations;
>> > > - Entity SPI [2]. Even if you opt for pure JDBC (not JPA) for
>> > > storing
>> > > your themes, you'll need to supply a Liquibase changelog, which is
>> > > done
>> > > this way.
>> > >
>> > > Regarding "Read and Write Theme to a DB", I think "write" is a bit
>> > > confusing here, since Keycloak doesn't write themes. It will be you
>> > > who'll have to write themes to DB, not Keycloak :)
>> > >
>> > > Cheers,
>> > > Dmitry Telegin
>> > > CTO, Acutus s.r.o.
>> > > Keycloak Consulting and Training
>> > >
>> > > Pod lipami street 339/52, 130 00 Prague 3, Czech Republic
>> > > +42 (022) 888-30-71
>> > > E-mail: info at acutus.pro
>> > >
>> > > [1] https://www.keycloak.org/docs/latest/server_development/index.h
>> > > tml#
>> > > _providers
>> > > [2] https://www.keycloak.org/docs/latest/server_development/index.h
>> > > tml#
>> > > _extensions_jpa
>> > >
>> > > On Fri, 2018-07-06 at 14:50 -0400, Yegui Cai wrote:
>> > > > Hi.
>> > > >
>> > > > Would it be possible to store themes in a DB?
>> > > >
>> > > > Thanks,
>> > > > Yegui
>> > > > _______________________________________________
>> > > > keycloak-user mailing list
>> > > > keycloak-user at lists.jboss.org
>> > > > https://lists.jboss.org/mailman/listinfo/keycloak-user
>> > >
>>
>


More information about the keycloak-user mailing list