Security Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Using WS-Policy in ALSB Proxy and Business Services

To express the message-level security requirements for a proxy service or business service that is a Web service, you use the Web Services Policy (WS-Policy) framework.

This chapter describes conceptual information that you will need in the next chapter, Configuring Message-Level Security for Web Services.

The following sections describe configuring WS-Policy for proxy services and business services:

 


About Web Services Policy

Web Services Policy (WS-Policy) is a standards-based framework for defining a Web service’s constraints and requirements. It expresses constraints and requirements in a collection of XML statements called policies, each of which contains one or more assertions.

In AquaLogic Service Bus, WS-Policy assertions are used to specify a Web service’s requirements for digital signatures and encryption, along with the security algorithms and authentication mechanisms that it requires.

The WS-Policy framework allows other specifications to declare "policy assertions." These are domain-specific XML elements that appear inside a <policy> element. Policy assertions specifications describe the syntax and semantics of these domain-specific assertions.

WS-SecurityPolicy is one example of a domain-specific assertion language. The WS-SecurityPolicy specification defines a set of security policy assertions for use with the WS-Policy framework.

WS-ReliableMessaging is another example of a domain-specific assertion language; it defines assertions for declaring reliable-messaging policy.

Relationship Between WS-Security and WS-Policy

Web Services Security (WS-Security) works in conjunction with the Web Services Policy Framework (WS-Policy), and it is important that you understand what these terms mean and how they relate:

When you configure the WS-Policy of a proxy or business service, if the WS-Policy contains one or more security policy assertions, then the proxy service or business service is considered to be WS-Security enabled.

Supported Web Services Security Policy Assertions

Previous releases of ALSB, released before the formulation of the WS-SecurityPolicy 1.2 specification, used security policy assertions written under the WS-Policy specification, using a proprietary BEA schema for security policy. As of release 3.0, ALSB has limited support for policies that conform to the WS-SecurityPolicy 1.2 specification (for the WS transport only), and the files written under the BEA web services security policy schema first included in WebLogic Server 9.

The WebLogic Server-proprietary format is based on the assertions described in the December 18, 2002 version of the Web Services Security Policy Language (WS-SecurityPolicy) specification. The syntax and usage of these AquaLogic Service Bus security assertions differ from the WS-Policy specification, but the assertions are similar in meaning and are fully compatible with security assertions used in WebLogic Server 9.0 and 9.1 Web services.

WARNING: WS-SecurityPolicy 1.2 policy files and BEA proprietary Web Services security policy schema files are not mutually compatible; you cannot define both types of policy file in the same Web Service. This is true whether the policies are attached to the WSDL or bound directly to the service.
WARNING: ALSB service validation enforces this rule and a conflict is generated if a service has a mix of these two types of WS-SecurityPolicy.

WS-Policies Can be Bound Directly to Service

As in prior releases of ALSB, WS-Policy policies can be included directly in a WSDL document or included by reference, and a WSDL document may import other WSDL documents that contain or refer to WS-Policy policies. An XML file that contains these policies can be used by multiple proxy services or business services.

In addition, as of ALSB 3.0 there is an alternative way to bind WS-Policy to services. The new Policies console page allows you to bind policies directly to a service. Policies can be bound to different scopes:

If a policy is bound to the entire service, it applies to all operations in the service and all request and response messages of all operations. If a policy is bound to an operation, the policy applies to the request and response message of that operation.

Any number of policies can be bound on any given scope.

For the purpose of example, assume there is a service S with operations A, B, C and D, where A, B and C are request/response operations and D is a request-only operation. An administrator can configure the following ws-policy bindings:

In this example:

Abstract and Concrete WS-Policy Statements

For security policy assertions written under the WS-Policy specification (using the proprietary BEA schema for security policy), the WebLogic Web Services runtime environment recognizes two types of WS-Policy statements:

 


AquaLogic Service Bus WS-Policy Files

AquaLogic Service Bus includes a set of out-of-the-box WS-Policy files that you can use. (The AquaLogic Service Bus policy files are a subset of the policy files that WebLogic Server provides.) To see the contents of these XML files, see BEA Web Services Security Policy Files.

The policy statements are of three types:

The predefined policy files are described in the sections that follow.

Predefined WS-Security Policy 1.2 Policy Files

As a general rule, ALSB 3.0 does not support WS-Security Policy (WSSP) 1.2 assertions. The exception to this rule is the WS transport. The WS transport endpoints can have WSSP 1.2 policies, but only if they contain transport-level assertions only. WSSP 1.2 policies with message-level encryption or digital signature assertions are not allowed in ALSB 3.0.

The following WS-SecurityPolicy 1.2 predefined transport-level policy files are available:

Predefined BEA Proprietary Policy Files

The following BEA proprietary predefined policy files are available:

Predefined Reliable Messaging Policy Files

