Integrating ALES with Application Environments

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

Integrating with AquaLogic Data Services Platform

This section describes how to integrate AquaLogic Enterprise Security with AquaLogic Data Services Platform, using the WebLogic Server 8.1 SSM or WebLogic Server 9.x SSM. It includes the following topics:

 


Introduction

AquaLogic Enterprise Security (ALES) can provide fine-grained entitlements for Data Services serviced by AquaLogic Data Services Platform (ALDSP) 2.1. AquaLogic Enterprise Security can be used to manage access control to entire services or elements of those services. AquaLogic Enterprise Security allows you to have common set of security policies for a heterogeneous environment, and a single security infrastructure that supports WebLogic Portal, WebLogic Server, and custom applications.

The ALES service does not replace all of the management functionality provided by the ALDSP. The ALDSP Administrative console (ldconsole) is still used to manage all of the attributes of the various data services aggregated by ALDSP (see Figure 12-1).

Figure 12-1 AlDSP Integration Overview

AlDSP Integration Overview

The AquaLogic Enterprise Security WebLogic SSM enables you to write, deploy, and manage fine-grained policy for controlling access to all WebLogic server application resources, including data services. A specific resource type ld allows a security administrator to represent the data services in the ALES resource hierarchy. Elements of that data service are also converted to the ALES format for evaluation by the ASI authorization engine.

For more information, see the following topics:

Integration Features

AquaLogic Data Service Platform (ALDSP) 2.1 requires WebLogic Server 9.2, 9.1, or 8.1 (with Service Pack 4 or 5) and uses the WLS 9.x or WLS 8.1 SSM. While the ALES framework allows for different security providers to be used with ALDSP, the following providers were certified:

Supported Use-case Scenario

The following use-case scenario is supported when you integrate AquaLogic Enterprise Security with AquaLogic Data Services Platform:

Constraints and Limitations

AquaLogic Enterprise Security integration with ALDSP has the following constraints and limitations:

 


Integration Pre-Requisites

Before you begin, you must ensure that the following pre-requisites are satisfied:

 


Integrating with AquaLogic Data Services Platform: Main Steps

This section describes how to integrate AquaLogic Enterprise Security with AquaLogic Data Services Platform. Once integrated, you can use the AquaLogic Enterprise Security Administration Console to write and deploy a set of authorization and role mapping policies to protect Data Services and elements of those services.

Note: The instructions provided in this section use as an example the ALDSP sample application RTL App that ships with the ALDSP 2.1 software distribution. This procedure is representative of any integration of AquaLogic Enterprise Security with ALDSP.

To integrate AquaLogic Enterprise Security with AquaLogic Data Services Platform, perform the following tasks:

  1. Install the ALES Administration Server, as described in Installing the Administration Server.
  2. Install the WebLogic Server SSM, as described in Installing Security Service Modules. If you use ALSDSP with WebLogic Server 8.1, install the WebLogic Server 8.1 SSM. If you use ALSDSP with WebLogic Server 9.1 or 9.2, install the WebLogic Server 9.x SSM.
  3. Use the ALDSP Administration console to enable the elements to which you want to control access, as described in Enabling Elements for Access Control.
  4. Configure the WebLogic Server SSM, as described in Creating the WebLogic Server SSM Configuration. Note that this procedure varies, depending on whether you are using WLS 8.1 or WLS 9.x.
  5. Bind the WebLogic Server SSM configuration, as described in Binding the SSM Configuration.
  6. Distribute the WebLogic Server SSM configuration, as described in Distributing the SSM Configuration.
  7. Create an instance of the WebLogic Server SSM, as described in Creating an Instance of the Security Service Module.
  8. Enroll the instance of the WebLogic Server SSM, as described in Enrolling the Instance of the Security Service Module.
  9. Create the startWebLogicALES file for WebLogic Server, as described in Creating the WebLogic Server startWebLogicALES File. Note that this procedure varies, depending on whether you are using WLS 8.1 or WLS 9.x.
  10. Create the security configuration file, as described in Creating the security.properties File. Note that this step applies if you are using WLS 8.1 and does not apply if you are using WLS 9.x.
  11. Configure security policies for your data services, as described in Configuring Policy for Data Services.
  12. Replace ld-server-core.jar in <WL_HOME>/liquiddata/lib with the jar in ALDSP 2.5 patch for ALES.
  13. Restart ALDSP.

 


Enabling Elements for Access Control

