Hi,
I have implemented a flow with a listener protected by basic authentication using the Spring Module.
I have followed this tutorial: https://apisero.com/basic-authentication-using-spring.
It worked until I updated the module passing from Spring 1.3.6 to Spring 1.3.9.
Now I have this error
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.844 s
[INFO] Finished at: 2023-10-24T09:26:19+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.mule.tools.maven:mule-maven-plugin:3.8.2:process-classes (default-process-classes) on project pesonaldata:
Execution default-process-classes of goal org.mule.tools.maven:mule-maven-plugin:3.8.2:process-classes failed: There was '1' error while parsing the given file 'esbsns.xml'.
[ERROR] Full list:
[ERROR] org.xml.sax.SAXParseException; lineNumber: 35; columnNumber: 40; cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.mulesoft.org/schema/mule/spring":delegate-security-providers}'. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/spring":delegate-security-provider}' is expected.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
It seems that there is a syntax error in the file "esbsns.xml" but I think that there is a problem with the version of the library.
The difference between the two modules is that now (how you can see from the screenshot) you can specify more than one Selegate security provider.
Have you ever used Spring 1.3.9 in your projects?
Does it work?
Thank you very much
Finally I solved the problems with Spring Security with these steps:
1) Migrating from MulesoftCE 4.5 to MulesoftCE 4.9.
2) Migrating from Java 1.8 to Java 17.
3) Passing from Sping 1.3.6 to Spring 2.1.1
4) Modyfing the XML of the Mule project from:
<spring:config name="Spring_Config" doc:name="Spring Config" doc:id="zzzzzz" files="beans.xml" />
<spring:security-manager doc:name="Spring Security manager" doc:id="xxxxxxxxx" >
<spring:delegate-security-provider name="auth-manager" delegate-ref="authenticationManager" />
</spring:security-manager>
to:
<spring:config name="Spring_Config" doc:name="Spring Config" doc:id="zzzzzz" files="beans.xml" />
<spring:security-manager
doc:name="Spring Security manager"
doc:id="xxxxxxxxx">
<spring:delegate-security-providers>
<spring:delegate-security-provider
name="auth-manager"
delegate-ref="authenticationManager" />
</spring:delegate-security-providers>
</spring:security-manager>
Now the authentication works without errors.
Nonetheless, I think I will soon switch to custom authentication using header checking.