As described in Use of WS-Policy Files for Web Service Reliable Messaging Configuration, WebLogic Web Services use WS-Policy files to enable a destination endpoint to describe and advertise its Web Service reliable messaging capabilities and requirements. These WS-Policy files are XML files that describe features such as the version of the supported WS-ReliableMessaging specification, the source endpoint's retransmission interval, the destination endpoint's acknowledgment interval, and so on.

ALSB includes two simple reliable messaging WS-Policy files that you can use (only with the WS-RM transport) if you do not want to create your own WS-Policy files:

When to use the Predefined Policy Files

BEA recommends that you use these pre-packaged policies whenever possible. However, you cannot use them under the following conditions:

For information on using these policies in your proxy services or business services, see Attaching WS-Policy Statements to WSDL Documents.

 


Creating and Using Custom WS-Policy Statements

If the AquaLogic Service Bus WS-Policy packaged policy files do not meet your security needs, you can write your own WS-Policy statements. You cannot modify the AquaLogic Service Bus WS-Policy statements.

You can write custom WS-Policy statements directly in your Web service’s WSDL document. Or, if you want to reuse your statements in multiple Web services, write them in a separate XML file and then:

Note the following restrictions for WS-Policy statements in AquaLogic Service Bus:

Custom WS-SecurityPolicy 1.2 Policy Statements

Note: As a general rule, ALSB 3.0 does not support WS-Security Policy (WSSP) 1.2 assertions. The exception to this rule is the WS transport.

For WS-SecurityPolicy 1.2 policy statements, your custom policy file needs to comply with the standard format and assertions defined in WS-SecurityPolicy 1.2. Note, however, that release 10.0 of WebLogic Server (used with version 3.0 of ALSB) does not completely implement WS-SecurityPolicy 1.2. For more information, see Unsupported WS-SecurityPolicy 1.2 Assertions. The root element of your WS-SecurityPolicy file must be <Policy> and include the following namespace declarations:

<wsp:Policy 
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512"
>

You can also use the pre-packaged WS-SecurityPolicy files as templates to create your own custom files. See Using WS-SecurityPolicy 1.2 Policy Files.

 


Attaching WS-Policy Statements to WSDL Documents

