<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Josh,<br>
<br>
yes, it's possible to create your own JPA authentication provider,
which will use hibernate model of your own application and
authenticate users based on your user data. I hope I understand
correctly that this is something you are trying achieve?<br>
<br>
For declare own datasource, it's easiest to add datasource into
file JBOSS_HOME/standalone/configuration/standalone.xml (look at
JBoss/Wildfly documentation and/or existing datasource
declarations how to do it) and then either create new file
META-INF/persistence.xml inside your JAR and/or extend existing
keycloak file
JBOSS_HOME/standalone/deployments/auth-server.war/WEB-INF/classes/META-INF/persistence.xml
and declare your own persistence unit, which will point to the
datasource declared in standalone.xml . Again look at docs or
existing persistence units for inspiration. Finally in code of
your provider, you can do something like:<br>
<pre><span class="n">EntityManagerFactory emf = </span><span class="n">Persistence</span><span class="o">.</span><span class="na">createEntityManagerFactory</span><span class="o">(</span><span class="s">"name-of-your-persistence-unit"</span><span class="o">);
</span></pre>
You can take a look at existing Keycloak sources for inspiration.
<br>
<br>
Marek<br>
<br>
<br>
On 30.5.2014 22:39, Josh wrote:<br>
</div>
<blockquote
cite="mid:CAMTm=fFR3GrMw1=y=ELWrDWmUTo+ybQMFgbN6-iO0BREGG8Rfw@mail.gmail.com"
type="cite">
<div dir="ltr">Hi guys,
<div><br>
</div>
<div>Wondering if it would be possible to create a JPA
authentication provider? </div>
<div><br>
</div>
<div>What I am trying to do is share the hibernate user model
between keycloak authentication provider and my application.
I've got as far as extracting the models into their own
project so they can be used as dependency between my
application / authentication provider.</div>
<div><br>
</div>
<div>Still wrapping my head around JavaEE architecture so
forgive me if this next sentence doesn't make any sense... The
properties authentication adapter in beta1 examples is a jar
which can't really declare it's own data sources. So
wondering how I would implement a provider that defines its
own datasource?</div>
<div><br>
</div>
<div>Thanks,</div>
<div><br>
</div>
<div>Josh</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
keycloak-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/keycloak-user">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
</blockquote>
<br>
</body>
</html>