<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>FYI, deployer is now in master if you didn't see the email.  It
      does not support deploying SPIs though.  I'm not sure on the
      implications of supporting that or if it can even work with hot
      re-deployment.  i.e. a different deployment that implements that
      deployed SPI.<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 8/15/16 7:39 AM, Stian Thorgersen
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAJgngAeq_rKjcUHwodjtO89j-sZBO92Mrcw9uAtqBOG0JGCKpA@mail.gmail.com"
      type="cite">
      <div dir="ltr">+1 To dropping provider directory as it's not very
        useful for real providers.
        <div><br>
        </div>
        <div>Deployer would be awesome, especially if we can leverage
          jboss-deployment-structure.xml as an alternative to modules
          and Maven deploy plugin. Sounds like a lot of work though.
          There's also the issue around not supporting applications
          deployed directly to Keycloak.</div>
        <div><br>
        </div>
        <div>For a long time ago I built a server which used regular old
          JEE session beans as plugins. All you needed to to was to
          register it globally in JNDI and the server would scan for
          implementations of specific classes. It was a bit of a pain
          when it came to life cycle (beans would need to be deployed
          before the server, etc.). Worked quite well though ;)</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 5 August 2016 at 10:36, Marek
          Posolda <span dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:mposolda@redhat.com" target="_blank">mposolda@redhat.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex"><span
              class="">On 04/08/16 16:03, Bill Burke wrote:<br>
              &gt;<br>
              &gt;<br>
              &gt; On 8/4/16 9:56 AM, Marek Posolda wrote:<br>
              &gt;&gt; Yep, so we can address this with some sort of
              "deployer" you<br>
              &gt;&gt; proposed, which will have automatically access to
              JEE APIs, so people<br>
              &gt;&gt; won't need to declare dependencies on them
              anywhere? Still people<br>
              &gt;&gt; always need to deal with modules though, if they
              don't want just JEE,<br>
              &gt;&gt; but also some other different 3rd party
              dependencies...<br>
              &gt; True, but at least we can make a keycloak deployer
              that is consistent<br>
              &gt; with WARs, etc.  Meaning, those that are experienced
              writing WARs in<br>
              &gt; Wildfly and using jboss-deployment-structure.xml will
              not have to be<br>
              &gt; completely retrained to write a keycloak component.<br>
            </span>+1<br>
            <div>
              <div class="h5">&gt;<br>
                &gt;&gt;<br>
                &gt;&gt;&gt;&gt;&gt; * Had to use JpaKeycloakTransaction
                to enlist EntityManager with<br>
                &gt;&gt;&gt;&gt;&gt; keycloak transactions.  This means
                using EJBs is out of the question.<br>
                &gt;&gt;&gt;&gt;&gt;<br>
                &gt;&gt;&gt;&gt;&gt; This is unacceptable.  Keycloak is
                supposed to be simple and this is<br>
                &gt;&gt;&gt;&gt;&gt; extremely difficult.  When Keycloak
                was an exploded WAR you could use<br>
                &gt;&gt;&gt;&gt;&gt; every Java EE component type as you
                could just plop your extensions<br>
                &gt;&gt;&gt;&gt;&gt; within META-INF/lib.  Classloading
                was simple as it was all the same<br>
                &gt;&gt;&gt;&gt;&gt; classloader.<br>
                &gt;&gt;&gt;&gt;&gt;<br>
                &gt;&gt;&gt;&gt;&gt; Going forward we need to write an
                actual deployer for Keycloak<br>
                &gt;&gt;&gt;&gt;&gt; extensions that allow you to define
                Keycloak providers within EE<br>
                &gt;&gt;&gt;&gt;&gt; jars,<br>
                &gt;&gt;&gt;&gt;&gt; ears, etc.  Writing an extension to
                Keycloak should be as easy as<br>
                &gt;&gt;&gt;&gt;&gt; writing a Java EE application. 
                Extension developers should be<br>
                &gt;&gt;&gt;&gt;&gt; able to<br>
                &gt;&gt;&gt;&gt;&gt; leverage the entire JBoss/Wildfly
                platform. Minimally, we also<br>
                &gt;&gt;&gt;&gt;&gt; need to<br>
                &gt;&gt;&gt;&gt;&gt; begin and commit/rollback a
                UserTransaction within a Keycloak request<br>
                &gt;&gt;&gt;&gt;&gt; flow so that transaction EE and
                Spring component layers can function.<br>
                &gt;&gt;&gt;&gt; +1 for deployer. Maybe we can try to
                prototype an example, which<br>
                &gt;&gt;&gt;&gt; uses stuff like EJB and then see what
                exactly we need to add?<br>
                &gt;&gt;&gt;&gt;<br>
                &gt;&gt;&gt;&gt; For UserTransaction, we can maybe have
                the KeycloakTransaction<br>
                &gt;&gt;&gt;&gt; implementation, which will delegate to
                UserTransaction? Then people<br>
                &gt;&gt;&gt;&gt; can optionally enlist it in their
                provider if they need it :<br>
                &gt;&gt;&gt;&gt;<br>
                &gt;&gt;&gt;&gt; session.getTransactionManager(<wbr>).enlistAfterCompletion(new<br>
                &gt;&gt;&gt;&gt; UserTransactionWrapper());<br>
                &gt;&gt;&gt;&gt;<br>
                &gt;&gt;&gt;&gt; Then Keycloak will automatically take
                care of commit/rollback this<br>
                &gt;&gt;&gt;&gt; transaction at end of request.<br>
                &gt;&gt;&gt; Why wouldn't they just use UserTransaction?<br>
                &gt;&gt; In case that KeycloakTransaction is rolled
                back, then it calls<br>
                &gt;&gt; rollback to all the enlisted delegates. So
                enlisted<br>
                &gt;&gt; UserTransactionWrapper will then call
                UserTransaction.rollback as well.<br>
                &gt;&gt;<br>
                &gt;&gt; Unless we're going to rewrite our transaction
                API to use JTA? That<br>
                &gt;&gt; will automatically integrate with JPA and
                infinispan. If people needs<br>
                &gt;&gt; to enlist their own transaction, they need to
                implement<br>
                &gt;&gt; javax.transaction.xa.<wbr>XAResource. This
                looks slightly more complicated<br>
                &gt;&gt; then implement our KeycloakTransaction, but on
                the other hand, it's a<br>
                &gt;&gt; standard.<br>
                &gt;&gt;<br>
                &gt; I think we can/should have both.  We automatically
                begin and enlist a<br>
                &gt; UserTransactionWrapper into the
                KeycloakTransactionManager at the<br>
                &gt; beginning of a request (in our filter that starts a
                KeycloakSession).<br>
                &gt; If users want something XA then they implement and
                integration with<br>
                &gt; JTA.  If they want something simpler, than use our
                KeycloakTransactions.<br>
              </div>
            </div>
            +1 assuming that automatically enlist UserTransaction in
            each request<br>
            won't have any performance (or other) impact.<br>
            <span class="HOEnZb"><font color="#888888"><br>
                Marek<br>
              </font></span>
            <div class="HOEnZb">
              <div class="h5">&gt;<br>
                &gt; Bill<br>
                <br>
                ______________________________<wbr>_________________<br>
                keycloak-dev mailing list<br>
                <a moz-do-not-send="true"
                  href="mailto:keycloak-dev@lists.jboss.org">keycloak-dev@lists.jboss.org</a><br>
                <a moz-do-not-send="true"
                  href="https://lists.jboss.org/mailman/listinfo/keycloak-dev"
                  rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/keycloak-dev</a><br>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>