I’ve read the “Configuring Authentication” documentation that states:
In the pre-built distributions, the engine authentication is switched off by default. You may have a look at the distribution’s web.xml file and remove the comment markers from the above mentioned filter declaration to activate authentication.
However, WildFly doesn’t have a web.xml file that I can find. I want to turn on basic HTTP authentication for the REST API (Camunda 7.5/7.6 and WildFly 10), but can’t figure out where to put the servlet filters mentioned in the documentation. WildFly is typically “configured” in the standalone.xml file, but the only reference to “servlet” in their doesn’t permit the use of those filters.
The web.xml file you ´have to change for REST API Authentication resides in camunda-engine-rest-$VERSION.war which is located in the deployments folder in case of Wildfly as the AS.
as @langfr correctly pointed, web.xml is part of web application, which is usually packaged in a .war file. On Wildfly distributions, they are usually located in server/wildfly-10.1.0.Final/standalone/deployments/
Are you saying that I need to rebuild the distributed Camunda Engine war file versus simply changing an external WildFly file?
In other words, I cannot use the pre-packaged distribution for WildFly 10, I have to rebuild the camunda-engine-rest war file from source code. Is that correct?
This seems like an awful lot of work to enable something that I would think is a common mode of operation. I mean, if you’re not authenticating, how are you controlling access to processes? But, to each their own.
I am not a wildfly expert, but i assume you should be able to extract war file, do changes in web.xml so that your wildfly server redeploys automatically.
In order to enable authentication you will need to update the web.xml as others have noted.
This does not mean you have to rebuild the distribution (although that is an option), rather simply extract the war, update the web.xml and repackage using the “jar” command from your Java SDK.
I made it work and it wasn’t that hard. Here’s the process:
Unzip the camunda-engine-rest-X.X.X.war file. This will produce two directories META-INF and WEB-INF
Change directories to WEB-INF
Using an appropriate text editor, open the web.xml file and uncomment the basic HTTP section you will find there. Save the file.
Using a zip utility, zip the META-INF and WEB-INF directories back into an archive with the same filename a the original. You may have to manually change the extension to “war” as many utilities will save it with a “zip” extension.
Examine the archive to ensure that the two directories are in the root, not in a subdirectory.
Shut down WildFly
Move the original war file from its location in deployments and place the modified file in the deployments directory
Restart WildFly and check the REST API. It should now require authentication.
I’ll be honest that I don’t know where to go from there as the user database and authorization can vary depending upon your implementation.
One more thing: If you’re using the http-connector to make a REST call to the now authentication enabled REST API, then here’s how you encode credentials.
Get your user name and password.
Concatenate them into a string separated by a “:”. Example: myuser:mypassword
Base64 encode the string. In Linux, this command would do that: echo “myuser:mypassword” | base64
In the http-connector Input Parameters, the headers variable (map type) should have an entry that looks like this:
KEY value
============ ==========================================
Authorization Basic bXl1c2VyOm15cGFzc3dvcmQK