AquaLogic Service Bus implements the WS-Policy Attachment specification ( http://www.w3.org/Submission/WS-PolicyAttachment/), which defines the mechanisms for associating WS-Policy statements with Web services.

To attach WS-Policy statements to a WSDL document for a Web service:

  1. If you created a custom WS-Policy in a separate XML file, add the custom WS-Policy file as a resource in the AquaLogic Service Bus domain. See “Adding a Custom WS-Policy” under Custom WS-Policies in Using the AquaLogic Service Bus Console.
  2. In the <definitions> element of the WSDL document, add the following child element:
    <wsp:UsingPolicy
       wsdl:Required="true"
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
  3. The wsdl:required="true" attribute ensures that proxy services and business services are capable of processing the policy attachments.

    If you do not add this element, AquaLogic Service Bus ignores any WS-Policy statements in the WSDL.

  4. Within each element in the WSDL document that you want to secure:
    1. Determine the URI of the WS-Policy statements that you want to use. See Determining the URI of a WS-Policy Statement.
    2. Specify the URI in the WSDL document. See Specifying the URI of a WS-Policy Statement in a WSDL Document.

Determining the URI of a WS-Policy Statement

For the AquaLogic Service Bus WS-Policy statements, the URIs are always as follows:

For WS-Policy statements that are located directly in the WSDL document, the URI is as follows:
#policy-ID
where policy-ID is the value of the policy’s wsu:ID attribute. See Listing 6-2.

For WS-Policy statements that you created in a separate XML file and added as resources to AquaLogic Service Bus, the URI is as follows:
policy:policy-ID
where policy-ID is the value of the policy’s wsu:ID attribute (which you specified in the policy’s XML file).

You can also use UDDI to attach WS-Policy statements to a WSDL document, in which case the URI is expressed differently. For more information, see the WS-Policy Attachment specification ( http://www.w3.org/Submission/WS-PolicyAttachment/).

Specifying the URI of a WS-Policy Statement in a WSDL Document

Use one of the following techniques to specify the URI in a WSDL document:

Table 6-1 lists the XPath name of WSDL elements and the technique that you use to specify the URI of the WS-Policy statement. The table also indicates the WSDL elements for which AquaLogic Service Bus does not support the attachment of WS-Policy statements.

Table 6-1 WSDL Elements That Can Be Protected in AquaLogic Service Bus
To Attach a Policy to This WSDL Element...
Use This Technique...
/definitions/message
Nested <Policy> element
/definitions/message/part
PolicyURIs attribute
/definitions/portType
PolicyURIs attribute
/definitions/portType/operation
Nested <Policy> element
/definitions/portType/operation/input
PolicyURIs attribute
/definitions/portType/operation/output
PolicyURIs attribute
/definitions/portType/operation/fault
AquaLogic Service Bus does not support attaching WS-Policy statements to this element
/definitions/binding
Nested <Policy> element
/definitions/binding/operation
Nested <Policy> element
/definitions/binding/operation/input
Nested <Policy> element
/definitions/binding/operation/output
Nested <Policy> element
/definitions/binding/operation/fault
AquaLogic Service Bus does not support attaching WS-Policy statements to this element
/definitions/binding/service
AquaLogic Service Bus does not support attaching WS-Policy statements to this element
/definitions/service/port
Nested <Policy> element

Best Practices: Attaching WS-Policy Statements

BEA recommends that you attach WS-Policy statements to any of the following elements or its descendants:

BEA recommends that you do not attach WS-Policy statements to the following elements:

Example: Requiring X.509 Credentials for Identity and Confidentiality

If a WS-Policy statement requires an X.509 token for authentication, it must also require a digital signature. An X.509 token cannot satisfy an identity assertion unless the client also signs some content with the corresponding private key.

To create a proxy service that requires clients to use X.509 certificates for authentication and digital signatures, you can do the following:

  1. In the WSDL document that you will use to create a proxy service, attach the AquaLogic Service Bus policies that are in the Sign.xml and Auth.xml files. See Listing 6-1.
  2. Configure the proxy service to use a service key provider that contains an X.509 certificate for digital signatures. See Service Key Providers in Using the AquaLogic Service Bus Console.

Because the AquaLogic Service Bus Sign.xml and Auth.xml policies are abstract, they will require the client to provide the credentials that are specified in the service key provider that is associated with the proxy service.

Listing 6-1 shows a WSDL with references to the AquaLogic Service Bus Sign.xml and Auth.xml policies.

Listing 6-1 WSDL with Policy References to AquaLogic Service Bus WS-Policies
<definitions
   ...
   xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
   xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401
      -wss-wssecurity-utility-1.0.xsd">
   <wsp:UsingPolicy
      wsdl:Required="true"
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
   ...
   <portType name="Sample">
      <operation name="doFoo" parameterOrder="data">
         <input message="tns:foo" wsp:PolicyURIs="policy:Sign.xml"/>
         <output message="tns:fooResponse"/>
      </operation>
   </portType>
   <binding name="SampleBinding" type="tns:Sample">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="doFoo">
         <wsp:Policy>
            <wsp:PolicyReference URI="policy:Sign.xml"/>
            <wsp:PolicyReference URI="policy:Auth.xml"/>
         </wsp:Policy>
         ...
      </operation>
      </binding>
   ...
</definitions>

Example: Attaching Custom Inline WS-Policy Statements to a WSDL Document

Listing 6-2 shows a WSDL with two custom WS-Policy policies, wsu:Id="policy1" and wsu:Id="policy2". The policies are located in the WSDL document; therefore the URIs that refer to these polices use XML fragments.

Listing 6-2 WSDL with Policy References to a Custom Inline Policy
<definitions
   ...
   xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
   xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-
   200401-wss-wssecurity-utility-1.0.xsd">
   <wsp:UsingPolicy
      wsdl:Required="true"
      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
<wsp:Policy wsu:Id="policy1">...</wsp:Policy>
<wsp:Policy wsu:Id="policy2">...</wsp:Policy>
...
   <portType name="Sample">
      <operation name="doFoo" parameterOrder="data">
         <input message="tns:foo" wsp:PolicyURIs="#policy1"/>
         <output message="tns:fooResponse"/>
      </operation>
   </portType>
   <binding name="SampleBinding" type="tns:Sample">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="doFoo">
         <wsp:Policy>
            <wsp:PolicyReference URI="#policy2"/>
         </wsp:Policy>
         <soap:operation
            soapAction="http://com.bea.samples/sample/doFoo"
            style="document"/>
         <input>
            <soap:body namespace="http://com.bea.samples/sample"
               use="literal"/>
         </input>
         <output>
            <soap:body namespace="http://com.bea.samples/sample"
              use="literal"/>
         </output>
      </operation>
   </binding>
   ...
</definitions>

 


BEA-Proprietary Security Policy Best Practices

This section describes best practices you should follow when using security policy assertions written under the WS-Policy specification, using the proprietary BEA schema for security policy.

Note: Carefully analyze your security requirements before you design your WS-SecurityPolicy. These best practices may or may not apply to your specific business security needs.

 


Policy Subjects and Effective Policy

A policy subject is an entity, such as service, endpoint, operation, or message, with which a policy can be associated. You can associate a single WS-Policy statement with multiple policy subjects; conversely, multiple WS-Policy statements can be associated with a single policy subject. A policy scope is the collection of policy subjects to which a policy applies. For example, the policy scope implied by a policy attached to wsd:binding/wsdl:operation/wsdl:input is the input message, the operation, the endpoint, and the service.

The effective policy for a given policy subject is the merge of all policies whose scopes contain that policy subject. For example, the effective policy of the input message of a binding operation is the merge of all policies attached to the following:

The AquaLogic Service Bus Console displays the effective policy (read only) when configuring a business or proxy service with WS-Policy statements, as shown in the following figure.

Figure 6-1 Effective Policy

Effective Policy


  Back to Top       Previous  Next