7 Replies Latest reply on Oct 23, 2013 4:36 AM by radomir.kadlec

    Error in authorization with JBoss Fuse


      Hello (Freeman),

      you have resolved authorization error in Fuse ESB I have reported two years ago.

      But the same error is in the JBoss Fuse now.


      It is because the class mentioned in org.apache.servicemix.nmr.api.security.GroupPrincipal is entered as string "org.apache.karaf.jaas.modules.RolePrincipal" and therefore nobody noticed, that this class no more exists.

      The correct class name is org.apache.karaf.jaas.boot.principal.RolePrincipal now.

      Why can not be the class imported istead of entered as a string?


      The result:

      The DefaultAuthorizationEntry creates GroupPrincipal, but the LDAPLoginModule assignes RolePrincipals to authenticated users.

      And than the FlowRegistryImpl.dispatch fails in authorization process, because no matching principals are found.


      Am I the only one using authorization in Fuse ESB?


      Please correct this failure.

      Best regards

      Radomir Kadlec

        • 1. Re: Error in authorization with JBoss Fuse

          Hi Radomir,


          Right, the Karaf RolePrincipal classname was changed between Karaf 2.2.x and Karaf 2.3.x.


          We don't use import class because we shouldn't introduce Karaf dependency into NMR.


          Besides simply change the default Karaf RolePrincipal classname, we should introduce a configurable way to specify the RolePrincipal classname when expose DefaultAuthorizationEntry as OSGi service.


          I will create an internal jira ticket to track it.


          • 2. Re: Error in authorization with JBoss Fuse

            Hi Radomir,


            FYI, issue get fixed, JBoss FUSE 6.1 would have this fix.



            1 of 1 people found this helpful
            • 3. Re: Error in authorization with JBoss Fuse

              Thank you Freeman,

              do we use the authorization in a wrong way, that this error occur?

              Why don't other developpers have this error?


              We define the authorization of the message on the NMR in such a way:


              <osgi:service interface="org.apache.servicemix.nmr.api.security.AuthorizationEntry">
                  <bean class="org.apache.servicemix.nmr.core.security.DefaultAuthorizationEntry">
                      <property name="endpoint" value="IslAWebService.+" />
                      <property name="rank" value="0" />
                      <property name="roles" value="MyRole" />
                      <property name="type" value="Add" />


              Can we use another way to authorize the user from ws-security header with the called webservice?




              • 4. Re: Error in authorization with JBoss Fuse



                I think rare people use NMR endpoint authorization as you do.


                Anyway, if it's a CXF endpoint, you actually can use CXF endpoint authorization directly by adding an authorization interceptor, some configuration like






                    xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd

                                        http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd">



                    <jaxws:endpoint id="helloWorld"





                            <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">

                                 <property name="properties">


                                         <entry key="action" value="UsernameToken"/>

                                         <entry key="passwordType" value="PasswordText"/>




                            <ref component-id="authenticationInterceptor"/>

                        <ref component-id="authorizationInterceptor" />




                            <entry key="ws-security.validate.token" value="false"/>





                    <bean id="authenticationInterceptor" class="org.apache.cxf.interceptor.security.JAASLoginInterceptor">

                       <property name="contextName" value="karaf"/>

                       <property name="roleClassifier" value="RolePrincipal"/>

                       <property name="roleClassifierType" value="classname"/>



                     <!-- authorization against a fixed operation name to role name mapping -->

                    <bean id="authorizationInterceptor" class="org.apache.cxf.interceptor.security.SimpleAuthorizingInterceptor">

                      <property name="methodRolesMap">


                      <entry key="sayHi" value="admin"/>









                1 of 1 people found this helpful
                • 5. Re: Error in authorization with JBoss Fuse

                  Hi Freeman,

                  thank you, that looks good.

                  But I have a NullPointerException, when I call the service configured with the SimpleAuthorizingInterceptor.

                  The exception comes from AbstractAuthorizingInInterceptor.getTargetMethod because the service instance has no MethodDispatcher assigned in its map (I realized it in debugging).

                  What else must be configured to use the SimpleAuthorizingInterceptor?


                  My services are configured as cxfbc:consumer:




                  <util:map id="properties">
                       <entry key="ws-security.validate.token" value="false"/>


                  <bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus" />


                  Thank you for any tips!




                  • 6. Re: Error in authorization with JBoss Fuse



                    If you use cxf bc JBI endpoint, you have to use NMR authorization, the org.apache.cxf.interceptor.security.SimpleAuthorizingInterceptor

                    I showed you before only works for a "standalone" CXF endpoint.



                    • 7. Re: Error in authorization with JBoss Fuse

                      Hi Freeman,

                      that is not good message for us, because the NMR authorization has 2 errors in current distributions (jboss-fuse-6.0.0.redhat-024 and apache-servicemix-4.5.2, we tested both):


                      1. There is a problem with the principal class (RolePrincipal created for user, GroupPrincipal created in NMR configuration) as described before.

                      To solve this problem, we developed our LDAP login module, that adds FroupPrincipal for each RolePrincipal after authentization.


                      2. When the NMR authorization fails (user is not authorized), the Servicemix http communication is broken.

                      The cxfbc:consumer returns the soap fault message as needed, but the http client (soupUI or another Servicemix) waits endless for finishing the http communication and fails with timeout exception.

                      Another soap-faults (for example message validation or user authentization) are received correct.

                      We have no solving for this second error and therefore we try to use authorization through cxf interceptor.


                      In the older apache-servicemix-4.4.1-fuse-07-11 are no of this two errors.


                      I see now, that the SimpleAuthorizingInterceptor is not assumed for using in JBI endpoint, where no reflection is used for assignig service operation to their implementation in service method.

                      So we have no solving for this situation more.