1 Reply Latest reply on May 15, 2015 6:29 PM by csa

    @Page(role = LoginPage.class) question

    hr.stoyanov

      Hi all,

      When using Errai with Keycloak(KC) as a security provider, one of the great advantages of KC is that the Errai developer does not need to provide a login page.

      Yet the Errai secuirty demo does provide one, and my app fails to compile if I do not have such a page (see below). As I plan to put a KC signup/signin link on each of my  app pages' top navigation bar, do I have to annotate all of my pages with @Page(role = LoginPage.class)? The error message below indicate this is not possible as there can only be one such page? Or, do I need to create a fake login page to silence the Errai compiler gwt plugin, which I will never use? Or, should I annotate just one of my pages, but have the SignIn link to KC appear on all app pages?

       

      Here is the reason I need this:

      My app should work fine without the need for a user to sign-in (e.g. support anonymous users), but s/he  can choose to sign in  on any page (nav bar) at any moment, in which case additional functionality will become available. That is why it makes no sense to have a single login page  for that app.

       

      ===============================================================================================

      Caused by: org.jboss.errai.codegen.exception.GenerationException: No @Page with the UniquePageRole LoginPage exists to satisfy TransitionToRole<LoginPage> in org.jboss.errai.security.client.local.context.SecurityContextImpl$SecurityRolesConstraintPage.

      There must be exactly 1 @Page with this role.

        at org.jboss.errai.ui.nav.rebind.NavigationGraphGenerator.validateExistingRolesPresent(NavigationGraphGenerator.java:238)

        at org.jboss.errai.ui.nav.rebind.NavigationGraphGenerator.generate(NavigationGraphGenerator.java:186)

        at org.jboss.errai.config.rebind.AbstractAsyncGenerator$1.call(AbstractAsyncGenerator.java:67)

        at org.jboss.errai.config.rebind.AbstractAsyncGenerator$1.call(AbstractAsyncGenerator.java:55)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)

      Caused by: java.lang.IllegalStateException: No page with the role LoginPage was found.

        at org.jboss.errai.ui.nav.rebind.NavigationGraphGenerator.getPageWithRole(NavigationGraphGenerator.java:671)

        at org.jboss.errai.ui.nav.rebind.NavigationGraphGenerator.validateExistingRolesPresent(NavigationGraphGenerator.java:234)

        ... 7 more

         [WARN] For the following type(s), generated source was never committed (did you forget to call commit()?)

            [WARN] org.jboss.errai.ui.nav.client.local.spi.GeneratedNavigationGraph

         [ERROR] Could not find org.jboss.errai.ui.nav.client.local.spi.GeneratedNavigationGraph in types compiled from source. Is the source glob too strict?

         [ERROR] Errors in 'org/jboss/errai/ui/nav/client/local/URLPatternMatcherProvider.java'

            [ERROR] Line 40: Rebind result 'org.jboss.errai.ui.nav.client.local.spi.GeneratedNavigationGraph' could not be found

      :stocks4grab:s4g-web:draftCompileGwt FAILED

        • 1. Re: @Page(role = LoginPage.class) question
          csa

          Hi Hristo,

           

          My suggestion would be to create a single @Page(role = LoginPage.class) that either offers a link to authenticate via KeyCloak (that's basically how the errai security demo does it) or to have this page automatically redirect to KeyCloak if you don't need a custom login page.

           

          Cheers,

          Christian