Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1474

Cannot use custom implementation of authenticationmanager (ShiroWithOAuth2AuthenticationManagerInstaller)

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.13.0
    • Fix Version/s: 1.13.1
    • Component/s: Core: Security: Shiro
    • Labels:
    • Environment:
      Jetbrains IntelliJ
    • Flags:
      Important

      Description

      Good Evening apache isis team,

      Im still new here so I'll try my best to explain the issue that I have found. I found a potential bug when I was updating our application
      to the latest apache isis version to 1.13.0 and found this error. It's regarding the shiro authentication/authorization manager installer. It
      seems it is looking for a constructor but couldn't trace and couldn't see as to why this happens. here is the stacktrace:

      18:15:53,891 [IsisWicketApplication main ERROR] Failed to initialize
      com.google.inject.ProvisionException: Guice provision errors:

      1) Error in custom provider, org.apache.isis.core.commons.factory.InstanceCreationException: Could not instantiate an object of class 'c.organization.isis.addons.oauth2.app.authentication.ShiroWithOAuth2AuthenticationManagerInstaller'; c.organization.isis.addons.oauth2.app.authentication.ShiroWithOAuth2AuthenticationManagerInstaller
      at org.apache.isis.core.runtime.runner.IsisInjectModule.provideIsisSessionFactory(IsisInjectModule.java:109)
      at org.apache.isis.core.runtime.runner.IsisInjectModule.provideIsisSessionFactory(IsisInjectModule.java:109)
      while locating org.apache.isis.core.runtime.system.session.IsisSessionFactory
      for field at org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.isisSessionFactory(IsisWicketApplication.java:138)
      while locating c.organization.iaoy.boot.webapp.IaoyApplication

      1 error
      at com.google.inject.internal.Errors.throwProvisionExceptionIfErrorsExist(Errors.java:451)
      at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:65)
      at com.google.inject.internal.InjectorImpl.injectMembers(InjectorImpl.java:944)
      at org.apache.isis.viewer.wicket.viewer.IsisWicketApplication.init(IsisWicketApplication.java:279)
      at c.s.iaoy.boot.webapp.IaoyApplication.init(IaoyApplication.java:63)
      at org.apache.wicket.Application.initApplication(Application.java:823)
      at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:427)
      at org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:271)
      at javax.servlet.GenericServlet.init(GenericServlet.java:244)
      at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:626)
      at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:405)
      at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:875)
      at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:346)
      at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1379)
      at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1341)
      at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:772)
      at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:259)
      at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:517)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
      at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
      at org.eclipse.jetty.server.Server.start(Server.java:405)
      at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:106)
      at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
      at org.eclipse.jetty.server.Server.doStart(Server.java:372)
      at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
      at org.apache.isis.core.webserver.WebServer.start(WebServer.java:179)
      at org.apache.isis.core.webserver.WebServer.run(WebServer.java:131)
      at org.apache.isis.core.webserver.WebServer.main(WebServer.java:98)
      at org.apache.isis.WebServer.main(WebServer.java:25)
      Caused by: org.apache.isis.core.commons.factory.InstanceCreationException: Could not instantiate an object of class 'c.organization.isis.addons.oauth2.app.authentication.ShiroWithOAuth2AuthenticationManagerInstaller'; c.organization.isis.addons.oauth2.app.authentication.ShiroWithOAuth2AuthenticationManagerInstaller
      at org.apache.isis.core.commons.factory.InstanceUtil.createInstance(InstanceUtil.java:141)
      at org.apache.isis.core.commons.factory.InstanceUtil.createInstance(InstanceUtil.java:103)
      at org.apache.isis.core.commons.factory.InstanceUtil.createInstance(InstanceUtil.java:34)
      at org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProviderUsingInstallers$InstallerLookup.getInstaller(IsisComponentProviderUsingInstallers.java:218)
      at org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProviderUsingInstallers$InstallerLookup.getInstaller(IsisComponentProviderUsingInstallers.java:212)
      at org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProviderUsingInstallers$InstallerLookup.getInstaller(IsisComponentProviderUsingInstallers.java:235)
      at org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProviderUsingInstallers$InstallerLookup.authenticationManagerInstaller(IsisComponentProviderUsingInstallers.java:187)
      at org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProviderUsingInstallers.lookupAuthenticationManager(IsisComponentProviderUsingInstallers.java:102)
      at org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProviderUsingInstallers.<init>(IsisComponentProviderUsingInstallers.java:63)
      at org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProviderUsingInstallers.<init>(IsisComponentProviderUsingInstallers.java:54)
      at org.apache.isis.core.runtime.runner.IsisInjectModule.provideIsisSessionFactory(IsisInjectModule.java:111)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
      at com.google.inject.internal.ProviderMethod.get(ProviderMethod.java:104)
      at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
      at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
      at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
      at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
      at com.google.inject.Scopes$1$1.get(Scopes.java:65)
      at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
      at com.google.inject.internal.SingleFieldInjector.inject(SingleFieldInjector.java:53)
      at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:110)
      at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:75)
      at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:73)
      at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
      at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:73)
      at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:60)
      ... 27 more
      Caused by: java.lang.InstantiationException: c.organiztion.isis.addons.oauth2.app.authentication.ShiroWithOAuth2AuthenticationManagerInstaller
      at java.lang.Class.newInstance(Class.java:427)
      at org.apache.isis.core.commons.factory.InstanceUtil.createInstance(InstanceUtil.java:125)
      ... 55 more
      Caused by: java.lang.NoSuchMethodException: c.organization.isis.addons.oauth2.app.authentication.ShiroWithOAuth2AuthenticationManagerInstaller.<init>()
      at java.lang.Class.getConstructor0(Class.java:3082)
      at java.lang.Class.newInstance(Class.java:412)
      ... 56 more

      What I did was updating ShiroWithOauth2AuthenticationManagerInstaller, since in the new version, the constructor required
      to have an isis configuration. Looked up in github and saw this commit ISIS-1406 which I can only think it's related to this.

      I hope this trace helps and my english too.

        Activity

        Hide
        danhaywood Dan Haywood added a comment -

        Thanks for raising this, John.

        You are right, the API (internal and undocumented, but an API nevertheless) changed in 1.13.x. The old code was:

                            final Installer object = (Installer) InstanceUtil.createInstance(className);
        

        whereas the new code is:

                            final Installer object = (Installer) InstanceUtil.createInstance(className, isisConfiguration);
        

        as you correctly note, the Installer class is now expected to take an IsisConfiguration in its constructor.

        I recall making the change because in 1.13.x we eagerly construct the IsisConfiguration earlier on, and so have it available to pass into each Installer. In earlier versions, each installer could add to the list of config files that were read to make up the overall IsisConfiguration; a much more complex design (unnecessary complexity).

        Anyway, I'll change this to look for both a no-arg constructor and also one accepting an IsisConfiguration.

        Show
        danhaywood Dan Haywood added a comment - Thanks for raising this, John. You are right, the API (internal and undocumented, but an API nevertheless) changed in 1.13.x. The old code was: final Installer object = (Installer) InstanceUtil.createInstance(className); whereas the new code is: final Installer object = (Installer) InstanceUtil.createInstance(className, isisConfiguration); as you correctly note, the Installer class is now expected to take an IsisConfiguration in its constructor. I recall making the change because in 1.13.x we eagerly construct the IsisConfiguration earlier on, and so have it available to pass into each Installer. In earlier versions, each installer could add to the list of config files that were read to make up the overall IsisConfiguration; a much more complex design (unnecessary complexity). Anyway, I'll change this to look for both a no-arg constructor and also one accepting an IsisConfiguration.
        Hide
        danhaywood Dan Haywood added a comment -

        Meanwhile, the work-around should just be to add a constructor accepting an IsisConfiguration instance.

        Show
        danhaywood Dan Haywood added a comment - Meanwhile, the work-around should just be to add a constructor accepting an IsisConfiguration instance.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 6b9abc3c695568f176166f662b55f018ac4c525e in isis's branch refs/heads/maint-1.13.1 from Dan Haywood
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=6b9abc3 ]

        ISIS-1474: also allow implementations of AuthenticationManagerInstaller to be instantiated with no-arg constructor (same as behaviour in isis 1.12.x).

        Show
        jira-bot ASF subversion and git services added a comment - Commit 6b9abc3c695568f176166f662b55f018ac4c525e in isis's branch refs/heads/maint-1.13.1 from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=6b9abc3 ] ISIS-1474 : also allow implementations of AuthenticationManagerInstaller to be instantiated with no-arg constructor (same as behaviour in isis 1.12.x).
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit d27c5221f2d20857b80b66ab48e0a672d169b384 in isis's branch refs/heads/master from Dan Haywood
        [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=d27c522 ]

        ISIS-1474: also allow implementations of AuthenticationManagerInstaller to be instantiated with no-arg constructor (same as behaviour in isis 1.12.x).

        Show
        jira-bot ASF subversion and git services added a comment - Commit d27c5221f2d20857b80b66ab48e0a672d169b384 in isis's branch refs/heads/master from Dan Haywood [ https://git-wip-us.apache.org/repos/asf?p=isis.git;h=d27c522 ] ISIS-1474 : also allow implementations of AuthenticationManagerInstaller to be instantiated with no-arg constructor (same as behaviour in isis 1.12.x).
        Hide
        inocente.jcc John Celso Inocente added a comment -

        Great! Thanks dan!

        Show
        inocente.jcc John Celso Inocente added a comment - Great! Thanks dan!

          People

          • Assignee:
            danhaywood Dan Haywood
            Reporter:
            inocente.jcc John Celso Inocente
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 168h
              168h
              Remaining:
              Remaining Estimate - 168h
              168h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development