[keycloak-user] How to integrate or make use of KeyCloak user database in my own application?

Ling lingvisa at gmail.com
Thu Sep 1 13:25:51 EDT 2016


hi, Christian:

Are you suggesting using two databases, one is MyKeycloakDS to store
keycloak data, and the other MyApplicationDS to store my application data?
Or you mean just use one database MyKeycloakDS to store both keycloak user
data and my application data? You said you don't recommend mixing the
keycloak tables with my own, then is it possible to create a connection
between the User_Entity table in KeyCloak database, and the Post table in
my own database? Not an database expert :)

Thank you.

On Thu, Sep 1, 2016 at 7:33 AM, Christian Hebert <
christian_hebert at hotmail.com> wrote:

> Hi Ling,
>
> I wouldn't recommend mixing the keycloak tables with your own but here is
> how you could do it. First, you should store the keycloak data in your
> database instead of using the default H2 database. We are using Oracle in
> our organization.
>
> To do so, you need to create a new datasource in your jboss server (I will
> not cover how to create this, assuming that you know how) that you will
> name, let's say "java:jboss/datasources/MyKeycloakDS".
>
> In your keycloak-server.json file, change the datasource under
> "connectionsJpa" for this new datasource.On the startup, keycloak will
> create all the tables required.
>
> Please note that your current data (realm, users, roles, ...) will not be
> there. You will start as a fresh installation of Keycloak.
>
> From this point, the table you are looking for is "USER_ENTITY".
>
> Hope this can help you!
>
> Christian
>
> ------------------------------
> From: lingvisa at gmail.com
> Date: Wed, 31 Aug 2016 10:53:20 -0700
> To: keycloak-user at lists.jboss.org
> Subject: [keycloak-user] How to integrate or make use of KeyCloak user
> database in my own application?
>
>
> Hi, All:
>
> So far I have been playing with KeyCloak and been able to set it up and
> running the customer-portal example successfully. Now I need to actually
> use it in my application, and I am not totally sure whether KeyCloak is the
> thing that I am looking for, but I believe my need is just a common use
> case and hopefully KeyCloak is the right software that I am looking for..
>
> When a user comes to my website, he registers and makes a post. Both the
> post and the user information is stored into databases, and the link
> between the user and post, i.e. who made which post? So I have two tables
> in my database: Post(id, post) and User(id,name), and another table
> UserPost(PostID, UserID) to store linking information. This is all fine in
> my own database.
>
> But now when KeyCloak comes into play, the user first registers in
> KeyCloak server and user information are stored in its own database there,
> which seems unrelated to the database (Post and User) in my application. I
> don't want to duplicate two User databases in two servers, right? Even if I
> can tolerate the duplication, how to make the connection between KeyCloak
> database and my application database? I am using JBoss, Hibernate/JPA in my
> application.
>
> Maybe I am missing something in the way how to connect KeyCloak with my
> own application. Is there any tutorial or documentation that I can read?
>
> Thank you.
>
>
>
>
> _______________________________________________ keycloak-user mailing
> list keycloak-user at lists.jboss.org https://lists.jboss.org/
> mailman/listinfo/keycloak-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160901/9ea22841/attachment-0001.html 


More information about the keycloak-user mailing list