Securing a proxy service by using Username Token authentication and protecting the message

In this recipe, we will combine message protection with user authentication. For this we can reuse the client Java keystore and the osbbook user from the precedingrecipes.

Getting ready

For this we will use the same simple OSB project as in the previous Securing a proxy service using username and password authentication through OWSM recipe.

Import the getting-ready project into Eclipse OEPE from chapter-11getting-readysecuring-a-proxy-service-with-auth-and-message-protection.

How to do it...

The steps to execute in this recipe are the same as in the previous Securing a proxy service using username and password authentication through OWSM recipe, only another policy needs to be selected. In the Eclipse OEPE, perform the following steps:

  1. Open the CustomerManagement.proxy in the proxy folder of the securing-a-proxy-service-with-auth-and-message-protection project.
  2. Navigate to the Policy tab.
  3. Enable From OWSM Policy Store.
  4. Click Service Level Policies, which will enable the Add button.
  5. Click Add and the OWSM Policy Configuration window will open.
  6. Click Browse.
  7. In the Select OWSM Policy window, we need to choose a security or management policy.
  8. Enter *username_token_with* into the Name field and click Search.
  9. Select the oracle/wss11_username_token_with_message_protection_service_policy from the list of policies and click OK.

    The Username Token policy will be displayed in the Policy tab of the proxy service.

    How to do it...
  10. Save the project and deploy it to the OSB server.

    Instead of the oracle/wss11_username_token_with_message_protection_service_policy we could also use oracle/wss10_username_token_with_message_protection_service_policy for this poxy service.

    In the Service Bus console, perform the following steps for testing the service:

  11. Navigate to the CustomerManagement proxy service (in the Project Explorer, click on the securing-a-proxy-service-with-auth-and-message-protection project and then on the proxy folder) and click on the Launch Test Console icon (with the bug).
  12. Click Execute (the value passed in the ID does not have an effect; the answer of the proxy service is hardcoded).
  13. We will get an error saying that the username is missing.
  14. Click Back to specify the username and password.
  15. In the test console, scroll down until the Security area is visible.
  16. Enter serverkey into the Override Value field for the property keystore.recipient.alias.
  17. Enter enc-csf-key into the Override Value field for the property keystore.enc.csf.key.
  18. Enter osbbook-key into the Override Value field for the property csf.key.
  19. Click Execute.
    How to do it...
  20. The test should now work and a valid response should be returned by the proxy service. The test console also shows the various SOAP headers passed in the request message holding the security information.

How it works...

The Username Token authentication, together with message protection policy, authenticates the service consumer using the Username Token and also encrypts the SOAP body.

The public key of the server is used to encrypt the SOAP body.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset