Is it possible to use Camunda Optimize having a Rest Engine running with custom authentication over Https?

We are planning to use Optimize in our organization. Our use case we need to access the Camunda engine rest can be accessed with OAUTH-2 authentication and some headers. Can someone help me figure out how to solve this use case? I see there is option only for basic authentication( Username and password) but no placeholder to pass oauth token

Hi @Techie,

I think that the customer rest filter is the way to adjust the http request against the Camunda Platform: Engine Rest Filter | docs.camunda.org

Hope this helps, Ingo

@Ingo_Richtsmeier Thanks for the reply. Do you have any sample code base to look at it?

@Ingo_Richtsmeier I tried using custom rest filter. Added it in plugin folder and provided the base package in optimize environment.yml. But it’s unable to pickup my custom plugin. I ran in debug mode still no luck. This is the interface Implementation I mentioned:

public class AddCustomTokenFilter implements EngineRestFilter {

@Override
public void filter(ClientRequestContext requestContext, String engineAlias, String engineName) throws IOException {
    requestContext.getHeaders().add("test", "test");
    System.out.println(requestContext.getHeaders().toString());
}

}

Optimize Environment.yml:

plugin:
variableImport:
basePackages: []
engineRestFilter:
basePackages: [“com.example.optimize.enginerestplugin”]

Hi @Techie,

Ingo’s suggestion makes sense to me as well, but its odd that Optimize isn’t picking up your plugin. Can you double check that the package your plugin is in is correctly named com.example.optimize.enginerestplugin ? Ie

package com.example.optimize.enginerestplugin;
[imports..]

public class AddCustomTokenFilter implements EngineRestFilter {...}

If the package name in your implementation is correct and Optimize is still not picking up your plugin, could you set the log level of the plugin package org.camunda.optimize.plugin to “trace” and post the log, that should be helpful to further debug this.

1 Like

Thanks for the reply @Helene. I have deleted the elastic search data and it worked. I have one more question: Can we embed Optimize to a separate spring boot project and also add the customized plugins as dependency for the same?

Hi @Techie

This is not something we officially support, but I think it would probably work just fine.

1 Like