Before enabling your ALDSP domain for ALES, open the ALDSP Administration console:

  1. Open a browser to visit http://<hostname>:<port>/ldconsole.
  2. Login as Administrator.
  3. Browse to the data services elements that are to be controlled by ALES. For this example, enable the following:
    1. Expand RTLServices/OrderSummaryView and select Security Tab.
    2. Select Secured Elements Tab.
    3. Expand elements and check OrderSummary > OrderDate as an element to be secured. (This allows the element call to go to the security check.)
    4. Do the same to secure CustomerView.ds > CUSTOMER > ORDERS> ORDER_SUMMARY > OrderDate.

 


Creating the WebLogic Server SSM Configuration

Securing ALDSP with ALES employs either the WLS 8.1 SSM or the WLS 9.x SSM. Install the WLS SSM on the machines on which you have installed ALDSP, as described in Installing Security Service Modules.

Next, create a new WLS SSM configuration named aldsprealm. An SSM configuration defines the set of security providers to use for adjudication, authentication, auditing, authorization, role mapping, and credential mapping services.

Refer to Table 12-1 and use the AquaLogic Enterprise Security Administration Console (for the WLS 8.1 SSM) or the WebLogic Server Administration Console (for the WLS 9.x SSM) to configure the security providers listed there. Set the Configuration ID to aldsprealm. For instructions on creating an SSM configuration, see Configuring and Binding a Security Service Module in Installing Security Service Modules and the Console Help.

Table 12-1 Providers for Use in ALDSP Integration 
Provider
Configuration Settings
ASI Adjudication Provider
Accept default settings.
Log4j Auditor
Accept the default settings, and click Create.
Database Authentication Provider
Set the Control Flag to SUFFICIENT, and click Create. For the Details tab settings, except for the Identity Scope, the parameters are populated automatically. Set the Identity Scope to aldspusers, and click Apply.
Note: Even though you set the Identity Scope to aldspusers, you do not actually create the aldspusers identity until you perform the steps in Creating the Realm Resource.
ASI Authorization Provider
On the General tab, accept the default settings, and click Create.
On the Details tab, set the Identity Scope to aldspusers.
WebLogic Credential Mapper Provider
Uncheck the Credential Mapping Deployment Enabled check box, and click Create.
ASI Role Mapping Provider
On the General tab, accept the default settings, and click Create. On the Details tab, set the Identity Scope to aldspusers.

Binding the SSM Configuration

The SSM configuration must be bound to a Service Control Manager (SCM).

To bind the aldsprealm SSM configuration, see "Binding a Security Service Module to a Service Control Manager" in the Console Help.

Distributing the SSM Configuration

The aldsprealm SSM configuration must be distributed.

To distribute the aldsprealm SSM configuration, see "Distributing Configuration" in the Console Help.

Creating an Instance of the Security Service Module

Before starting a WebLogic Server Security Service Module, you must first create an instance of the WebLogic Server Security Service Module using the Create New Instance Wizard.

For information about creating an instance of a WebLogic Server Security Service Module, see Creating an Instance of a Security Service Module in Installing Security Service Modules.

Enrolling the Instance of the Security Service Module

You must have the ALES Administration Server running prior to enrolling the Security Service Module. For information about enrolling a security service module, see Enrolling the Instance of the Security Service Module in Installing Security Service Modules.

Creating the WebLogic Server startWebLogicALES File

Before you can start a WebLogic Server instance that uses BEA AquaLogic Enterprise Security, you must create the startWeblogicALES file based on the startWeblogic file that is located in the WebLogic domain. For information about how to do this, see:

The startWeblogic file for the ALDSP domain for RTLApp is located in:

<bea_home>\<weblogic_home>\samples\domains\ldplatform

Creating the security.properties File

If you are using the WLS 8.1 SSM, create a text file named security.properties and place it in the domain directory. You use this file to define the AquaLogic Enterprise Security realm and the default realm.

# AquaLogic Enterprise Security Configuration File
#
# This file contains AquaLogic Enterprise Security configuration
# properties. By default, the AquaLogic Enterprise Security runtime
# looks for a property file called 'security.properties' in the
# working directory
wles.realm=aldsprealm
wles.default.realm=aldsprealm

Note: This step does not apply if you are using the WLS 9.x SSM

 


Configuring Policy for Data Services

Developing a set of policies typically begins by determining which resources you need to protect and your access control requirements. You then create the identity directory, resources, groups, users, and roles that you will use to write policies to protect those resources. Next you write a set of authorization and role mapping policies to define access control on those resources. Finally, you deploy the set of polices to the WebLogic Server Security Service Module that you use to control access to your data services.

