One Star

Enabling HTTP authentication on published service

Hello,
I'm struggling with enabling HTTP Basic authentication for services I have already published ().
The "ESB Runtime Options" - "Username/Password" seem to enable WS-Security, however I am interested in HTTP basic security.
My guess was to configure it in PAX or Jetty but I'm getting lost, and unfortunately was not able to find a tutorial/Todo.
Any  help appreciated, using Talend ESB 6.1.
3 REPLIES
Employee

Re: Enabling HTTP authentication on published service

Hi,
Yes, It's not out-of-the-box support the HTTP Basic auth for services exported from Studio, one workaround you may try to make changes to the exported kar file manually:
add jaxws:inInterceptors into the blueprint.xml of the control-bundle within the exported kar file:
        <jaxws:inInterceptors>
                 <bean class="org.apache.cxf.interceptor.security.JAASLoginInterceptor" />
                     <property name="contextName" value="karaf" />
                 </bean>
        </jaxws:inInterceptors>
Regards.
Xilai
One Star

Re: Enabling HTTP authentication on published service

Hi xldai
Saw this thread and trying to add basic auth to my .kar service but getting the below error after edit the blueprint.xml
16:02:40,689 | ERROR | pool-87-thread-1 | ries.blueprint.di.AbstractRecipe  193 | 13 - org.apache.aries.blueprint.core - 1.6.1 | Unable to load class org.apache.cxf.interceptor.security.JAASLoginInterceptor from recipe BeanRecipe
16:02:40,691 | WARN  | pool-87-thread-1 | s.blueprint.container.BeanRecipe  875 | 13 - org.apache.aries.blueprint.core - 1.6.1 | Object to be destroyed is not an instance of UnwrapperedBeanHolder, type: null
16:02:40,694 | ERROR | pool-87-thread-1 | container.BlueprintContainerImpl  437 | 13 - org.apache.aries.blueprint.core - 1.6.1 | Unable to start blueprint container for bundle UnmanagedClientWS-control-bundle/0.1.0
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to convert value BeanRecipe to type class java.lang.Object
at org.apache.aries.blueprint.di.CollectionRecipe.internalCreate(CollectionRecipe.java:92)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:955)
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:929)
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:910)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:844)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255)
at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:724)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:411)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:276)
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:300)
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:269)
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:265)
at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:255)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher$2.call(EquinoxEventPublisher.java:189)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHookPrivileged(ServiceRegistry.java:1280)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.notifyHooksPrivileged(ServiceRegistry.java:1263)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.notifyEventHooksPrivileged(EquinoxEventPublisher.java:186)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:146)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:75)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:67)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:102)
at org.eclipse.osgi.container.Module.publishEvent(Module.java:466)
at org.eclipse.osgi.container.Module.start(Module.java:457)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:412)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1262)
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:846)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1152)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:1048)
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: org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to load class org.apache.cxf.interceptor.security.JAASLoginInterceptor from recipe BeanRecipe
at org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:195)
at org.apache.aries.blueprint.di.AbstractRecipe.loadType(AbstractRecipe.java:161)
at org.apache.aries.blueprint.container.BeanRecipe.loadClass(BeanRecipe.java:250)
at org.apache.aries.blueprint.container.BeanRecipe.getType(BeanRecipe.java:917)
at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromType(BeanRecipe.java:341)
at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:282)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:830)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)
at org.apache.aries.blueprint.di.CollectionRecipe.internalCreate(CollectionRecipe.java:90)
... 43 more
Caused by: java.lang.ClassNotFoundException: org.apache.cxf.interceptor.security.JAASLoginInterceptor cannot be found by UnmanagedClientWS-control-bundle_0.1.0
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:568)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:467)
at org.apache.aries.blueprint.container.BlueprintRepository.loadClass(BlueprintRepository.java:419)
at org.apache.aries.blueprint.container.GenericType.parse(GenericType.java:135)
at org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:168)
... 52 more
Employee

Re: Enabling HTTP authentication on published service

Hmm.. you may have to add "org.apache.cxf.interceptor.security" package name into the Import-Package of the MANIFEST.MF of the control-bundle. (or maybe more dependency cxf package names have to be added)