ALES Integration Guide

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

Securing AquaLogic Data Services Platform

This section provides information about securing ALDSP 2.5 and ALDSP 3.0 data services. It includes the following topics:

 


Overview

ALES can be used to manage access control to entire ALDSP data services or specific data service elements. In addition to simply returning an authorization decision that grants or prevents access, ALES policies can return information to ALDSP for use when performing pre- or post-processing data redaction. As a result, the user receives a redaction of the data requested.

For information about policies used for data redaction, see Pre-Processing Data Redaction and Post-Processing Data Redaction.

The following diagram illustrates how ALES components can be integrated with ALDSP.

Figure 5-1 ALDSP Integration Overview

ALDSP Integration Overview

 


Use-Case

Integration with ALDSP supports the following use-case scenario:

 


Prerequisites

The document assumes the following:

 


Integration Tasks

The major integration tasks are:

Note: In addition to the steps below, additional tasks are required to define policies for data redaction. For pre-processing data redaction, see Pre-Processing Data Redaction. For post-processing data redaction, see Post-Processing Data Redaction.
  1. Create the startWebLogic.cmd file for the ALDSP domain as described in the SSM Installation and Configuration Guide.
  2. Create a file named security.properties that specifies the ALDSP security realm and copy it to the domain directory. The file should contain the following two entries:
  3. wles.realm=<aldsprealm>
    wles.default.realm=<aldsprealm>

    where <aldsprealm> is the name of the security realm.

  4. Define the security providers. For information, see Define Security Providers.
  5. In ALDSP, enable security on the data service elements to be secured as described in Enable ALDSP Elements for Access Control.
  6. Define ALDSP identities in ALES. This chapter provides instructions for identities for the RTLApp sample application. See Define ALDSP Identities in ALES.
  7. Define ALDSP resources in ALES. This chapter provides instructions for resources that represent RTLApp resources. See Define ALDSP Resources in ALES.
  8. Define the Authorization and Role Mapping policies that secure RTLApp as described on Define Policies for ALDSP.
  9. Distribute the policies to the SSM by following the instructions in Distribute Policies.

 


Define Security Providers

The following table provides information about ALES providers for securing ALDSP data services.

Provider
Configuration Settings
ASI Adjudication Provider
Use the defaults for all settings.
Log4j Auditor
Use the defaults for all settings.
Database Authentication
Set the Control Flag to SUFFICIENT and the Identity Scope to aldspusers. Use the defaults for all other settings.
ASI Authorization
Set the Identity Scope to aldspusers. Use the defaults for all other settings.
WebLogic Credential Mapper
Deselect the Credential Mapping Deployment Enabled checkbox.
ASI Role Mapping
Set the Identity Scope to aldspusers. Use the defaults for all other settings.

 


Enable ALDSP Elements for Access Control

Access control must be set on the data service elements to be secured so that ALES is invoked to determine if access to the data should be granted. The following steps describe how to enable security on RTLApp data service elements to be secure with ALES:

  1. Log in to the ALDSP console using an administrative account.
  2. Browse to and select the RTApp data services elements to be secured. For example:
    1. Expand RTLServices/OrderSummaryView and select the Security tab.
    2. On the Secured Elements tab, expand elements and select OrderSummary > OrderDate as an element to be secured.
    3. Repeat these steps for CustomerView.ds > CUSTOMER > ORDERS> ORDER_SUMMARY > OrderDate.

 


Define ALDSP Identities in ALES

To create the Identity directory and users:

  1. In the ALES Administration Console’s left pane, select the Identity node and click New at the bottom of the right pane.
  2. On the Create Directory dialog, enter the directory name (for example, aldspusers) and click OK.
  3. Under the Identity node, select Groups and click New at the bottom of the right pane.
  4. On the Create Group dialog, enter the group name (for example, LDSampleUsers) and click OK.
  5. Under the Identity node, create the following users and add them to the LDSampleUsers group:
  6. Jack (password: weblogic)—RTLApp user
    Steve (password: weblogic)—RTLApp user
    Tim (password: weblogic)—RTLApp user
    weblogic (password: weblogic)—ldconsole administrator

 


Define ALDSP Resources in ALES

This section describes how to use the ALES Administration Console to define the RTLApp and ALDSP resources to be protected by ALES.

RTLApp Application Resources

