If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Mule ESB uses Spring security to provide basic authentication features. It uses delegated security providers that intercept an incoming request, authenticate through applicable security providers and finally return either authenticated or failed response to the user. A typical security request-response flow is depicted below:
Lets see how we can implement a very common use case – securing a Webservice endpoint using basic authentication. We need three elements in order to achieve this result – a security manager, one or more security providers linked to authentication managers and finally a security filter to intercept incoming HTTP requests.
We’ll use the SOAP Code-First service built earlier to introduce basic authentication.
First, the security manager. As you can see in below code snippet, security manager in turn uses one or more delegated security providers. Each security provider is linked to an Authentication Managers specified by “delegate-ref” attribute.
Second, we need to define Authentication Manager. As you can see below, an authentication manager consists of authentication providers. In this example, we’ll use static user=middleware and password=school combination. However, you can link LDAP or Database source as well.
Finally, we need to introduce security filter for our HTTP requests. A simple modification to SOAP Code-First service look like below. Do observe the highlighted portion.
Complete Mule flow is shown below:
Run this project and access WSDL using http://localhost:8084/soap?WSDL. A Basic Authentication dialog will be popped up. You won’t be able to see WSDL until you specify correct user and password.
联系客服