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

Dmitry Telegin dt at acutus.pro
Tue Jul 10 09:26:15 EDT 2018


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