For more information on how to use the ALES Administration Console to write policy, see the Policy Managers Guide and the Console Help. In addition, the ALES Administration Server installation includes a set of sample polices for BEA AquaLogic Data Services Platform, located at BEA_HOME/ales26-admin/examples/policy/aldsp_sample_policy. You can import these sample policies and use them as a starting point for developing a full set of policies for your applications. For information about how to import the sample policies, see the README file in the sample directory and see also Importing Policy Data in the Policy Managers Guide.

This section covers the following topics:

Creating the Identity Directory and Users

This section describes how to use the ALES Administration Console to create an identity directory, groups, and users for an ALDSP application.

Note: This procedure uses aldspusers as the name of the Identity directory; however, you can use a different name.

To create the Identity directory and users:

  1. In the left pane, click Identity. The Identity page displays the name of each directory available.
  2. Click New. The Create Directory dialog box appears.
  3. In the Name text box, type aldspusers and click OK. The aldspusers directory appears in the list of Identity directories.
  4. In the left pane, click Groups. The aldspusers > Groups page displays.
  5. Click New. The Create Group dialog box appears.
  6. Create the LDSampleUsers Group.
  7. Create the sample users used in RTLApp and add them to the LDSampleUsers group:
  8. Jack (password: weblogic)
    Steve (password: weblogic)
    Tim (password: weblogic)

  9. Create ldconsole administrator:
  10. weblogic (password: weblogic)

Configuring Resources and Privilege

This section describes how to use the ALES Administration Console to define the application resources that you will protect using ALES.

To configure resources, perform the following tasks:

Creating the RTLApp Application Resources

Note: You can choose any application name for your ALDSP application.

To create application resources, use the Administration Console to perform the following steps:

  1. Expand the Resources folder, and click Resources. The Resource page displays.
  2. In the Resources page, select the Policy node, and click New. The Create Resource dialog box appears.
  3. In the Name text box, enter aldsprealm, select Binding from the Type drop-down list box, and click Ok. The aldsprealm resource appears under the Policy node.
  4. Select the aldsprealm resource and click Configure. The Configure Resource dialog box appears.
  5. From the Type drop-down list box, select Binding Application, check the Distribution Point and Allow Virtual Resources check boxes, and click Ok.
  6. Refer to Table 12-2 and modify the configuration of the ASI Authorization provider and the ASI Role Mapper provider as described there.
  7. Table 12-2 ALDSP SSM Configuration Modifications
    Security Provider
    Configuration Setting
    ASI Authorization Provider
    1. On the Details tab, set the Application Deployment Parent to //app/policy/aldsprealm and click Apply.
    2. On the Bindings tab, from the Bind drop-down menu, select //app/policy/aldsprealm, and click Bind.
    ASI Role Mapper Provider
    1. On the Details tab, set the Application Deployment Parent to //app/policy/aldsprealm and click Apply.
    2. On the Bindings tab, from the Bind drop-down menu, select //app/policy/aldsprealm, and click Bind.

Creating the ALDSP Resources

Figure 12-2 shows the ALDSP resource tree with all nodes expanded except the RTLApp node. The resources under that RTLApp node are shown in Figure 12-3. You must create the resources shown in Figure 12-2 and Figure 12-3.

Figure 12-2 ALDSP Resource Tree with RTLApp Node Collapsed

ALDSP Resource Tree with RTLApp Node Collapsed

Figure 12-3 ALDSP Resource Tree with RTLApp Node Expanded

ALDSP Resource Tree with RTLApp Node Expanded

Creating the Role Mapping Policies

This section describes how to use the Administration Console to create the role mapping policies that will be used to control access the sample ALDSP application.

Table 12-3 lists the role mapping policies required for the WebLogic domain.

