4 Replies Latest reply on Feb 23, 2010 12:22 PM by Marcel Casado

    Felix Karaf - JAAS - HELP !!

    Marcel Casado Novice

      Hi,

       

      I'm hot deploying a JAAS blueprint xml config file (attached). Based on the logs the file gets deployed fine . The config relies on a LoginModule  deployed in a different bundle and exposed:

       

      JaasPropertiesLoginModule.xml (0.0.0)

       

      Logs:

       

      15:47:28,247 | DEBUG | pool-2-thread-3  | BlueprintContainerImpl           | container.BlueprintContainerImpl  229 | Running blueprint container for bundle JaasPropertiesLoginModule.xml in state Create

      15:47:28,247 | DEBUG | pool-2-thread-3  | ServiceRecipe                    | lueprint.container.ServiceRecipe  161 | Registering service nnew with interfaces and properties {org.apache.felix.karaf.jaas.module=nnew}

      15:47:28,246 | DEBUG | nerated-bundles} | BundleWatcher                    | .swissbox.extender.BundleWatcher  176 | Scanning bundle

      15:47:28,248 | DEBUG | Event Dispatcher | xml                              | ?                                   ? | BundleEvent STARTED

      15:47:28,249 | INFO  | nerated-bundles} | fileinstall                      | ?                                   ? | Started bundle: blueprint:file:/Users/marcel/Downloads/apache-servicemix-4.1.0-psc-01-00RC1/deploy/JaasPropertiesLoginModule.xml

      15:47:28,249 | DEBUG | pool-2-thread-3  | xml                              | ?                                   ? | ServiceEvent REGISTERED

      15:47:28,250 | DEBUG | pool-2-thread-3  | BlueprintContainerImpl           | container.BlueprintContainerImpl  601 | Instantiating components:

      15:47:28,251 | DEBUG | pool-2-thread-3  | ServiceRecipe                    | lueprint.container.ServiceRecipe  225 | Retrieving service for bundle null and service registration null

      15:47:28,251 | DEBUG | pool-2-thread-3  | ServiceRecipe                    | lueprint.container.ServiceRecipe  256 | Creating service instance

      15:47:28,252 | DEBUG | pool-2-thread-3  | CmPropertyPlaceholder            | pendium.cm.CmPropertyPlaceholder   74 | Retrieving property value security.properties.user from configuration with pid nnew_security

      15:47:28,277 | DEBUG | pool-2-thread-3  | CmPropertyPlaceholder            | pendium.cm.CmPropertyPlaceholder   82 | Found property value /Users/marcel/fuse_osgi_4_0_2/etc/users-credentials2.properties

      15:47:28,282 | DEBUG | pool-2-thread-3  | CmPropertyPlaceholder            | pendium.cm.CmPropertyPlaceholder   74 | Retrieving property value security.properties.group from configuration with pid nnew_security

      15:47:28,283 | DEBUG | pool-2-thread-3  | CmPropertyPlaceholder            | pendium.cm.CmPropertyPlaceholder   82 | Found property value /Users/marcel/fuse_osgi_4_0_2/etc/groups.properties

      15:47:28,284 | DEBUG | pool-2-thread-3  | ServiceRecipe                    | lueprint.container.ServiceRecipe  258 | Service created: org.apache.felix.karaf.jaas.config.impl.Config@69351290

      15:47:28,284 | DEBUG | pool-2-thread-3  | ServiceRecipe                    | lueprint.container.ServiceRecipe  261 | Creating listeners

      15:47:28,284 | DEBUG | pool-2-thread-3  | ServiceRecipe                    | lueprint.container.ServiceRecipe  267 | Listeners created: []

      15:47:28,284 | DEBUG | pool-2-thread-3  | ServiceRecipe                    | lueprint.container.ServiceRecipe  269 | Calling listeners for initial service registration

      15:47:28,285 | DEBUG | pool-2-thread-3  | xml                              | ?                                   ? | ServiceEvent REGISTERED

      15:47:28,286 | DEBUG | pool-2-thread-3  | BlueprintEventDispatcher         | ntainer.BlueprintEventDispatcher   97 | Sending blueprint container event BlueprintEvent[type=CREATED] for bundle JaasPropertiesLoginModule.xml

      15:47:28,286 | DEBUG | pool-2-thread-3  | BlueprintContainerImpl           | container.BlueprintContainerImpl  229 | Running blueprint container for bundle JaasPropertiesLoginModule.xml in state Created

      15:47:28,286 | DEBUG | pool-1-thread-1  | BlueprintListener                | raf.shell.osgi.BlueprintListener   85 | Blueprint app state changed to Created for bundle 207

       

       

       

      But when I run my application does not seem that my JAAS deployed config has been really registered since is not able to find my realm :

       

      15:55:31,968 | DEBUG | /DecisionService | PhaseInterceptorChain            | .cxf.phase.PhaseInterceptorChain  236 | Invoking handleMessage on interceptor edu.ucar.ral.security.ws.cxf.interceptors.JAASInterceptor@6fa97a7

      15:55:31,985 | DEBUG | /DecisionService | JAASAuthenticationService        | cation.JAASAuthenticationService   63 | Authenticating 'marcel

      15:55:31,998 | DEBUG | /DecisionService | ServiceRecipe                    | lueprint.container.ServiceRecipe  225 | Retrieving service for bundle org.apache.felix.karaf.jaas.config_1.2.0.psc-01-00RC1 and service registration {org.apache.felix.karaf.jaas.config.JaasRealm}={org.apache.felix.karaf.jaas.module=karaf, service.id=54}

      15:55:32,003 | WARN  | /DecisionService | PhaseInterceptorChain            | ache.cxf.common.logging.LogUtils  361 | Interceptor for DecisionService has thrown exception, unwinding now

      org.apache.cxf.interceptor.Fault: No LoginModules configured for nnew

           at edu.ucar.ral.security.ws.cxf.interceptors.JAASInterceptor.handleMessage(JAASInterceptor.java:134)

           at edu.ucar.ral.security.ws.cxf.interceptors.JAASInterceptor.handleMessage(JAASInterceptor.java:54)

           at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:239)

           at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:109)

           at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:312)

           at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:276)

           at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)

           at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)

           at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)

           at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)

           at org.mortbay.jetty.Server.handle(Server.java:320)

           at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)

           at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)

           at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:741)

           at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)

           at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)

           at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)

           at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:636)

           at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

      Caused by: javax.security.auth.login.LoginException: No LoginModules configured for nnew

           at javax.security.auth.login.LoginContext.init(LoginContext.java:256)

           at javax.security.auth.login.LoginContext.(LoginContext.java:444)

           at edu.ucar.ral.security.jaas.authentication.JAASAuthenticationService.authenticate(JAASAuthenticationService.java:65)

           at edu.ucar.ral.security.ws.cxf.interceptors.JAASInterceptor.handleMessage(JAASInterceptor.java:127)

           ... 18 more

       

       

       

      Any help will be greatly appreciated, thanks.

       

      -Marcel

        • 1. Re: Felix Karaf - JAAS - HELP !!
          Gert Vanthienen Novice

          L.S.,

           

          Could you run osgi:ls for your configuration xml bundle to ensure that the JaasRealm instance got published properly and has the right properties added to the registration? 

           

          As an example, if you run that on the default Karaf login configuration, you get:

          karaf@root> osgi:ls 30
          
          Apache Felix Karaf :: JAAS Modules (30) provides:
          -------------------------------------------------
          objectClass = org.apache.felix.karaf.jaas.config.JaasRealm
          org.apache.felix.karaf.jaas.module = karaf
          service.id = 48
          

           

          Regards,

           

          Gert

          • 2. Re: Felix Karaf - JAAS - HELP !!
            Marcel Casado Novice

            Thanks for your help Gert, it seems it deployed right :

             

            JaasPropertiesLoginModule.xml (0.0.0)

            karaf@root> osgi:ls 207

             

            Bundle 207 provides:

            -


            org.apache.felix.karaf.jaas.module = nnew

            objectClass = org.apache.felix.karaf.jaas.config.JaasRealm

            service.id = 272

            -


            osgi.blueprint.container.version = 0.0.0

            osgi.blueprint.container.symbolicname = JaasPropertiesLoginModule.xml

            objectClass = org.osgi.service.blueprint.container.BlueprintContainer

            service.id = 273

             

             

            Is there something else I can check  ?

             

            Thanks,

             

            -Marcel

            • 3. Re: Felix Karaf - JAAS - HELP !!
              Marcel Casado Novice

              is it possible that hot deployment of  blueprint Jaas config files is no supported in 4.2 or there is a bug. Seems like if the Jaas file is wrapped in a OSGI bundle similar to the provided Apache Felix Karaf :: JAAS Modules (1.4.0.fuse-01-00)

               

              DEBUG pool-2-thread-1              org.eclipse.osgi.framework.internal.core.BundleHost              - Registering service jaas-context with interfaces and properties {org.apache.felix.karaf.jaas.module=jaas-context}

              DEBUG pool-2-thread-1              org.eclipse.osgi.framework.internal.core.BundleHost              - Tracking reference {org.apache.felix.karaf.jaas.config.JaasRealm}={org.apache.felix.karaf.jaas.module=jaas-context, service.id=268} for OSGi service (objectClass=org.apache.felix.karaf.jaas.config.JaasRealm)

               

              That is a correct line, you can see how the Tracking reference is set.

               

              I would prefer have hot deployment working is a more flexible approach. Thanks.