Restricting a composite to authenticated users with HTTP Basic Security

This recipe will show how to restrict access to a service, to clients that are able to authenticate themselves as a valid user in the WebLogic domain.

Getting ready

Choose the composite and service endpoint in the composite that you wish to protect.

How to do it...

  1. Open the Configure SOA WS Policies dialog.

    In the composite, right-click on the service you wish to protect and choose the Configure WS Policies... option.

    This will bring up the Configure WS Policies dialog:

    How to do it...
  2. Add an HTTP authentication policy. Click on the plus (How to do it...) icon next to Security to bring up the Select Server Security Policies dialog. Choose oracle/wss_http_token_service_policy and click on OK.
    How to do it...
  3. Confirm that the policy is attached.

    Verify that the selected policy appears in the Security section of the dialog box and select OK.

    How to do it...
  4. Deploy and test the composite.

    The composite can now be deployed and the test screen can be used to verify that the service cannot be called without providing a valid username and password recognized by the WebLogic domain. Go to the Test Web Service screen and test the service endpoint without providing the credentials. You should get a Webservice invocation failed dialog box. Expand the Show Additional Trace Information link to see the full error. Note that there is a Bad response: 403 Forbidden message indicating that access to the page has been denied:

    How to do it...

    Close the dialog and expand the Security section of the Test Web Service page. Select the HTTP basic Auth radio button and provide the Username and Password of the user in the WebLogic domain. Then submit the request.

    How to do it...

How it works...

We began by attaching a policy to a service in a composite. This tells the WSM agent that it must apply a particular policy to this endpoint. All requests to this endpoint will be validated against this policy.

In this case, our policy is to perform HTTP Basic authentication. This policy does two things:

  • It authenticates the incoming request
  • It denies access to the service unless the request can be authenticated

We can think of the policies as acting as filters. In this case, the policy filters out all the requests to the service that are not authenticated via HTTP Basic authentication.

Note, that the policy oracle/wss_http_token_service_policy that we used has a particular name structure:

  • oracle/ identifies it as a built-in, Oracle-provided, policy.
  • wss identifies it as associated with web service security.
  • http tells us that the policy is based on HTTP transport properties.
  • token means that there is some kind of credential being passed.
  • service tells us that the policy is restricted to service endpoints and cannot be used with references. There are usually corresponding client policies that request WSM to inject credentials into a request made through a reference.

Note, that this naming convention is exactly that, a convention, and we could create our own policy called antonys_special that does exactly the same thing. Following the convention is a good idea as it makes it easier to identify the policies that are appropriate for our particular requirements.

There's more...

All restrictions of access have some form of authentication policy. There are more ways of authenticating than just HTTP Basic authentication for example, but they all have the same filtering effect.

Alternative authentication methods

This table outlines some other out of the box authentication policies that are available in SOA Suite. I have omitted the oracle/ prefix and _policy suffix for the policy names in the interest of brevity. The Service Policy Name column is used to identify the policy that protects the resources in SOA Suite. The Client Policy Name column is used to identify the corresponding policy that injects credentials into requests to references:

Service Policy Name

Client Policy Name

Notes

wss_http_token_service

wss_http_token_client

HTTP Basic authentication

wss_username_token_service

wss_username_token_client

Username/password in WS-Security headers

wss10_saml_token_service

wss10_saml_token_client

SAML tokens are passed in the SOAP message

wss10_saml20_token_service

wss10_saml20_token_client

SAML 2.0 tokens are passed in the SOAP message

wss11_kerberos_token_service

wss11_kerberos_token_service

Kerberos authentication using Service Principal Names (SPN)

Note

The SAML authentication policies mentioned previously are only secure if used across an SSL connection. To enforce the delivery of a message across an SSL connection, WSM provides a number of *_over_ssl_* policies such as oracle/wss_http_token_over_ssl_service_policy. These policies only allow messages through if they have used, or will use, the SSL protocol. If a message is received from a non-SSL connection, then it will be rejected without even an attempt at authentication.

Other policies have a *_with_message_protection_* description that uses WS-Security to encrypt parts of the message, providing a mechanism for secure passage of messages through untrusted intermediaries.

Using a different authentication method

This recipe used HTTP Basic authentication to validate the credentials of a requestor. To use a different mechanism, such as oracle/wss_saml_token_over_ssl_service_policy, just replace the policy selected in step 2 of the recipe with the desired recipe.

See also

  • The Creating a new, group-based authorization policy recipe in this chapter
  • The Invoking an HTTP Basic secured web service recipe in this chapter
..................Content has been hidden....................

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