Table 12-3 ALDSP Application Role Mapping Policy
Role Mapping Policy
Description
grant(//role/Everyone, //app/policy/aldsprealm, //sgrp/aldspusers/allusers/) if true;
Creates the role mapping policy necessary for the Everyone role to be used in the aldsprealm Identity directory.
Note: If you do not create the Everyone role mapping policy correctly, none of the policy rules defined in Table
grant(//role/Admin, //app/policy/aldsprealm, //user/aldspusers/weblogic/) if true;
Grants the weblogic user Admin role within the aldsp realm.

To create the role mapping policies, refer to Table 12-3 and perform the following steps.

Note: If you do not create the Everyone role mapping policy correctly, none of the authorization policies defined in Figure 12-4 will work.
  1. Expand the Policy folder in the left pane, and click Role Mapping Policies. The Role Mapping Policies page appears.
  2. Click New. The Create Role Mapping Policy dialog box appears.
  3. Select the Grant radio button.
  4. Select the Roles tab, select Everyone in the Available Roles list box, and click Add.
  5. Select the Resources tab, select aldsprealm, and click Add.
  6. Select the Policy Subjects tab, select allusers in the list box, click Add, and click Ok.

Creating Authorization Policies

This section describes how to use the Administration Console to create authorization policies to protect data services and application resources. Table 12-4 lists the authorization policies required for WebLogic Server, the WebLogic Server console, and the RTL sample application.

Table 12-4 Authorization Policies 
Authorization Policy
Description
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;
Grants Admin Role and/or weblogic user permission to boot the WebLogic Server and perform administrative tasks.
grant(//priv/any, //app/policy/aldsprealm/ldconsole/url/ldconsole, //role/Admin) if true;
This policy gives WebLogic full access to the LD console.
grant(//priv/lookup, //app/policy/aldsprealm/shared/jms, //role/Everyone) if true;
grant(any, //app/policy/aldsprealm/shared/ld, //role/Everyone) if true;
grant(//priv/lookup, [//app/policy/aldsprealm/shared/jdbc,//app/policy/aldsprealm/shared/jndi], //role/Everyone) if true;
grant(//priv/send, //app/policy/aldsprealm/shared/jms, //role/Everyone) if true;
grant(//priv/GET, //app/policy/aldsprealm/console/url/console/login, //role/Everyone) if true;
grant(//priv/reserve, //app/policy/aldsprealm/shared/jdbc, //role/Everyone) if true;
grant([//priv/GET,//priv/POST], //app/policy/aldsprealm/ldconsole/url/ldconsole/login, //role/Everyone) if true;
grant([//priv/GET,//priv/POST], //app/policy/aldsprealm/RTLApp/url/elecws, //role/Everyone) if true;
grant(//priv/GET, //app/policy/aldsprealm/ldconsole/url/ldconsole/images, //role/Everyone) if true;
grant(//priv/GET, [//app/policy/ aldsprealm /B2BDefaultWebAppApplication/url,//app/policy/aldsprealm/RTLApp/url/rtlselfservice/resources,//app/policy/aldsprealm/RTLApp/url/rtlselfservice/wlwdir], //role/Everyone) if true;
Grants permission to those in the role Everyone (includes the anonymous user) to access all of the shared open resources.
grant([//priv/GET,//priv/POST], //app/policy/ aldsprealm /RTLApp/url/rtlselfservice, //user/aldspusers/Steve/) if true;
deny(any, [//app/policy/ aldsprealm /RTLApp/ld/DataServices/RTLServices/OrderSummaryView.ds/ORDER_SUMMARY/OrderDate,//app/policy/aldsprealm/RTLApp/ld/DataServices/RTLServices/CustomerView.ds/CUSTOMER/ORDERS/ORDER_SUMMARY/OrderDate], //user/aldspusers/Steve/) if true;
Denies Steve access to the Order Date element of the Customer View Data Service
deny(any, //app/policy/aldsprealm/RTLApp/ld/DataServices/RTLServices/ProfileView.ds, //user/aldspusers/Jack/) if true;
Denies Jack access to an entire data service
grant(any, [//app/policy/aldsprealm/RTLApp/ejb,//app/policy/aldsprealm/RTLApp/ld,//app/policy/aldsprealm/RTLApp/url/rtlselfservice/pages], [//sgrp/aldspusers/LDSampleUsers/,//role/Admin]) if true;
Grants Admin and Sample Users access to Data Services

Perform the following steps to create the authorization policies listed in Table 12-4.

  1. Expand the Policy folder in the left pane, and click Authorization Policies. The Authorization Policies page appears.
  2. Click New. The Create Authorization Policy dialog box appears.
  3. Select the Grant radio button.
  4. To create the first authorization policy listed in Table 12-4, click the Policy Subjects, select the Admin role from the Roles List box, click Add, and click Ok.
  5. Note: If Table 12-4 lists multiple resources for a single privilege and role, you may define all of the resources in one authorization policy.
  6. Repeat for each of the remaining authorization policies listed in Table 12-4.

Discovering Data Services

When developing policies for use with a Security Service Module, you can use the Discovery mode feature to help define your policy components. Instructions for using Discovery mode are provided in the Resource Discovery section in the Policy Managers Guide.

Distributing Policy and SSM Configuration

Distribute policy and SSM configuration to the WebLogic Server SSM.

For information on how to distribute policy and SSM configuration, see "Deployment" in the Console Help. Be sure to verify the results of your distribution.

Starting the WebLogic Server

To start a WebLogic Server instance, perform the following steps:

  1. Open a shell (command prompt) on the machine on which you created the domain.
  2. Change to the ALDSP sample domain directory: <bea_home>\<weblogic_home>\samples\domains\ldplatform
  3. Run one of the following scripts:
  4. On Windows: startWebLogicALES.cmd

    On UNIX: startWeblogicALES.sh

Accessing the ALDSP Application

To access the RTLApp running on an ALDSP server:

  1. Open browser to visit 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 12-4).
  2. Figure 12-4 Authentication Page


    Authentication Page

  3. Set username as Steve by dragging over link, then click Login button. Your client should be granted access to the Profile Page (see Figure 12-5).
  4. Figure 12-5 Profile Page


    Profile Page

  5. Select Open Orders Page from top menu. Open orders should be visible (see Figure 12-6). Order Data should have "ACCESS DENIED".
  6. Figure 12-6 Open Orders Page


    Open Orders Page

 


Pre- and Post-Processing Data Redaction Solutions

ALES 2.6 provides mechanisms to redact ALDSP data both before and after the ALDSP Engine processes a client query request.

Redacting ALDSP data before the ALDSP Engine processes a client query request is called pre-processing. Redacting ALDSP data after the ALDSP Engine processes a client query request is called post-processing. This section describes both solutions. This section begins with an overview of the two solutions.

Overview of Pre- and Post-Processing Data Redaction Solutions

In the pre-processing data redaction solution, the result of the data-retrieving request is protected by adding security constraints before the XQuery function is executed. That is, before the ALDSP Engine processes a client query request, an ALES security constraint is created and inserted into the client query. Pre-processing may return either predicates to modify the original query, or provide a substitute function name.

ALDSP uses the WLS security framework to control access to the data services. When a user calls a function of a data service, the request is first authorized by WLS. ALDSP provides a plug-in mechanism to get additional obligations from the authorization response that is returned from the WLS security framework. These obligations are returned only when the authorization decision is is true, and are used to modify the original request to add additional restraints before it calls to the data services.

Because this approach is performed before pushing the query to the data sources, it is called pre-processing.

The pre-processing data redaction solution provides an ALES-specific plug-in. This plug-in calls the Java API to authorize the user request, then gets the response attributes from the authorization response and returns them as obligations.

Consider the sequence of events shown in Figure 12-7:

  1. The ALDSP engine receives a data service client request and invokes the ALES plug-in.
  2. The ALES plug-in calls the ALES Java API for authorization. The authorization decision may return additional predicates as responses.
  3. The ALES plug-in returns the authorization decision and responses to the ALDSP engine.
  4. The ALDSP engine adds the predicates, or a function name, or both to the original query, and calls the data service
  5. Return the result to the ALDSP engine.
  6. Return the result to the data service client.
  7. Figure 12-7 Overview of Pre-Processing Solution


    Overview of Pre-Processing Solution

In the post-processing data redaction solution, the ALDSP engine retrieves the data from the data service and then invokes the relevant security XQuery function. The decision about what data to retrieve is already made, and the issue is whether to grant access and return the data. Because this approach processes the result-set after querying the data, it is called post-processing.

This approach may not be suitable for fast operations or very large data sets.

Consider the sequence of events shown in Figure 12-8:

  1. The data service client sends a data retrieving request to ALDSP.
  2. The ALDSP engine retrieves the data from the data service (i.e. Data Service 1, Data Service 2).
  3. Before returning the data, ALDSP invokes the relevant security XQuery function for the data element.
  4. The security XQuery function invokes one of the ALES Java methods, passing in the resource name, one or more attribute names, and values for those attributes.
  5. The ALES Java method invokes the WLS SSM and gets the result of authorization and optional responses defined in the queries.
  6. The ALES Java method returns authorization decisions and a set of responses to the security XQuery function.
  7. The XQuery function returns the decision. The function can use the responses to make the decision. For example, the policy decision may be true, but based on the responses the function returns false.
  8. Figure 12-8 Overview of the Post-Processing Solution


    Overview of the Post-Processing Solution

How the Pre-Processing Solution Integrates with ALDSP

The ALES-specific function access provider plug-in com.bea.security.ales.aldsp.ALESFunctionAccessProvider calls the Java SSM to do authorization, gets the response attributes, and then returns the response attributes as obligations to ALDSP engine. The ALES policy file needs to include policies with the response attributes appropriately defined.

For example, consider a policy such as the following:

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 permits user system to perform ALDSP_QUERY privilege on the data service OrderView's function getOrders, and returns the attribute aldsp_replacement_function, with a value getOrdersThatAmountLessThan1000 if the authorization decision is true.

When a data service client calls the getOrders function, ALDSP will call the ALES-specific implementations to do authorization. This policy will be evaluated and return an attribute aldsp_replacement_function with a value getOrdersThatAmountLessThan1000 if the authorization decision is true.

The ALES plug-in returns this attribute and value as obligations to the ALDSP engine.

Finally, the ALDSP engine calls the replacement function getOrdersThatAmountLessThan1000 instead of the original. This new function should have exactly the same signature; no additional verifications are performed at runtime.

Types of Pre-processing Obligations

ALDSP supports two types of obligations. You can use them alone or together.

Replacement Function

The replacement function is called instead of the original user-requested function. For example, assume that the user requests to call a function named "getOrders". After authorization, a replacement function "getOrdersThatAmountLessThan1000" is returned, and this function is called to return a lesser result than the original.

XQuery expression

The returned XQuery expression is applied to the invoked function, or its replacement, as a predicate. There may be multiple predicates returned, and they will all be applied to the function.
For example, assume that the user requests to call a function named "getOrders". After authorization, an XQuery expression "./order/amount < 1000" is returned. This expression is applied to the requested function "getOrders", so that only a subset of orders matching the criteria provided in the obligation will be returned.

Predefined ALES Privilege is Required

ALES defines the privilege ALDSP_QUERY for use in policies. You must use this privilege for any policy for which you want to apply pre-processing.

Predefined ALES Response Attribute Names Are Required

ALES defines three response attribute names for you to use with a replacement function or XQuery expression. The attribute names are all in lower case.

These attribute names can be returned by the ALES evaluation functions report and report_as, and can also can be returned by user-defined evaluation functions.

aldsp_replacement_function

Provide a value for this attribute. The value will be used as a function name that ALDSP calls to instead of the original one. The function name should be fully qualified, including the namespace:
report_as("aldsp_replacement_function", "ld:DataServices/RTLServices/OrderView:getOpenOrdersByCustID")

aldsp_xquery_expression

This attribute defines an XQuery expression. For example, you can define expressions such as ./order/amount < 1000, or ./order/amount < 1000 OR ./order/customerid eq `CUSTOMER4'.
These expressions will be used as a filter in ALDSP. The value of the attribute can be a list. In this case, ALDSP will apply the AND operator to the list values. if report_as("aldsp_xquery_expression", "./order/amount < 1000")

aldsp_namespace_binding

This attribute defines the namespace mapping for prefixes, and is used in XQuery expressions. For example, if the following xquery expression were returned: ./f1:region eq 'west', the namespace map should contain the following entry mapping the string prefix to the string namespace (for example, {"f1","http://com.bea.security"}):
report_as("aldsp_namespace_binding", "f1=http://com.bea.security") and report_as("aldsp_xquery_expression", "./f1:region eq 'west'")

How to Use the Pre-Processing Data Redaction Solution

Before you can use the pre-processing data redaction solution, you must integrate ALES with ALDSP, as described in TBS.

After you have done this, then:

These tasks are described in the sections that follow.

Modify set-wls-env Script to Enable Pre-Processing Solution

You need to modify the file set-wls-env, which is in the WLS SSM instance directory. To do this:

  1. Navigate to the WLS SSM instance directory, and edit set-wls-env.bat.
  2. Add pre-processing jar file (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.
  4. Save your changes.

Write Replacement Function

If you are going to use replacement functions to protect data services, implement the replacement function on the target data service. This replacement function must have the same signature (return type, and number and type of parameters) as the replaced function.

For example, if you are going to restrict OrderView.getOrders to return only the orders that total less than $1000, write an XQuery function (named something such as getOrdersThatAmountLessThan1000) to implement the restriction. This function must have the same return type, and same number and type of parameters as getOrders.

Define Policies for Replacement Function

If you are going to use a replacement function to protect data services, define a policy that allows someone to access the target data service's function. (If you have an existing policy, you only need modify it.) Return a named attribute aldsp_replacement_function, the value of which is the replacement function. There are no additional access control checks performed for the replaced function.

For example, to use the function getOrdersThatAmountLessThan100 to replace the function getOrders when an anonymous user calls getOrders, define a policy such as:

grant (
 //priv/ALDSP_QUERY,
 //app/policy/RTLApp/ld/DataServices/RTLServices/OrderView.ds/getOrders,
 //user/asi/anonymous/
) if
report_as("aldsp_replacement_function","getOrdersThatAmountLessThan1000")

Define Policies for XQuery Expression

If you are going to use an XQuery expression to protect data services, define a policy that allows someone to access the target data service's function. Return a named attribute aldsp_xquery_expression, the value of which is the desired XQuery expression.

For example, to restrict the function getOrders to return orders that amount less than $1000 if an anonymous user calls it, define a policy such as:

grant (
 //priv/ALDSP_QUERY,
 //app/policy/RTLApp/ld/DataServices/RTLServices/OrderView.ds/getOrders,
 //user/asi/anonymous/
) if report_as("aldsp_xquery_expression", "./order/amount < 1000")

Define Namespace Bindings

If namespaces are used in an XQuery expression, you must define namespace bindings. (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 < 1000")

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.security")

How the Post-Processing Solution Integrates With ALDSP

The ALDSP security XQuery functions, which are described in Creating a Security XQuery Function, enable you to specify custom security policies that can be applied to data elements. In particular, security XQuery functions are useful for creating data-driven policies (policies based on data values). For example, you can block access to an element if the order amount exceeds a given threshold.

ALES 2.6 provides two ALES Java methods that you can call from within your security XQuery function. (The ALES Java methods are used as XFL functions.) These ALES Java methods then invoke the WLS SSM, which determines whether the access request should be granted.

The first ALES Java function returns a Boolean value to indicate the result of the access permission decision. The second ALES Java function returns a string array that contains the result of the access permission decision, and response attributes. You can then use the response attributes to implement some specific logic in your security XQuery function.

You can use the ALES Java methods in place of, or in addition to, the following ALDSP access control function extensions to the BEA implementation of XQuery:

For example, consider the typical security XQuery function usage shown in Listing 12-1. In this instance, you might replace the function fn-bea:is-access-allowed with an ALES Java method.

Listing 12-1 Typical Security XQuery Function Usage

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, it is not XML schema-neutral. Therefore, you create the security XQuery function based on the custom data service schema.
Note: One limitation of the custom security XQuery function is that it must be created in Workshop, instead of in ALDSP console. A custom XQuery security function cannot be created from the ALDSP console, because the console compiler does not access the custom functions used in it.

ALES Java Methods

ALES 2.6 includes the following two Java methods, both of which are in the class named com.bea.security.ales.aldsp.AccessController.

is_access_allowed

public static boolean is_access_allowed(String resource, String[] attributeNames, String[] attributeValues)

is_access_allowed_with_response_attributes

public static String[] is_access_allowed_with_response_attributes (String resource, String[] attributeNames, String[] attributeValues)

ALES Java Method Parameter Format

The ALES Java methods have three parameters:

Note: If the data type of the attribute value is not string, convert it to string via fn:string().
Note: In addition, ALES attributes support only integer numbers. If the attribute value is a decimal number, truncate it by using fn:round() before converting to string.

ALES Java Method Return Values

If you use the ALES is_access_allowed method, the boolean return value represents the access permission, either true or false. You can return this boolean value directly to the security XQuery function, or do some additional operation based on the result.

If you use the is_access_allowed_with_response_attributes method, the first element of the array is the access permission decision, either true or false.

The other array elements represent the response attributes. One example is (`true', `ALESResponse', `ran1', `rav1_1', `rav1_2', `ALESResponse', `ran2', `rav2'), where:

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

In addition, you can use the response attribute value to implement additional logic, as described in How to Write Policies That Return Response Attributes as ALDSP Obligations.

How to Write Policies That Return Response Attributes as ALDSP Obligations

There is nothing unique about the ALES policy that you create to protect an ALDSP resource, beyond the general requirement that the resource name, attribute names, and attribute values you specify in the ALES Java method must correlate with the policy. The general steps you perform to create a policy are described in How to Integrate the ALES Java Methods.

However, 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").

Then, in your security XQuery function, you can test the return response attributes. Remember that the first element of the array is the access permission decision, either true or false. For example, consider Figure 12-9:

Figure 12-9 Testing Return Response Attributes

Testing Return Response Attributes

The report_as function loads a named response attribute with a specified value. The value may be an attribute, a constant or a string literal. You can specify multiple values, in which case the response attribute is returned as a list.

While the report() and report_as()functions are run when the policy is evaluated, they are not really constraints of the policy. Data reported by the functions are returned only if the adjudicated authorization decision agrees with the policy. This means the attributes returned from GRANT policies are not passed to the caller unless the overall access decision is PERMIT.

How to Write and Configure the Security XQuery Function

Use Workshop, not the ALDSP console, to add a new XQuery function as the security XQuery function in the ALDSP application, as follows:

  1. Import the ALES Java method via an XFL library in the current Workshop application, as described in How to Integrate the ALES Java Methods.
  2. The XQuery Function Library (XFL) is a facility for providing auxiliary functions across multiple data services. The ALES Java method is an XFL function. You import it from a Java class shipped by ALES.

  3. In order to get the elements of the data service, 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. Inside of the XQuery Function, specify all of the attributes used in the ALES policies that protect the resource, and two string arrays for names and values. A detailed example is provided in ALES Security XQuery Function Integration Example.
  6. Note: 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.
    Note: 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.

How to Integrate 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 Integrating with AquaLogic Data Services Platform: Main Steps.

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 the jar files 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, select the node of the data service project, right click and select Import Source Metadata.
    3. Select Java Function as the Data Source Type, and click Next.
    4. Locate the jar file alesxfl.jar, expand it, 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. Add a new XQuery function as the security XQuery function in the ALDSP application by using Workshop, not the ALDSP console:
    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. Inside of 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 Integration Example.

  4. Specify which element of the data service is protected in the ALDSP configuration file:
    1. Open the configuration file of the ALDSP application.
    2. The file location is <ALDSP_DOMAIN>/liquiddata.

      The file name is <ALDSP_APPLICATION_NAME> LDConfig.xml.

    3. Find the element (for example <con:DSConfiguration> )whose id is the data service name to be protected.
    4. Under the element you found in Step b., add the element <con:AdminResources>, such as the following:
    5. <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 Integration Example

This example is based on the RTLApp that is shipped by ALDSP.

In this example, 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. Log in to the ALES Administration console (for example, https://localhost:7010/asi).
    2. Define a resource named datacontrol/orderview under the resource node RTLApp, as shown in Figure 12-10.
    3. Figure 12-10 ALDSP Resource Tree

ALDSP Resource Tree

    1. Define a dynamic attribute named totalorderamount whose type is integer, as shown in Figure 12-11.
    2. Figure 12-11 ALDSP Dynamic Attribute

ALDSP Dynamic Attribute

    1. Define an authorization policy for the resource as shown in Figure 12-12.
    2. The privilege is view. The Subject is LDSampleUsers. The constraint is totalorderamount < 1000. Response attributes are returned via report_as("class", "A")".

      Figure 12-12 ALDSP Authorization Policy

ALDSP Authorization Policy

    1. Distribute the policy change.
  1. Import the ALES Java function as an XFL library in the current Workshop application:
    1. Copy the jar files 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 on the DataServices folder and select Import Source Metadata from the pop-up menu, as shown in Figure 12-13.
    3. Figure 12-13 Import ALES Java Function

 Import ALES Java Function

    1. Select Java Function as the Data Source Type, and click Next.
    2. Locate the jar file alesxfl.jar, expand it, and select the class com.bea.security.ales.aldsp.AccessController.class.
    3. In the next page, select the method is_access_allowed_with_response_attributes, and finish the wizard.
  1. Add a security XQuery function in the XFL file library.xfl, as shown in Figure 12-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 atttibute class is not found, return false.
    • Line 33 to 46: Check if the response attribute class contains the value A.
    • Figure 12-14 Security XQuery Function

Security XQuery Function

  1. Specify which element of the data service is protected in the ALDSP configuration file:
    1. Open the configuration file of the ALDSP application.
    2. The file location is BEA_HOME/weblogic81/samples/domains/ldplatform/liquiddata.

      The file name is RTLAppLDConfig.xml.

    3. Find the OrderView configuration item:
    4. <con:DSConfiguration id="ld:DataServices/RTLServices/OrderView.ds">

    5. Add the following XML element under the <con:DSConfiguration> element:
    6. <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>

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

  3. Restart the Weblogic Server.
  4. Open the web application RTLSelfService (for example, http://localhost:7001/RTLSelfService), and select the user Steve to log in, as shown in Figure 12-15.
  5. Figure 12-15 Avitek Login Page

Avitek Login Page

  1. 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 12-16.
  2. Figure 12-16 Search Results with ALES Protection

Search Results with ALES Protection


  Back to Top       Previous  Next