To create RTLApp application resources, perform the following steps:

  1. Expand the Resources node and select Resources.
  2. In the right pane, select Policy and click New.
  3. On the Create Resource dialog, enter aldsprealm as the name, select Binding in the Type field, and click Ok.
  4. Select the aldsprealm resource and click Configure.
  5. On the Configure Resource dialog, select Binding Application in the Type field, check the Distribution Point and Allow Virtual Resources checkboxes and click Ok.
  6. Modify the ASI Authorization and ASI Role Mapper providers as follows:
    • Set the Application Deployment Parent to //app/policy/aldsprealm
    • On the Bindings tab, bind to //app/policy/aldsprealm

ALDSP 2.5 Resources

Figure 5-2 shows the ALDSP resource tree with all nodes expanded except the RTLApp node. For ALDSP 2.5, you must create the resources shown in both Figure 5-2 and Figure 5-3.

Figure 5-2 ALDSP 2.5 Resource Tree with RTLApp Node Collapsed

ALDSP 2.5 Resource Tree with RTLApp Node Collapsed

Figure 5-3 ALDSP 2.5 Resource Tree with RTLApp Node Expanded

ALDSP 2.5 Resource Tree with RTLApp Node Expanded

ALDSP 3.0 Resources

Figure 5-4 shows the ALDSP resource tree with all nodes expanded except the RTLApp node. You must create the resources shown in both Figure 5-4 and Figure 5-5.

Figure 5-4 ALDSP Resource Tree with RTLApp Node Collapsed

ALDSP Resource Tree with RTLApp Node Collapsed

Figure 5-5 ALDSP Resource Tree with RTLApp Node Expanded

ALDSP Resource Tree with RTLApp Node Expanded

 


Define Policies for ALDSP

Because the sample applications provided with ALDSP 2.5 and ALDSP 3.0 are different, they require different policies. These are documented in the following sections:

Policies for ALDSP 2.5

The Authorization and Role Mapping policies needed to the secure the ALDSP 2.5 sample application are described below.

Authorization Policies

The following policies allow the Admin role to boot WebLogic Server and perform administrative tasks:

grant(any, //app/policy/aldsprealm/shared/svr, //role/Admin) if true;

grant(any, //app/policy/aldsprealm/shared/adm, //role/Admin) if true;

grant(any, [//app/policy/ aldsprealm /RTLApp/ejb,//app/policy/aldsprealm/RTLApp/ld,//app/policy/aldsprealm/RTLApp/url/rtlselfservice/pages], [//role/Admin]) if true;

grant(any, [//app/policy aldsprealm /RTLApp/ejb/RTLApp_ejb.jar/Metadata,//app/policy/aldsprealm/RTLApp/ejb/RTLApp_ejb.jar], [//role/Admin]) if true;

grant([any,//priv/create], //app/policy/ aldsprealm /RTLApp/ejb/.workshop, //role/Admin) if true;

grant(any, [//app/policy/ aldsprealm /console,//app/policy/aldsprealm/shared/svr,//app/policy/aldsprealm/shared/adm], //role/Admin) if true;

The following policy gives Admin user full access to the LD console.

grant(//priv/any, //app/policy/aldsprealm/ldconsole/url/ldconsole, //role/Admin) if true;

Perform the following steps to create the Authorization policies shown above.

  1. Expand the Policy node in the left pane and select Authorization Policies. Then click New in the right pane.
  2. On the Create Authorization Policy dialog, select the Grant radio button.
  3. On the Policy Subjects tab, select Admin in the Roles list and click Add.
  4. Repeat these steps for the remaining authorization policies.
  5. Note: If a policy specifies multiple resources for a single privilege and role, you may specify these resources in one policy.

Role Mapping Policies

The following policy assigns the Everyone role to all users in the aldsprealm directory.

grant(//role/Everyone, //app/policy/aldsprealm, //sgrp/aldspusers/allusers/) if true;

The following policy assigns the weblogic user to the Admin role within aldsprealm.

grant(//role/Admin, //app/policy/aldsprealm, //user/aldspusers/weblogic/) if true;

To create the Role Mapping policies above, perform the following steps.

  1. Expand the Policy node in the left pane and select Role Mapping Policies. Then click New in the right pane.
  2. On the Create Role Mapping Policy dialog, select the Grant radio button.
  3. On the Resources tab, select aldsprealm and click Add.
  4. On the Policy Subjects tab, select allusers in the Roles list and click Add.
  5. Repeat these steps to define the other Role Mapping policy.

Policies for ALDSP 3.0

This section describes how to create the Authorization and Role Mapping policies to protect the ALDSP 3.0 sample application.

Authorization Policies

Define the Authorization policies shown in Table 5-1:

Table 5-1 Authorization Policies for ALDSP 3.0
Policies
Description
grant( any, //app/policy/aldsprealm/RTLApp/url/RTLSelfService, [//sgrp/aldspusers/LDSampleUsers/,//sgrp/aldspusers/aldsp_admins/,//sgrp/aldspusers/Administrators/]) if true;
grant( any, [//app/policy/aldsprealm/shared/adm,//app/policy/aldsprealm/shared/svr], //role/Admin) if true;
grant( any, //app/policy/aldsprealm/WseeJmsModule, //role/Admin) if true;
grant( any, //app/policy/aldsprealm/shared, //role/Admin) if true;
grant( any, //app/policy/aldsprealm/RetailDataspace/ld, [//sgrp/aldspusers/Administrators/,//sgrp/aldspusers/LDSampleUsers/]) if true;
Grants Admin Role and/or weblogic user permission to boot the WLSand perform administrative tasks.
grant( any, //app/policy/aldsprealm/dspconsole, //sgrp/aldspusers/aldsp_admins/) if true;
grant( [//priv/GET,//priv/POST], //app/policy/aldsprealm/dspconsole/url/dspconsole, //role/Everyone) if true;
Gives WebLogic full access to the DSP console.
grant( [//priv/GET,//priv/POST], //app/policy/aldsprealm/consoleapp/url/console/login, //role/Everyone) if true;
grant( //priv/receive, //app/policy/aldsprealm/WseeJmsModule/jms/queue/WseeMessageQueue, //role/Everyone) if true;
grant( //priv/reserve, //app/policy/aldsprealm/shared/jdbc, //role/Everyone) if true;
grant( //priv/lookup, [//app/policy/aldsprealm/shared/jdbc,//app/policy/aldsprealm/shared/jndi], //role/Everyone) if true;
grant( //priv/read, //app/policy/aldsprealm/shared/workcontext, //role/Everyone) if true;
grant( //priv/lookup, //app/policy/aldsprealm/shared/jms, //role/Everyone) if true;
grant( //priv/send, //app/policy/aldsprealm/shared/jms, //role/Everyone) if true;
Grants Everyone role (including the anonymous user) access all of the shared open resources.
grant( any, //app/policy/aldsprealm/RTLApp/url/RTLSelfService, [//sgrp/aldspusers/LDSampleUsers/,//sgrp/aldspusers/aldsp_admins/,//sgrp/aldspusers/Administrators/]) if true;
Allows all users to access the sample application.
grant( any, //app/policy/aldsprealm/shared/ld, //role/DataServiceAdmin) if true;
grant( any, [//app/policy/aldsprealm/shared/svr,//app/policy/aldsprealm/shared/adm,//app/policy/aldsprealm/consoleapp], [//role/Admin,//role/DataServiceAdmin]) if true;
grant( any, //app/policy/aldsprealm/ElectronicsWS/ld/Physical/CUSTOMER_ORDER.ds, //role/DataServiceAdmin) if true;
Grants permission for data services.

Role Mapping Policies

Define the Authorization policies shown in Table 5-2:

Table 5-2 Role Mapping Policies for ALDSP 3.0 Sample Application
   
grant(//role/Everyone, //app/policy/aldsprealm, //sgrp/aldspusers/allusers/) if true;
Allows Everyone role to be used in aldsprealm Identity directory.
grant(//role/Admin, //app/policy/aldsprealm, //user/aldspusers/weblogic/) if true;
Grants the weblogic user Admin role within aldsp realm.
grant( //role/DataServiceAdmin, //app/policy/aldsprealm/dspconsole, //sgrp/aldsp/aldsp_admins/) if true;
Grants the aldsp_admins group DataServiceAdmin role within the dspconsole application.

 


Distribute Policies

After defining the identities, resources, and policies to secure the ALDSP data service(s), deploy the results as follows:

  1. In the ALES Administration Console’s left pane, select the Deployment node.
  2. On the Policy tab in the right pane, select the checkbox before the name of the ALDSP resource parent and click Distribute Policy.
  3. If you made any changes to the SSM configuration used to secure the ALDFSP domain, display the Configuration tab and select the checkbox for the SSM configuration. Then click click Distribute Configuration Changes.

After this, you can test access to RTLApp using the following steps:

Note: These steps may vary slightly depending on the ALDSP version being used.

  1. Start a WebLogic Server instance by changing to the <bea_home>\<weblogic_home>\samples\domains\ldplatform directory and running startWebLogicALES.cmd (Windows) or startWeblogicALES.sh (UNIX).
  2. Access the RTLApp by pointing a browser to http://<hostname>:<port>/RTLSelfService where <hostname> is the machine on which RTL application is running. The browser is redirected to the authentication page (see Figure 5-6).
  3. Figure 5-6 Authentication Page


    Authentication Page

  4. Log in as Steve and access should be granted to the Profile Page (see Figure 5-7).
  5. Figure 5-7 Profile Page


    Profile Page

  6. Select Open Orders Page. Open orders should be visible (see Figure 5-8), while access to Order Data should be denied.
  7. Figure 5-8 Open Orders Page


    Open Orders Page


    Open Orders Page

 


Pre-Processing Data Redaction

Pre-processing data redaction involves modifying the client request in some way before ALDSP forwards the request to the data service. This is achieved through the use of an ALES plug-in that calls the Java API to authorize the user request, gets the response attributes from the authorization response, and returns them to ALDSP.

Here is the sequence of events that occur during pre-processing redaction:

  1. ALDSP receives a data service client request and invokes the ALES plug-in.
  2. ALES plug-in calls the ALES Java API for authorization. The authorization decision returns additional predicates as responses.
  3. ALES plug-in returns the authorization decision and responses to ALDSP.
  4. ALDSP adds the predicates and/or function name and calls the data service
  5. ALDSP engine receives the results from the data service and returns it to the client.
  6. Figure 5-9 Overview of Pre-Processing Solution


    Overview of Pre-Processing Solution

Pre-Processing Response Types

ALES supports two types of responses that return information to ALDSP in the form of security predicates. They can be used separately or together.

The ALES plug-in (com.bea.security.ales.aldsp.ALESFunctionAccessProvider) calls the Java SSM to do authorization and return response attributes to ALDSP. For example, consider the following policy:

grant (
//priv/ALDSP_QUERY, //app/policy/RTLApp/ld/DataServices/RTLServices/OrderView.ds/getOrders,
//user/asi/system/

) if report_as(“aldsp_replacement_function”, “getOrdersThatAmountLessThan1000”)

This policy grants the system user the ALDSP_QUERY privilege on the OrderView data service’s getOrders function. If the authorization decision is true, it returns the aldsp_replacement_function attribute with a value of getOrdersThatAmountLessThan1000. ALDSP then calls that replacement function (instead of the original). This function must the same signature; no additional verifications are performed at runtime.

Required ALES Response Attributes

One of three ALES response attributes must be used to return replacement functions or XQuery expressions. They must be returned by the ALES evaluation functions report and report_as or by user-defined evaluation functions.

ALES response attribute names are all lower case.

Additional Integration Tasks

Additional tasks are required implement pre-processing data redaction.

Modify the Start WebLogic Script

Modify set-wls-env in the WLS SSM instance directory. To do this:

  1. Navigate to the WLS SSM instance directory and open set-wls-env.bat in an editor.
  2. Add ldintegration.jar to the end of WLES_POST_CLASSPATH environment variable.
  3. Add the JVM option -Dcom.bea.ld.security.FunctionAccessQuery=com.bea.security.ales.aldsp.ALESFunctionAccessProvider to WLES_JAVA_OPTIONS.

Write Replacement Functions

Replacement functions must be implemented on the target data service and have the same return type and number/type of parameters as the function being replaced. For example, to restrict OrderView.getOrders to return only orders totalling less than $1000.00, write an XQuery function to implement the restriction. This function must have the same return type, and number types of parameters as getOrders.

Define Policies for Replacement Functions

To use a replacement function to protect data services, define a policy that allows access to the target data service’s function and returns the aldsp_replacement_function attribute with the name of the replacement function. There are no additional access control checks performed for the replaced function.

Note: All policies for pre-processing data redaction must use the ALDSP_QUERY privilege.

For example, the following policy returns a replacement function named getOrdersThatAmountLessThan100:

grant(//priv/ALDSP_QUERY,//RTLApp/DataServices/RTLServices/OrderView.ds/
getOrders,//role/Admin/)if report_as(“aldsp_replacement_function”,
“getOrdersThatAmountLessThan1000”)

Define Policies for XQuery Expressions

To use an XQuery expression, define a policy that returns aldsp_xquery_expression and the name of an XQuery expression. For example:

grant(//priv/ALDSP_QUERY,//RTLApp/ld/DataServices/RTLServices/OrderView.ds
/getOrders,//user/asi/anonymous/)if report_as(“aldsp_xquery_expression”,
“./order/amount < 1000”)
Note: All policies for pre-processing data redaction must use the ALDSP_QUERY privilege.

Define Namespace Bindings

You must define namespace binding used in an XQuery expression. (Namespace bindings are not used for replacement function names; they must be fully qualified, including the namespace.) For example, consider the following policy:

grant (
//priv/ALDSP_QUERY,
//app/policy/RTLApp/ld/DataServices/RTLServices/OrderView.ds/getOrders,//user/asi/anonymous/
) if report_as(“aldsp_xquery_expression”, “./ns1:order/amount < 10
00”)

In this case, you need to define the mapping of namespace ns1 and return it. Therefore, you need to add another response attribute, as follows:

grant (
//priv/ALDSP_QUERY,
//app/policy/RTLApp/ld/DataServices/RTLServices/OrderView.ds/getOrders,
//user/asi/anonymous/
) if report_as(“aldsp_xquery_expression”, “./ns1:order/amount < 1000”) and report_as(“aldsp_namespace_binding”, “ns1=http://com.bea.securi
ty”)

 


Post-Processing Data Redaction

Post-processing data redaction is achieved by invoking a security XQuery function after the ALDSP engine retrieves the data from the data service. The XQuery function determines whether to grant access and return the data. Note: This approach may not be suitable for fast operations or very large data sets.

Here is the sequence of events that occur during post-processing redaction:

  1. Client sends a data retrieving request to ALDSP.
  2. ALDSP engine retrieves the data from the data service(s).
  3. ALDSP invokes the relevant security XQuery function for the data element.
  4. Security XQuery function invokes an ALES Java method, passing in the resource name and one or more attribute names/values.
  5. ALES Java method invokes the WLS SSM and gets the authorization result and optional responses defined in the queries.
  6. ALES Java method returns the authorization decision and a set of responses to the security XQuery function.
  7. XQuery function may use the ALES-supplied responses to make the decision. For example, the policy decision may evaluate as true, but based on the responses the function may return false.
  8. Figure 5-10 Overview of the Post-Processing Solution


    Overview of the Post-Processing Solution

ALDSP Security XQuery Functions

The ALDSP security XQuery functions enable you to specify custom security policies that can be applied to data elements. The functions are useful for creating policies based on data values. For example, to deny access to an element if the order amount exceeds a given threshold.

ALES provides two ALES Java methods that can be called by security XQuery functions. These methods invoke the WLS SSM which determines whether the access request should be granted.

The ALES Java methods can be used instead of, or in addition to, the following ALDSP access control function extensions:

For example, in the XQuery function shown below, fn-bea:is-access-allowed could be replaced with one of the ALES Java method.

Listing 5-1 Example Security XQuery Function

declare namespace demo="demo";
declare namespace retailerType="urn:retailerType";

declare function demo:secureOrders($order as element(retailerType:ORDER_SUMMARY) ) as xs:boolean {
if (fn-bea:is-access-allowed("LimitAccess",
"ld:DataServices/RTLServices/OrderSummaryView.ds")) then
fn:true()
:
:

Note: Because the security XQuery function depends on the data service schema. You must create the security XQuery function based on the custom data service schema.
Note: Custom security XQuery functions must be created in Workshop, instead of the ALDSP console, because the console compiler does not access the custom functions used in it.

ALES Java Methods

The two ALES Java methods are contained in com.bea.security.ales.aldsp.AccessController class.

Parameters

These methods have three parameters as shown in the following example:

let $result := f1:is_access_allowed_with_response_attributes
              ("RTLApp/datacontrol/orderview",
              ("totalorderamount"),
              (fn:string(fn:round ($order/TotalOrderAmount)))) return

Return Values

The is_access_allowed method returns a boolean value (true or false) representing the access permission. You can return this value directly to the security XQuery function or do some additional operation based on the result.

The is_access_allowed_with_response_attributes method returns:

You can test the access permission by comparing the first element of the string array with true or false.

Note: In addition, you can use the response attribute value to implement additional logic, as described below

Policies Returning Attributes to ALDSP

If you use the is_access_allowed_with_response_attributes method, you can create a policy that returns response attributes and then test those attributes.

As described in Using Response Attributes, response attributes are typically specified using built-in evaluation functions that report name/value pairs. There are two functions for returning attributes: report() and report_as(). These functions always return true (if there are no errors), and their information is passed to your application as response attributes embedded within the ResponseContextCollector.

The report_as function allows you to write the policy to specify both the attribute name and value. For example, report_as("class", "A"). The security XQuery function can then test the return response attributes as shown in Figure 5-11:

Figure 5-11 Testing Return Response Attributes

Testing Return Response Attributes

The report_as function loads a named response attribute with a value that specifies an attribute, constant, or a string literal. When returning multiple values, the response attribute is returned as a list.

The report() and report_as()functions are not policy constraints. The attributes are returned only if the authorization decision is true.

Defining a Security XQuery Function

Use Workshop to add a security XQuery function, as follows:

  1. Import the ALES Java method via an XFL library in the current Workshop application, as described in Integrating the ALES Java Methods.
  2. The ALES Java method is an XFL function. The XQuery Function Library (XFL) is a facility for providing auxiliary functions across multiple data services.

  3. To obtain the data service elements, import the namespace of the data service XML schema.
  4. Add an XQuery Function and specify the root element of the data service as the parameter.
  5. In of the XQuery Function, specify all of the attributes that may be returned by the ALES policies protecting the resource. Use two string arrays for names and values. A detailed example is provided in ALES Security XQuery Function (ALDSP 2.5).
  6. If ALES policies for the affected DSP resource require any context parameters to be passed with the request, those parameters should be extracted in the custom XQuery Security function and passed to the SSM via the ALES Java function.

    The ALES Java method is able to determine the authenticated subject to use for authorization, and you do not need to supply it.

  7. Invoke the ALES Java Function with the resource name, attributes, and values.

Integrating the ALES Java Methods

Before you can integrate the ALES Java methods into the ALDSP security XQuery function, you must configure the WLS SSM to protect the ALDSP domain, as outlined in Integration Tasks.

After you have done this, then:

  1. Configure and distribute the policy in ALES:
    1. Define a resource to indicate the current data element of data service.
    2. Define a policy for the resource. If necessary, declare some attributes, and use them in the policy constraints. These attributes must later be passed into the ALES Java method in Step 3.d.
    3. Distribute the policy change.
  2. Import the ALES Java method as an XFL library in the current Workshop application:
    1. Copy alesxfl.jar and api.jar from the WLS SSM lib directory to the ALDSP application’s APP-INF/lib directory.
    2. In the ALDSP application, right-click the node of the data service project and select Import Source Metadata.
    3. Select Java Function as the Data Source Type and click Next.
    4. Expand alesxfl.jar and select the class com.bea.security.ales.aldsp.AccessController.class.
    5. In the next page, based on your use case, select either is_access_allowed or is_access_allowed_with_response_attributes, and finish the wizard.
  3. Use Workshop to create a security XQuery function in the ALDSP application:
    1. Open the XFL file created in Step 2.
    2. Import the namespace of the data service.
    3. Add an XQuery function and define one parameter whose type is the whole data service.
    4. In the XQuery function, supply the ALES Java method with the resource name, and the attributes and values you want to test. For example:
    5. let $result := f1:is_access_allowed_with_response_attributes
                    ("RTLApp/datacontrol/orderview",
                    ("totalorderamount"),
                    (fn:string(fn:round ($order/TotalOrderAmount)))) return

      The first parameter is the resource name as defined in ALES. The second parameter is a string array that contains attribute names. In the example, there is only one attribute, named totalorderamount. The third parameter is a string array that contains attribute values.

      A detailed example is provided in ALES Security XQuery Function (ALDSP 3.0).

  4. In the ALDSP configuration file, specify the data service element to protected:
    1. Open the <ALDSP_APPLICATION_NAME> LDConfig.xml in <ALDSP_DOMAIN>/liquiddata.
    2. Under the element whose id is the data service name to be protected, add the element <con:AdminResources>, such as the following:
    3.    <con:AdminResources>
      <con:AdminResource>
      <con:xpath>SecuredElementName</con:xpath>
      <con:useTag>false</con:useTag>
      </con:AdminResource>
           <con:AdminResource>
      <con:xpath> SecuredElementName</con:xpath>
      <con:QueryRef>SecurityXQueryFunctionName</con:QueryRef>
      <con:useTag>false</con:useTag>
      </con:AdminResource>
      </con:AdminResources>

      SecuredElementName is the XPath of the secured data element and SecurityXQueryFunctionName is the custom security XQuery function name.

  5. Redeploy the application in the Weblogic Server Administration Console:
    1. Log in to the Weblogic Server Administration Console.
    2. Expand the node Deployments|Applications, and select the ALDSP application node.
    3. In right tab, select the Deploy tab.
    4. Click the Redeploy Application button.
    5. When the status is Success, the application has been redeployed.

  6. Restart the Weblogic Server.

ALES Security XQuery Function (ALDSP 2.5)

Note: An example for ALDSP 3.0 is provided in ALES Security XQuery Function (ALDSP 3.0).

In this example, based on the RTLApp that is shipped by ALDSP 2.5, the data service OrderView is configured with a security XQuery function to protect its data elements. It is assumed that the application RTLApp has been deployed on an ALDSP domain that is protected by the WLS SSM.

The integration example follows these steps:

  1. Configure and distribute the policy in ALES:
    1. In the ALES Administration console, define resources named datacontrol and orderview under the RTLApp resource, as shown in Figure 5-12.
    2. Figure 5-12 ALDSP Resource Tree
    3. Define a dynamic attribute named totalorderamount whose type is integer.
    4. Define and distribute the following authorization policy:
    5. grant( view, //app/policy/aldsprealm/RTLApp/datacontrol/orderview, //sgrp/aldspusers/LDSampleUsers/) IF (totalorderamount < 1000) and report_as (“class”,”A”);

      The privilege is view. The Subject is LDSampleUsers. The constraint is totalorderamount < 1000. Response attributes are returned via report_as("class", "A")”.

  2. Import the ALES Java function as an XFL library in the current Workshop application:
    1. Copy alesxfl.jar and api.jar from the WLS SSM lib directory to the ALDSP application’s APP-INF/lib directory.
    2. In the ALDSP application, right-click the DataServices folder and select Import Source Metadata from the pop-up menu, as shown in Figure 5-13.
    3. Figure 5-13 Import ALES Java Function
    4. Select Java Function as the Data Source Type and click Next.
    5. Expand alesxfl.jar and select the class com.bea.security.ales.aldsp.AccessController.class.
    6. In the next page, select the is_access_allowed_with_response_attributes method and finish the wizard.
  3. Add a security XQuery function in the XFL file library.xfl, as shown in Figure 5-14. The following bullet points explain the function shown in the figure:
    • Line 22: Import the namespace of data service OrderView.
    • Line 24: Define a security XQuery function secureOrders.
    • Line 26: Invoke the ALES Java method. The first parameter is the resource name as defined in ALES. The second parameter is a string array that contains attribute names. In the example, there is only one attribute, named totalorderamount, which was defined in Step 1.c. The third parameter is a string array that contains attribute values.
    • Line 28: The type of the element TotalOrderAmount is xsd:decimal. The function fn:round() converts the element into a integer. The function fn:string() converts the element into a string.
    • Line 29: If the first element is true, it indicates that the current operation is permitted.
    • Line 30: Find the response attribute class, which was defined in Step 1.d.
    • Line 31, 31: If the response tabulate class is not found, return false.
    • Line 33 to 46: Check if the response attribute class contains the value A.
    • Figure 5-14 Security XQuery Function
  4. Specify the data service element to be protected in the ALDSP configuration file:
    1. Open RTLAppLDConfig.xml in BEA_HOME/weblogic81/samples/domains/ldplatform/liquiddata.
    2. Find the OrderView configuration item:
    3. <con:DSConfiguration id="ld:DataServices/RTLServices/OrderView.ds">

    4. Add the following XML element under the <con:DSConfiguration> element:
    5. <con:AdminResources>
      <con:AdminResource>
      <con:xpath>ORDER</con:xpath>
      <con:useTag>false</con:useTag>
      </con:AdminResource>

      <con:AdminResource>
      <con:xpath>ORDER</con:xpath>
      <con:QueryRef>{lib:DataServices/library}secureOrders
      </con:QueryRef>
      <con:useTag>false</con:useTag>
      </con:AdminResource>
      </con:AdminResources>

    6. In the Weblogic Server Administration Console, expand the Deployments|Applications node and select the RTLApp application. In the right tab, select the Deploy tab and click the Redeploy Application button.
    7. When the Status of Last Action is Success, the application has been redeployed.

  5. Restart the Weblogic Server.
  6. Open the RTLSelfService application (for example, http://localhost:7001/RTLSelfService) and select the user Steve to log in, as shown in Figure 5-15.
  7. Figure 5-15 Avitek Login Page
  8. Open the Search tab page and click the Search Orders button. Only those items whose attribute Amount is less than 1000 are displayed as shown in Figure 5-16.
  9. Figure 5-16 Search Results with ALES Protection


    Search Results with ALES Protection

ALES Security XQuery Function (ALDSP 3.0)

Note: An example for ALDSP 2.5 is provided in ALES Security XQuery Function (ALDSP 2.5).

In this example, based on the RTLApp that is shipped by ALDSP 3.0, the data service OrderView is configured with a security XQuery function to protect its data elements. It is assumed that the application RTLApp has been deployed on an ALDSP domain that is protected by the WLS SSM.

The integration example follows these steps:

  1. Configure and distribute the policy in ALES:
    1. In the ALES Administration console, define resources named datacontrol and orderview under the RTLApp resource, as shown in Figure 5-17.
    2. Figure 5-17 ALDSP Resource Tree


      ALDSP Resource Tree

    3. Define a dynamic attribute named totalorderamount whose type is integer.
    4. Define and distribute the following an authorization policy:
    5. grant( view, //app/policy/aldsprealm/RTLApp/datacontrol/orderview, //sgrp/aldspusers/LDSampleUsers/) IF (totalorderamount < 1000) and report_as (“class”,”A”);

      The privilege is view. The subject is LDSampleUsers. The constraint is totalorderamount < 1000. Response attributes are returned via report_as("class", "A")”.

  2. Import the ALES Java function as an XFL library in the current Workshop application:
    1. Copy alesxfl.jar and api.jar from the WLS SSM lib directory to the ALDSP application’s APP-INF/lib directory.
    2. In the ALDSP 3.0 application, right-click RetailApplication folder and select New>Logical Data Service, as shown in Figure 5-18.
    3. Figure 5-18 Import ALES Java Function


       Import ALES Java Function

    4. Select Java Function as the Data Source Type and click Next.
    5. Expand alesxfl.jar and select the class com.bea.security.ales.aldsp.AccessController.class.
    6. In the next page, select the is_access_allowed_with_response_attributes method and click Next.
    7. Enter ALES_ACCESS_CONTROL for the new data service name and finish the wizard.
  3. Add a security XQuery function in ALES_ACCESS_CONTROL.ds, as shown in Figure 5-19.
  4. The following bullet points explain the function shown in the figure:

    • Line 36: define a security XQuery function secureOrders.
    • Line 37: invoke the ALES Java method. The first parameter is the resource name as defined in ALES. The second parameter is a string array that contains attribute names. In the example, there is only one attribute, named totalorderamount. The third parameter is a string array that contains attribute values.
    • Line 39: the TotalOrderAmount element type is xsd:decimal. The fn:round() function converts the element into a integer. The fn:string() function converts the element into a string.
    • Line 40: if the first element is true, it indicates that the current operation is permitted.
    • Line 41: find the response attribute class (defined in step d).
    • Line 42: if the response atttibute class is not found, return false.
    • Line 44 to 57: check if the response attribute class contains the value A.
    • Figure 5-19 Security XQuery Function for ALDSP 3.0


      Security XQuery Function for ALDSP 3.0

  5. Redeploy the dataspace in ALDSP Studio:
    1. Navigate to RetailDataspace and select the node.
    2. Navigate to Project at the menu bar and select Clean.
    3. Select RetailDataspace again. Then right-click the dataspace and select Deploy Project.
  6. Specify which element of the data service is protected in the ALDSP console:
    1. Login ALDSP console and click Lock & Edit.
    2. Select Security Configuration on right bottom and navigate to ALDSP Domain>RetailDataspace>RetailApplication>OrderManagement>OrderService.
    3. On the Secured Elements tab, select the ORDER/ORDER checkbox and click Save.
    4. Navigate to ALDSP Domain>RetailDataspace>RetailApplication> OrderManagement>OrderService>ORDER/ORDER from data space navigation tree and click ORDER/ORDER.
    5. On the Secured Elements Configuration tab, enter ld:RetailApplication/ALES_ACCESS_CONTROL for the namespace. Then enter secureOrders for local name and click Add.
    6. Click Active Changes.
  7. Open RTLSelfService application (http://localhost:7001/RTLSelfService) and select the user Steve to log on.
  8. Open the Search tab page and click the Search Orders button. Only those items amounting to less than $1000.00 are displayed as shown in Figure 5-20.
  9. Figure 5-20 Search Results with ALES Protection


    Search Results with ALES Protection


  Back to Top       Previous  Next