Roles
Roles
August 2015
Documentation for security architects and administrators
that describes how to use security roles and policies to
determine who can access resources in a WebLogic Server
12.1.3 domain.
Oracle Fusion Middleware Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3,
12c (12.1.3)
E41904-02
Copyright © 2007, 2015, Oracle and/or its affiliates. All rights reserved.
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software or related documentation that is delivered to the U.S. Government or anyone licensing it
on behalf of the U.S. Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software,
any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users
are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and
agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and
adaptation of the programs, including any operating system, integrated software, any programs installed on
the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to
the programs. No other rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management
applications. It is not developed or intended for use in any inherently dangerous applications, including
applications that may create a risk of personal injury. If you use this software or hardware in dangerous
applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other
measures to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages
caused by use of this software or hardware in dangerous applications.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks
are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD,
Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced
Micro Devices. UNIX is a registered trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content,
products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and
expressly disclaim all warranties of any kind with respect to third-party content, products, and services
unless otherwise set forth in an applicable agreement between you and Oracle. Oracle Corporation and its
affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of
third-party content, products, or services, except as set forth in an applicable agreement between you and
Oracle.
Contents
iii
3.10 Server Resources ......................................................................................................................... 3-8
3.10.1 Permissions for the weblogic.Server Command and the Node Manager ................... 3-9
3.10.1.1 Permissions for Using the weblogic.Server Command .......................................... 3-9
3.10.1.2 Permissions for Using the Node Manager................................................................ 3-9
3.11 URL Resources ............................................................................................................................ 3-9
3.12 Web Service Resources............................................................................................................ 3-10
3.13 Work Context Resources......................................................................................................... 3-11
3.14 Coherence Resources............................................................................................................... 3-11
5 Security Policies
5.1 Security Policy Storage and Prerequisites for Use ................................................................. 5-1
5.2 Default Root Level Security Policies ........................................................................................ 5-2
5.3 Security Policy Conditions ........................................................................................................ 5-3
5.3.1 Basic Policy Conditions....................................................................................................... 5-3
5.3.2 Date and Time Policy Conditions...................................................................................... 5-4
5.3.3 Context Element Policy Conditions .................................................................................. 5-5
5.4 Protected Public Interfaces ........................................................................................................ 5-5
5.5 Using the Administration Console to Manage Security Policies ......................................... 5-6
iv
6.5 Default Global Roles................................................................................................................... 6-3
6.6 Security Role Conditions ........................................................................................................... 6-5
6.6.1 Basic Role Conditions.......................................................................................................... 6-5
6.6.2 Date and Time Role Conditions......................................................................................... 6-6
6.6.3 Context Element Role Conditions ..................................................................................... 6-6
6.7 Using the Administration Console to Manage Users, Groups, and Roles ......................... 6-7
v
A.8 Rule and Policy-Combining Algorithm................................................................................ A-24
vi
Preface
This preface describes the document accessibility features and conventions used in this
guide—Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3.
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle
Accessibility Program website at
http://www.oracle.com/pls/topic/lookup?ctx=acc&id=docacc.
Conventions
The following text conventions are used in this document:
Convention Meaning
boldface Boldface type indicates graphical user interface elements associated
with an action, or terms defined in text or the glossary.
italic Italic type indicates book titles, emphasis, or placeholder variables for
which you supply particular values.
monospace Monospace type indicates commands within a paragraph, URLs, code
in examples, text that appears on the screen, or text that you enter.
vii
viii
1
Introduction and Roadmap
1
This chapter describes the contents and organization of this guide—Securing Resources
[2]
Using Roles and Policies for Oracle WebLogic Server 12.1.3. The WebLogic Security Service
combines several layers of security features to prevent unauthorized access to your
WebLogic Server domains. This document describes using roles and policies to
determine who can access resources in a domain. The roles and policies feature fulfills
the same function as the familiar Access Control List (ACL), but offers an
improvement over ACLs: an ACL is static while roles and policies specify conditions
under which users can access resources, and these conditions are evaluated at run
time.
This chapter includes the following sections:
■ Document Scope and Audience
■ Guide to This Document
■ Related Information
■ New and Changed Features for This Release
1-2 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
New and Changed Features for This Release
1-4 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
2
Understanding WebLogic Resource Security
2
This chapter describes terms and concepts, provides a workflow summary, and
[3]
outlines the main steps for securing WebLogic resources for WebLogic Server 12.1.3.
This chapter includes the following sections:
■ Overview of Securing WebLogic Resources
■ Designing Roles and Policies for WebLogic Resources: Main Steps
1. Before creating security policies and roles, Administrators statically assign users to
groups, which can represent organizational boundaries. The same user can be a
member of multiple groups. Figure 2–1 shows three groups with two users each.
User 1 and User 3 are members of multiple groups.
Oracle recommends assigning users to groups because doing so increases
efficiency for administrators who work with many users.
2. Administrators create a security role based on their organization's established
business procedures. The security role consists of one or more conditions, which
specify the circumstances under which a particular user, group, or other role
should be granted the security role.
3. At run time, the Security Service compares the groups against the role condition(s)
to determine whether users in the group should be dynamically granted a security
role. This process of comparing groups to roles is called role mapping. In
Figure 2–1, Group 2 is the only group that is granted a security role.
Individual users can also be granted a security role, but this is a less typical
practice.
4. Administrators create a security policy based on their organization's established
business procedures. The security policy consists of one or more policy conditions
which specify the circumstances under which a particular security role should be
granted access to a WebLogic resource.
2-2 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Overview of Securing WebLogic Resources
5. At run time, the WebLogic Security Service uses the security policy to determine
whether access to the protected WebLogic resource should be granted. Only users
who are members of the group that is granted the security role can access the
WebLogic resource. In Figure 2–1, User 3 and User 6 can access the protected
WebLogic resource because they are members of Group 2, and Group 2 is granted
the necessary security role.
You can see a visual representation of resource and policy hierarchies in the WebLogic
Server Administration Console on the security realm's Roles and Policies: Policies
page. For information about accessing this page, see "Create policies for resource
instances" in the Oracle WebLogic Server Administration Console Online Help.
2.2 Designing Roles and Policies for WebLogic Resources: Main Steps
To design a set of roles and policies that can secure the resources in your domain:
1. List all of the resources that will be in your domain and determine which ones
should be accessed only by specific users or groups.
To see a list of all the types of resources that could be in any given domain, see
Chapter 3, "Resource Types You Can Secure with Policies."
For planning purposes, organize the resources into the following categories:
■ Server resources, administrative resources, and JMX resources. Server
resources determine who can start and stop server instances. Administrative
resources determine who can complete such tasks as unlocking users who
have been locked out of their accounts, uploading files (used during
deployment), and viewing the domain and server logs. JMX resources
determine who can change the configuration of servers, clusters, machines,
and other components that are defined in the domain's configuration
document (config.xml).
For these tasks, WebLogic Server already provides a detailed, layered security
scheme that grants different types of access to eight security roles (Admin,
Deployer, Operator, Monitor, Anonymous, AppTester,
CrossDomainConnector, AdminChannelUser). For most environments, this
security scheme is adequate and only requires you to assign users to the eight
default security roles appropriately (see step 3).
2-4 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Designing Roles and Policies for WebLogic Resources: Main Steps
While it is possible to modify some parts of this layered security scheme, such
modifications are usually not needed and require careful planning to maintain
consistency between the different layers. See Section 3.1, "Administrative
Resources," Section 3.10, "Server Resources," and Section 3.9, "JMX Resources."
■ Web application resources and EJB resources, which determine who can access
the Web applications and EJBs that you deploy in your domain.
The Java EE platform already provides a standard model for securing Web
applications and EJBs. In this standard model, developers define role
mappings and policies in the Web application or EJB deployment descriptors.
You can use the standard model or you can use the WebLogic Server
Administration Console to define polices and roles, which offers unified and
dynamic security management. See Chapter 4, "Options for Securing Web
Application and EJB Resources."
■ All other resources, which determine who can access the business logic and
business content in the enterprise applications and other modules that you
deploy or otherwise configure for the domain.
By default, these resources are not protected by policies; you must define
policies to determine who can access them.
2. For each type of resource that you want to secure, determine if you need to create
root-level policies, scoped policies, or a combination of both.
A root-level policy applies to all instances of a resource type. For example, if you
define a root-level policy for the Web Services resource type, then the policy will
apply to all Web Services in your domain.
A scoped policy applies to a specific resource instance and overrides a root-level
policy.
See Chapter 5, "Security Policies."
3. Analyze your users and the resources that you want them to access. Organize
users into security groups and roles as follows:
■ Add any user that you want to start and stop servers or to engage in other
administrative tasks to one of the eight default global roles. The WebLogic
Server security scheme allows only the eight global roles to perform many of
these tasks.
■ For other users (that you do not want to access administrative or server
resources but you do want to access other resources for which you have
defined policies), create additional security groups and roles. Because role
membership can be granted at run time, you can place users or groups in roles
based on business rules or the context of the request.
You can create global roles, which can be used in any policy, or scoped roles,
which can be used only in a policy for a specific resource instance.
See Chapter 6, "Users, Groups, And Security Roles."
4. Use the WebLogic Server Administration Console to create users, groups, roles,
and policies:
a. To create the users and groups, see "Manage users and groups" in Oracle
WebLogic Server Administration Console Online Help.
b. To create security roles, see "Manage security roles" in Oracle WebLogic Server
Administration Console Online Help.
2.2.2 Best Practices: Configure Entitlements Caching When Using WebLogic Providers
The WebLogic Authorization provider (DefaultAuthorizer) and the WebLogic Role
Mapping provider (DefaultRoleMapper) improve performance by caching the roles,
predicates, and resource data that they look up. If you modify your realm to use these
WebLogic providers, you can configure the maximum number of items that they store
in the caches.
By default, the Weblogic Authorization and Role Mapping providers store the
following number of items in each cache:
■ 2000 items in the roles cache
This cache contains the name of each role that has been looked up and the policy
that protects it.
■ 200 items in the predicates cache
This cache contains each predicate that the WebLogic entitlements engine has
looked up.
■ 5000 items in the resources cache
2-6 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Designing Roles and Policies for WebLogic Resources: Main Steps
This cache contains the name of each resource that has been looked up and the
policy that protects it.
If a cache exceeds its maximum size, the WebLogic entitlements engine removes the
least recently used (LRU) item from the cache.
If the applications on a WebLogic Server instance use more than 2000 roles or 5000
resources, consider increasing the cache sizes. (The WebLogic providers include less
than 50 predicates, so there is no need to increase the size of this cache.)
To change the maximum number of items that a cache contains, pass one of the
following system properties in the java startup command for a WebLogic Server
instance:
■ -Dweblogic.entitlement.engine.cache.max_role_count=max-roles
where max-roles is the maximum number of roles that you want to cache.
■ -Dweblogic.entitlement.engine.cache.max_predicate_count=max-predicates
where max-predicates is the maximum number of predicates that you want to
cache.
■ -Dweblogic.entitlement.engine.cache.max_resource_count=max-resources
where max_resource_count is the maximum number of resources that you want to
cache.
By default, the WebLogic providers add items to the cache as they use them. With this
configuration, the initial lookup of entitlement data takes longer than subsequent
lookups. You can, however, decrease the amount of time needed for an initial lookup
by configuring a WebLogic Server instance to load the caches during its startup cycle.
To do so, pass the following system property to the server's java startup command:
-Dweblogic.entitlement.engine.cache.preload=true
For example:
java -Dweblogic.entitlement.engine.cache.max_role_count=6001
-Dweblogic.entitlement.engine.cache.max_resource_count=3001
-Dweblogic.entitlement.engine.cache.preload=true weblogic.Server
2-8 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
3
Resource Types You Can Secure with Policies
3
[4This
] chapter describes the types of resources that you can secure using policies in
WebLogic Server 12.1.3.
This chapter includes the following sections:
■ Administrative Resources
■ Application Resources
■ COM Resources
■ EJB Resources
■ Enterprise Information Systems (EIS) Resources
■ Java DataBase Connectivity (JDBC) Resources
■ Java Messaging Service (JMS) Resources
■ Java Naming and Directory Interface (JNDI) Resources
■ JMX Resources
■ Server Resources
■ URL Resources
■ Web Service Resources
■ Work Context Resources
■ Coherence Resources
Table 3–1 describes the administrative activities that administrative resources protect
and which of these activities are also protected by additional JMX resources. For
activities that are protected by multiple resources, the default policy in the JMX
resource duplicates the protections in the Administrative resource.
3-2 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
COM Resources
Table 3–1 (Cont.) Activities And Default Policies For Administrative Resources
Also
Protected By a
Default Policy JMX
Administrative Activities Allows These Roles Resource?
Unlock users who have been locked out of their Admin Yes
accounts.
3-4 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Java Messaging Service (JMS) Resources
3-6 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
JMX Resources
Failure to use the Operator global role or a security role nested within this default
global role may result in inconsistent behavior by the WebLogic Security Service.
■ For a security policy on a deployable resource (such as an Web application or EJB
module, Connector module, or startup/shutdown class), use the Deployer global
role.
3-8 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
URL Resources
3.10.1 Permissions for the weblogic.Server Command and the Node Manager
WebLogic Server provides two ways to start and shut down WebLogic Server
instances (servers): the weblogic.Server command and the Node Manager. Because
the underlying components for the weblogic.Server command and the Node
Manager are different, the two commands use different authorization methods.
URL pattern, or that protects only specific HTTP methods. These resources exist
within a hierarchy of resources, and at the top of the hierarchy is an application
resource. See Section 2.1.1.2, "Protecting a Hierarchy of Resources."
Because the Java EE platform standardizes Web application security in deployment
descriptors, WebLogic Server integrates this standard mechanism with its Security
Service to give you a choice of techniques for securing Web application resources. For
more information, see Chapter 4, "Options for Securing Web Application and EJB
Resources."
3-10 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Coherence Resources
Figure 3–4 Hierarchy of Resources for Web Service with EJB Implementation
For information on using Java annotations to secure Web Services, see "Configuring
Message-Level Security" in Securing WebLogic Web Services for Oracle WebLogic Server.
The default authorization policy allows everybody access to all Coherence resources.
To define policies and roles on caches and services, the names of the caches and
services must be known. In some cases, the cache configuration file in a Coherence
Grid ARchive (GAR) module can be inspected to discover cache and service names.
However, there are some configurations that allow applications to use different names
to refer to the same cache. Always consult an application’s developers or architects to
be certain of the cache and service names used by an application.
3-12 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
4
Options for Securing Web Application and EJB
4
Resources
[5This
] chapter describes the options that WebLogic Server 12.1.3 offers for securing your
Web application and EJB resources, including the Java EE standard model.
In the Java EE standard model, you can secure Web applications and EJBs in either of
the following ways:
■ Declaratively, using deployment descriptors or metadata annotations.
For EJB 3.x, EJB security metadata annotations can be specified directly in the EJB
bean class to specify the roles that are allowed to invoke all, or a subset, of the
EJB's methods.
■ Programmatically, as described in Using Programmatic Security With EJBs.
WebLogic Server supports the use of the EJBContext.isCallerInRole and
EJBContext.getCallerPrincipal methods, and the use of the security-role-ref
element in deployment descriptors, to implement programmatic authorization in
EJBs.
Because this Java EE standard may be too inflexible for some environments, WebLogic
Server also offers a choice of other, more flexible models in addition to supporting the
Java EE standard.
Note: The instructions for EJB resources provided in this section also
apply to Message-Driven Beans (MDBs).
4-2 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Comparison of Security Models for Web Applications and EJBs
You can use metadata annotations in conjunctions with deployment descriptor- and
WebLogic Server Administration Console-based mechanisms. If you do so, note the
following:
■ In case of conflict, deployment descriptor elements always override their
annotation counterparts. For example, if the annotation specifies Deny All for a
method and the deployment descriptor specifies that the "Developer" role has
access to that method, the "Developer" role does have access to the method.
■ If you specify Custom Roles in the WebLogic Server Administration Console, any
role mappings in the deployment descriptors or annotations are ignored.
See Securing Access to the EJB for an example simple stateless session EJB that uses all
of the security-related annotations.
4-4 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Comparison of Security Models for Web Applications and EJBs
principals (groups or users) in the deployment descriptors exist and are mapped
properly in the security realm.
4-6 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Understanding the Advanced Security Model
and policies defined in the deployment descriptors, or use only roles and policies
defined in the realm's security providers, or import security data from deployment
descriptors into the realm's authorization provider or role mapping provider
databases.
Oracle provides the ability to import security data for the following tasks:
– As a step toward migrating to full security administration using the WebLogic
Server Administration Console. The import feature assumes that you want to
use the WebLogic Server Administration Console exclusively to secure Web
applications and EJBs, but you want to use the security data in deployment
descriptors as a baseline.
– To reinitialize security configurations for Web application and EJB resources to
their original state, as specified in the deployment descriptors.
Once the data is imported, you can use the WebLogic Server Administration
Console to modify the security data.
■ (Not applicable if you configure this model to use only roles and policies defined
in the realm's security providers.) Combine roles in parent applications with roles
in the Web application or EJB, or override roles in parent applications.
If you change the configuration of this model, the change applies to all Web
applications and EJBs that use this model. For example, you configure the Advanced
model to perform security checks for all URLs and methods, and then you deploy
several EJBs and configure them to use the Advanced model. The EJB container will
request a security check any time a client tries to invoke any method in any of the
several EJBs. If you then modify the Advance model to perform security checks only
for the EJB methods that are protected in deployment descriptors, then the EJB
container immediately begins to request security checks only for protected methods
for the several EJBs.
The following sections describe the settings for the Advanced security model:
■ Section 4.3.1, "Understanding the Check Roles and Policies Setting"
■ Section 4.3.2, "Understanding the When Deploying Web Applications or EJBs
Setting"
■ Section 4.3.3, "How the Check Roles and Policies and When Deploying Web
Applications or EJBs Settings Interact"
■ Section 4.3.4, "Understanding the Combined Role Mapping Enabled Setting"
■ To perform security checks on all Web application and EJB resources, regardless of
whether there are any security settings in the deployment descriptors and
annotations for these WebLogic resources, select All Web applications and EJBs.
Note: With this selection, you can also configure the When
Deploying Web Applications or EJBs setting.
Note: This setting is valid only if you have set Check Roles and
Policies to All Web applications and EJBs.
4-8 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Understanding the Advanced Security Model
■ To import security data from the deployment descriptors and annotations., select
Initialize Roles and Policies from DD.
4.3.3 How the Check Roles and Policies and When Deploying Web Applications or
EJBs Settings Interact
Table 4–6 shows how to achieve the behavior you want from the WebLogic Security
Service using different combinations of the Check Roles and Policies and When
Deploying Web Applications and EJBs settings.
Table 4–6 Interaction Between the Check Roles and Policies Setting and the When Deploying Web
Applications or EJBs Setting
and set When
then set Check Deploying Web
If you want to control and set security for Web application and Roles and Policies Applications or
security for... EJB resources... to... EJBs to...
All Web application and using only the WebLogic Server All Web applications Ignore Roles and
EJB resources Administration Console and EJBs Policies from DD
All Web application and by copying or reinitializing security data All Web applications Initialize Roles and
EJB resources from the deployment descriptors and and EJBs Policies from DD
annotations into the configured
Authorization and Role Mapping
providers' databases when the Web
application or EJB resource is deployed,
then use one of the other techniques to
modify security roles and security policies
Note: Security data is copied/reinitialized
each time the Web application or EJB
resource is deployed.
Only on Web applications using only the deployment descriptors and Web applications --
and EJB methods that are annotations and EJBs Protected
specified in the in DD
deployment descriptors
and annotations (default
configuration)
■ You selected the Advanced security model for an 8.x application upgrade and
want to use the combine role mapping behavior available in version 9.x.
■ You selected the Advanced security model for a 9.x application and want to use
the role mapping behavior in version 8.x.
Table 4–7 compares how this setting affects security for Web applications and EJBs:
Table 4–7 How Combined Role Mapping Affects Security for Web Applications and
EJBs
When Combined Role Mapping is When Combined Role Mapping is
Disabled... Enabled...
Role mappings for each container are exclusive Application role mappings are combined with
to other containers unless defined by the EJB and Web application mappings so that all
<externally-defined> descriptor element. principal mappings are included. The
Security Service combines the role mappings
with a logical OR operator.
If one or more policies in the web.xml file If one or more policies in the web.xml file
specifies a role for which no role mapping specifies a role for which no mapping exists in
exists in the weblogic.xml file, the Web the weblogic.xml file, the Web application
application container assumes that the container creates an empty map for the
undefined role is the name of a principal. It undefined role (that is, the role is explicitly
therefore maps the assumed principal to the defined as containing no principal).
role name. For example, if the web.xml file Therefore, no one can access URL patterns
contains the following stanza in one of its that are secured by such policies.
policies:
<auth-constraint>
<role-name>PrivilegedUser</role-name>
</auth-constraint>
but the weblogic.xml file has no role mapping
for PrivilegedUser, then the Web application
container creates an in-memory mapping that
is equivalent to the following stanza:
<security-role-assignment>
<role-name>PrivilegedUser</role-name>
<principal-name>PrivilegedUser
</principal-name>
</security-role-assignment>
Role mappings for EJB methods must be If one or more policies in the ejb-jar.xml file
defined in the weblogic-ejb-jar.xml file. Role specifies a role for which no mapping exists in
mappings defined in the other containers are the weblogic-ejb-jar.xml file, the EJB container
not used unless defined by the creates an empty map for the undefined role
<externally-defined> descriptor element. (that is, the role is explicitly defined as
containing no principal). Therefore, no one
can access methods that are secured by such
policies.
4.3.4.1.1 Example for EAR, WAR and EJB MyAppEar contains MyAppWAR which
contains MyEJB. Role to Principal mappings (p1 and p2) are as follows:
■ EAR descriptor, myRole = p1
■ WAR descriptor, myRole = p2
■ EJB-JAR descriptor, myRole = empty
4-10 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Securing Web Applications and EJBs
When Combined Role Mapping is enabled, the role mappings would be:
■ For the Ear container, myRole maps to p1.
■ For the WAR container, myRole maps to p1 or p2.
■ For the EJB container, myRole maps to p1.
When Combined Role Mapping is disabled, the role mappings would be
■ For the Ear container, myRole maps to p1.
■ For the WAR container, myRole maps to p2.
■ For the EJB container: Must be externally-defined or the deployment fails.
4.3.4.1.2 Example for EAR and WAR MyAppEar contains MyAppWAR. Role to Principal
mappings are as follows:
■ In MyAppEAR descriptor, myRole = p1
■ In MyAppWAR descriptor, myRole = (none defined)
When Combined Role Mapping is enabled, the role mappings would be:
■ For the Ear container, myRole maps to p1.
■ For the WAR container, myRole maps to p1.
The mapping is the same because of the combined role behavior.
When Combined Role Mapping is disabled, the role mappings would be:
■ For the Ear container, myRole maps to p1.
■ For the WAR container, myRole maps to MyRole.
The mapping is the same because if there is no mapping defined for the Web
application, WebLogic Server copies the EAR mapping to the WAR mapping.
4-12 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
5
Security Policies
5
This chapter describes the features and functions of security policies, which specify
[6]
who can access a WebLogic Server 12.1.3 resource. You can create simple policies, such
as "allow access if user is in Admin role," or more complex policies, such as "between
the hours of 8 and 5, allow access if user is in Admin role."
This chapter includes the following sections:
■ Security Policy Storage and Prerequisites for Use
■ Default Root Level Security Policies
■ Security Policy Conditions
■ Protected Public Interfaces
■ Using the Administration Console to Manage Security Policies
For information on using security policies to protect multiple resources, see
Section 2.1.1, "Using Policies to Protect Multiple Resources."
Each user or group that you add to a security policy must be defined in the security
provider database of the Authentication provider that is configured in the active
security realm. Each role that you add must be defined in the security provider
database of the Role Mapping provider that is configured in the active security realm.
The security realm that WebLogic Server provides is configured to use the WebLogic
Authentication and WebLogic XACML Role Mapping providers, which store users,
groups, and roles in the embedded LDAP server.
For more information about the WebLogic Authentication, Authorization, and Role
Mapping providers, see "WebLogic Security Providers" in Understanding Security for
Oracle WebLogic Server.
Note: You can access root level policies in the WebLogic Server
Administration Console. See "Create root level policies" in Oracle
WebLogic Server Administration Console Online Help.
5-2 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Security Policy Conditions
signed an element in the SOAP request message that invokes a Web Service
operation. For example, you might create a condition that says the getBalance
operation can only be invoked if the AccountNumber element in the incoming
SOAP request has been digitally signed by a user who is named joe.
To create an Element requires signature by condition, provide the following
information:
– Specify whether a group or a user is required to sign the SOAP element.
For example, enter user to specify that a user must sign the element.
– The name of the user or group that must sign the element.
– The name of the SOAP message element that must be digitally signed. Use the
following format:
{Namespace}LocalPart
where LocalPart refers to the name of the element in the SOAP message that
must be digitally signed and Namespace refers to its namespace. Use the WSDL
of the Web Service to get these values.
For example:
{http://schemas.xmlsoap.org/soap/envelope/}AccountNumber
Note: You can specify only those elements that have already been
configured to be digitally signed in the WS-Policy of the Web Service.
For details, see "Configuring Message-Level Security" in Securing
WebLogic Web Services for Oracle WebLogic Server.
5-4 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Protected Public Interfaces
■ Access occurs before the specified day of the month—Allows access before
an ordinal day in the month. For example, you might create a condition that grants
access to users before the 15th day of the month.
Note: The format for specifying the time in a time policy condition,
such as Access occurs between specified hours, is
locale-dependent. In English versions of WebLogic Server, the format
is 12-hour based and is expressed as hh:mm:ss AM|PM, using the time
zone local to the WebLogic Server instance. For example, to specify
8:30 p.m., use the format 08:30:00 PM.
For information about using this public interface, see "The WebLogic Server
Administration Console" in Oracle WebLogic Server Administration Console Online
Help.
■ The WebLogic Scripting Tool—The WebLogic Scripting Tool (WLST) is a
command-line scripting interface that system administrators and operators can
use to monitor and manage WebLogic Server instances and domains. The
WebLogic Security Service verifies whether a particular user has permission to
execute a WLST command when the user attempts to invoke the command. If a
user attempts to invoke an operation for which the user does not have access,
WebLogic Server throws a weblogic.management.NoAccessRuntimeException,
which developers can catch explicitly in their programs. The server sends this
exception to its log file, but you can also configure the server to send exceptions to
standard out.
For information about using this public interface, see Understanding the WebLogic
Scripting Tool.
■ MBean APIs—The WebLogic Security Service verifies whether a particular user has
permission to access the API when the user attempts to perform an operation on
the MBean. If a user attempts to invoke an operation for which the user does not
have access, WebLogic Server throws a
weblogic.management.NoAccessRuntimeException, which developers can catch
explicitly in their programs. The server sends this exception to its log file, but you
can also configure the server to send exceptions to standard out.
For information about using these APIs, see "Understanding WebLogic Server
MBeans" in Developing Custom Management Utilities Using JMX for Oracle WebLogic
Server.
You can use the WebLogic Server Administration Console to access WebLogic
resources for creating and modifying security policies. For more information, see
"Manage security policies" in Oracle WebLogic Server Administration Console Online Help.
5-6 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
6
Users, Groups, And Security Roles
6
This chapter describes the features and functions of users, groups, and security roles
[7]
within security realms in WebLogic Server 12.1.3.
This chapter includes the following sections:
■ Overview of Users and Groups
■ Default Groups
■ Overview of Security Roles
■ Types of Security Roles: Global Roles and Scoped Roles
■ Default Global Roles
■ Security Role Conditions
■ Using the Administration Console to Manage Users, Groups, and Roles
6-2 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Default Global Roles
scoped to an entire WebLogic Server domain. See Section 6.4, "Types of Security
Roles: Global Roles and Scoped Roles."
■ Security roles are computed and granted to users or groups dynamically, based on
conditions such as user name, group membership, or the time of day. Groups are
static.
The process of computing and granting roles is referred to as role mapping and
occurs just before the WebLogic Security Service renders an access decision for a
protected WebLogic resource. An access decision is the component of an
Authorization provider that determines whether a subject has permission to
perform a given operation on a WebLogic resource. (See "Access Decisions" in
Developing Security Providers for Oracle WebLogic Server.)
■ A scoped role can be used only in policies that are defined for a specific instance of
a WebLogic resource (such as a method on an EJB or a branch of a JNDI tree). You
might never need to use scoped roles. They are provided for their flexibility and
are an extra feature for advanced customers.
Caution: Do not delete these roles. They are used in the default
security policies that protect most types of WebLogic resources. In
addition, they are used by the MBean security layer. If you delete the
Admin role, no one will be able to modify the configuration of a
running domain. See Section 3.9.1, "Maintaining a Consistent Security
Scheme."
Table 6–2 Default Global Roles, Privileges, and Default Group Assignments
Default Conditions
Global Role Default Policies Grant Access To... Include This Group...
Admin ■ View the server configuration, including the Administrators
encrypted value of some encrypted
attributes.
■ Modify the entire server configuration.
■ Deploy Enterprise Applications and Web
application, EJB, Java EE Connector, and
Web Service modules.
■ Start, resume, and stop servers.
AdminChannelUser Access the administrative channel, AdminChannelUsers,
AdminChannel. Administrators,
Deployers, Operators,
Monitors, and
AppTesters
Anonymous All users (the group everyone) are granted this everyone
global role.
Note: This global role is provided as a
convenience, and can be specified in the
weblogic.xml and weblogic-ejb-jar.xml
deployment descriptors. See "weblogic.xml
Deployment Descriptor Elements" in Developing
Web Applications, Servlets, and JSPs for Oracle
WebLogic Server and "ejb-jar Deployment
Descriptor Reference" in Developing Enterprise
JavaBeans, Version 2.1, for Oracle WebLogic Server.
Deployer ■ View the server configuration, including Deployers
some encrypted attributes related to
deployment activities.
■ Change startup and shutdown classes, Web
applications, JDBC data pool connections,
EJB, Java EE Connector, Web Service, and
WebLogic Tuxedo Connector components. If
applicable, edit deployment descriptors.
■ Access deployment operations in the Java
EE Deployment Implementation (JSR-88).
See "Understanding WebLogic Server
Deployment" in Deploying Applications to
Oracle WebLogic Server.
Operator ■ View the server configuration, except for Operators
encrypted attributes.
■ Start, resume, and stop servers.
Monitor View the server configuration, except for Monitors
encrypted attributes.
This security role effectively provides read-only
access to the WebLogic Server Administration
Console, WLST, and MBean APIs.
AppTester Access applications for testing purposes that are AppTesters
running in Administration mode. For more
information, see "Administration Mode for
Isolating Production Applications" in Deploying
Applications to Oracle WebLogic Server.
6-4 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Security Role Conditions
Table 6–2 (Cont.) Default Global Roles, Privileges, and Default Group Assignments
Default Conditions
Global Role Default Policies Grant Access To... Include This Group...
CrossDomainConne Make inter-domain calls from foreign domains. CrossDomainConnector
ctor For more information, see "Enabling Trust s
Between WebLogic Server Domains" in
Administering Security for Oracle WebLogic Server.
OracleSystemRole Assert identity on behalf of users whose OracleSystemGroup
WS-Security tokens have been authenticated.
Note: This global role is provided for use by
Oracle Web Services Manager.
6-6 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Using the Administration Console to Manage Users, Groups, and Roles
For information on adding users and groups to a security realm, see "Manage users
and groups" in Oracle WebLogic Server Administration Console Online Help.
For information on creating security roles, see "Manage security roles" in Oracle
WebLogic Server Administration Console Online Help.
6-8 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
7
Using XACML Documents to Secure WebLogic
7
Resources
[8This
] chapter describes how to use the eXtensible Access Control Markup Language
(XACML), an XML language for expressing authorization policies and role
assignments, to secure WebLogic resources. You can create roles and policies in an
XACML document and then use the WebLogic Scripting Tool (WLST) to add them to
your security realm. This is useful if you need to create security roles or policies that
are more complex than can be created with the WebLogic Server Administration
Console, or if you are required to use a standard language. You can also export your
realm's roles and policies to a XACML document and then import the document in
other WebLogic Server 12.1.3 realms.
This chapter includes the following sections:
■ Prerequisites
■ Adding a XACML Role or Policy to a Realm: Main Steps
■ Creating Roles and Polices for Custom MBeans
■ Exporting Roles and Policies to XACML Documents
The WebLogic Server XACML Authorization Provider and the WebLogic Server
XACML Role Mapping Provider implement the XACML 2.0 Core Specification,
available at http://docs.oasis-open.org/xacml/2.0/access_
control-xacml-2.0-core-spec-os.pdf.
7.1 Prerequisites
Note the following prerequisites for using XACML documents to secure WebLogic
resources:
■ To add XACML authorization policies to a security realm, the realm must use
either the WebLogic Server XACML Authorization Provider or a third party
7-2 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Adding a XACML Role or Policy to a Realm: Main Steps
Your XACML document can encode this hierarchical protection scheme, though
XACML's hierarchical model differs slightly from WebLogic Server. See Section A.1,
"Comparison of WebLogic Server and XACML Security Models."
Note: The Web Service client needs to authenticate itself before it can
be granted access to the Weblogic resource that is secured by the roles
and policies specified in the XACML document.
4. Open the log file for the Auditing provider and find the entry for the event that
you triggered.
For example, if you configure the WebLogic Server Default Auditor to generate
messages for severity level INFORMATION and higher, when you invoke the
sayHello method from a Web Service named SimpleSoapPort, the audit log
contains the following entries, one from the Role Mapping provider and the other
from the Authorization provider:
#### Audit Record Begin <Mar 30, 2006 9:24:12 AM>
<Severity =INFORMATION>
<<<Event Type = RoleManager Audit Event ><Subject: 0>
<<webservices>><type=<webservices>,
application=webservicesJwsSimpleEar, contextPath=/jws_basic_simple,
webService=SimpleSoapPort, method=sayHello,
signature={java.lang.String}><>>> Audit Record End ####
#### Audit Record Begin <Mar 30, 2006 9:24:12 AM>
<Severity =SUCCESS>
<<<Event Type = Authorization Audit Event V2 ><Subject: 0>
<ONCE><<webservices>><type=<webservices>,
application=webservicesJwsSimpleEar, contextPath=/jws_basic_simple,
webService=SimpleSoapPort, method=sayHello,
signature={java.lang.String}>>> Audit Record End ####
5. Edit the resource ID from the auditing record to specify the resource that you want
to protect.
The IDs in the audit log are for resources that are at the bottom of the WebLogic
Server resource hierarchy. Typically, instead of creating policies for a specific
operation (such as a Web Service or EJB method or an HTTP method on a specific
URL), you design policies for resources higher in the hierarchy, such as for a URL
pattern or an entire Web Service.
You can derive the following resource IDs from the resource ID from the previous
step:
■ The ID for the Web Service that contains the sayHello method is:
type=<webservices>,
application=webservicesJwsSimpleEar, contextPath=/jws_basic_simple,
webService=SimpleSoapPort
■ The ID for the application that contains the Web Service is:
type=<application>,
application=webservicesJwsSimpleEar
For information about root-level policies and the hierarchy of resources, see
Section 2.1.1, "Using Policies to Protect Multiple Resources."
7-4 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Adding a XACML Role or Policy to a Realm: Main Steps
roles in the realm. The MatchId attribute may specify function identifiers and,
thus, wildcard role names. The DataType attribute must specify the string
type.
(Optional) Another ResourceMatch element to identify the WebLogic resource
to which the role applies. If you do not include this ResourceMatch element,
the role applies to all WebLogic resources.
– Under Target, an Action element that indicates that the policy applies to a
role instead of some other type of resource.
■ Under Policy, one or more Rule elements that define which users, groups, or roles
are in the role.
The XACML document in Example 7–1 specifies that a role named MyRole role can be
used with the SimpleSoapPort Web Service. It also specifies that the webServiceGroup
group is in the role.
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#anyURI">urn:oasis:names:tc:xacml:2.0:actions:enableRole<
/AttributeValue>
<ActionAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
DataType="http://www.w3.org/2001/XMLSchema#anyURI" MustBePresent="true"/>
</ActionMatch>
</Action>
</Actions>
</Target>
<Rule RuleId="primary-rule" Effect="Permit">
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-is-in">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">webServiceGroup</AttributeValue>
<SubjectAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:2.0:subject:group"
DataType="http://www.w3.org/2001/XMLSchema#string"/>
</Apply>
</Condition>
</Rule>
<Rule RuleId="deny-rule" Effect="Deny"/>
</Policy>
7-6 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Adding a XACML Role or Policy to a Realm: Main Steps
7.2.5 Use WebLogic Scripting Tool to Add the Role or Policy to the Realm
The WebLogic Scripting Tool (WLST) is a command-line scripting interface that you
can use to load your XACML document into a WebLogic security realm.
You can use WLST in interactive mode or script mode. You cannot use WLST in offline
mode; the Authentication provider and Role Mapping provider can update their
policy stores only when the Administration Server is running.
For information about using script mode, see "Using the WebLogic Scripting Tool" in
Understanding the WebLogic Scripting Tool.
The following steps describe using the WLST interactive mode:
1. Start the WebLogic Server instance that contains the realm you want to configure.
2. Open a command prompt and set up the environment for running WLST.
One way to set up the environment is as follows:
a. Change to the root directory of the domain.
b. Invoke the setWLSenv script (the Domain Configuration Wizard creates this
script for you when you create the domain).
3. Change to the directory that contains your XACML document.
4. To start WLST and connect to a WebLogic Server instance that is listening at
localhost:7001, enter the following commands:
a. java weblogic.WLST
This command returns a WLST prompt.
b. connect('username','password','localhost:7001')
where username and password are credentials for an administrative user.
5. To load a XACML document into a Java String object, enter the following
commands:
a. xacmlFile = open('myfile','r')
where myfile is the name of your XACML document.
b. xacmlDoc = xacmlFile.read()
c. (Optional) To verify that you have loaded your document into a String, enter:
print(xacmlDoc)
The command prints the value of the xacmlDoc variable to standard out.
6. To load role assignments into the WebLogic XACML Role Mapper, enter the
following commands:
a. cd
('SecurityConfiguration/mydomain/Realms/myrealm/RoleMappers/XACMLRo
leMapper')
where
mydomain is the name of your WebLogic Server domain
myrealm is the name of your domain's security realm
b. cmo.addPolicy(xacmlDoc) or cmo.addPolicySet(xacmlDoc), depending on
whether your XACML document contains a Policy or PolicySet.
7. To load authorization policies into the WebLogic XACML Authorizer, repeat step 5
to load your XACML policies document, Then enter the following commands:
a. cd
('SecurityConfiguration/mydomain/Realms/myrealm/Authorizers/XACMLAu
thorizer')
where
mydomain is the name of your WebLogic Server domain
myrealm is the name of your domain's security realm
b. cmo.addPolicy(xacmlDoc) or cmo.addPolicySet(xacmlDoc), depending on
whether your XACML document contains a Policy or PolicySet.
To see a full list of operations that you can use to add, modify, or delete policies, see
XACMLAuthorizerMBean in MBean Reference for Oracle WebLogic Server.
7.2.6 Verify That Your Roles and Policies Are in the Realm
The WebLogic Server Administration Console does not display roles and policies that
you add from a XACML document.
Instead, to verify that your roles and policies were added to the realm, see Section 7.4,
"Exporting Roles and Policies to XACML Documents."
7-8 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Exporting Roles and Policies to XACML Documents
■ type-of-access specifies the type of access that the policy secures. Use one of the
following values:
– get
Indicates that the policy controls who can read one or more MBean attributes.
– set
Indicates that the policy controls who can write one or more MBean attributes.
– invoke
Indicates that the policy controls who can invoke one or more MBean
operations.
– create
Indicates that the policy controls who can use the MBean-server's create
method to create an instance of an MBean.
– unregister
Indicates that the policy controls who can use the MBean-server's unregister
method to unregister an instance of an MBean.
■ type-name is the value of the MBean object name's Type key property.
■ attribute-or-operation is the name of an MBean attribute or operation.
For example, if you create an MBean that contains a single attribute named
NewUserCount and an operation named clearNewUserCount, and if you register the
MBean under the object name
medrec:Name=AdminReportMBean,Type=CustomMBeanType, then the security service
creates the following resource IDs:
type=<jmx>, operation=get, application=, mbeanType=CustomMBeanType,
target=NewUserCount
For information on how to export security data, see "Export data from a security
provider" in the Oracle WebLogic Server Administration Console Online Help.
7-10 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
A
Reference for XACML on WebLogic Server
A
This appendix describes the extensions that you can use when writing XACML 2.0
[9]
documents to protect resources on WebLogic Server 12.1.3 and the restrictions that
WebLogic Server places on XACML. The eXtensible Access Control Markup Language
(XACML) is an XML language for expressing authorization policies and role
assignments. XACML offers extension points so that vendors such as Oracle can
express vendor-specific resources, data types, and functions in XACML.
The WebLogic Server XACML Authorization Provider and XACML Role Mapping
Provider:
■ Implement and extend the OASIS XACML 2.0 Core Specification, available at
http://docs.oasis-open.org/xacml/2.0/access_
control-xacml-2.0-core-spec-os.pdf
■ Partially implement the Core and Hierarchical Role Based Access Control (RBAC)
Profile of XACML 2.0, described in the OASIS RBAC specification at
http://docs.oasis-open.org/xacml/2.0/access_
control-xacml-2.0-rbac-profile1-spec-os.pdf
This appendix includes the following sections:
■ Comparison of WebLogic Server and XACML Security Models
■ Action Identifiers
■ Environment Identifiers
■ Policy and PolicySet Identifiers
■ Resource Identifiers
■ Subject Identifiers
■ WebLogic Server Functions for XACML
■ Rule and Policy-Combining Algorithm
This document describes only the WebLogic Server extensions and restrictions for
XACML. For a complete reference of the XACML 2.0 language, see the OASIS XACML
2.0 Core Specification and the OASIS RBAC specification.
hierarchy. The higher levels of the resource hierarchy contain enterprise applications,
Web applications, and EJBs. The lowest levels of the resource hierarchy contain EJB
methods, HTTP methods on specific URL patterns, and MBean getters and setters.
The XACML model also recognizes a hierarchy of resources. Unlike the native
WebLogic Server model, your XACML policies must specify how to interpret cases in
which a resource is protected by its own policy and by a policy on the resource's
parent or ancestor.
In addition, a XACML document typically distinguishes between a resource and the
actions of a resource. For example, a XACML document defines a resource such as an
EJB, and then defines an action within the EJB resource to represent a method in the
EJB. The native WebLogic Server model considers an EJB and each EJB method to be
resources. See Figure A–1.
A-2 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Action Identifiers
For a description of all data types that the WebLogic XACML providers recognize, see
com.bea.common.security.xacml.Type in Java API Reference for Oracle WebLogic Server.
Table A–2 describes the value that you specify for the action-id identifier.
A.2.1 Examples
The following example uses an Action element to specify that the target is mymethod
within the SimpleSoap Web Service.
A-4 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Environment Identifiers
<Target>
<Resources>
<Resource>
<ResourceMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">type=<webservices>,
application=webservicesJwsSimpleEar,contextPath=/jws_basic_simple,
webService=SimpleSoapPort</AttributeValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:2.0:resource:resource-ancestor"
DataType="http://www.w3.org/2001/XMLSchema#string"
MustBePresent="true"/>
</ResourceMatch>
</Resource>
</Resources>
<ActionMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">mymethod</AttributeValue>
<ActionAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"
DataType="http://www.w3.org/2001/XMLSchema#string"
MustBePresent="true"/>
</ActionMatch>
</Target>
A.3.1 Examples
The following example uses an Environment element to match value of a WebLogic
Server listen port. Such an element could create a policy that requires a request to
come through listen port 9001:
<Environment>
<EnvironmentMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:double-equal">
<EnvironmentAttributeDesignator
AttributeId="urn:bea:xacml:2.0:environment:context:com.bea.cont
extelement.channel.Port"
DataType="http://www.w3.org/2001/XMLSchema#double"/>
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#double">9001</AttributeValue>
</EnvironmentMatch>
</Environment>
A.4.1 Examples
The following example is a valid identifier for a Policy element:
<Policy
PolicyId="urn:mycompany:myapplication:policyid:1"
...>
A-6 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
Resource Identifiers
A.5.1 Examples
The following example Resource element matches a Web Service named
SimpleSoapPort and all methods within that Web Service:
<Resource>
<ResourceMatch
MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">type=<webservices>,
application=webservicesJwsSimpleEar, contextPath=/jws_basic_simple,
webService=SimpleSoapPort</AttributeValue>
<ResourceAttributeDesignator
AttributeId="urn:oasis:names:tc:xacml:2.0:resource:resource-ancestor"
DataType="http://www.w3.org/2001/XMLSchema#string"
MustBePresent="true"/>
</ResourceMatch>
</Resource>
A.6.1 Examples
For an example of a XACML document that uses identifiers from Table A–7 to define a
security role that can be used to protect access to a Web Service, see Example 7–2.
A-8 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
WebLogic Server Functions for XACML
For information on functions that compare bea:Objects, see Section A.7.8, "Object
Comparisons."
A.7.2 Examples
The following example is a Condition that uses
urn:bea:xacml:2.0:function:character-equal to compare two bea:characters:
<Condition>
<Apply FunctionId="urn:bea:xacml:2.0:function:character-equal">
<AttributeValue
DataType="urn:bea:xacml:2.0:data-type:character">Q</AttributeValue>
<AttributeValue
DataType="urn:bea:xacml:2.0:data-type:character">Q</AttributeValue>
</Apply>
</Condition>
A-10 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
WebLogic Server Functions for XACML
A.7.4 Example
The following policy uses the instance-method function to invoke the
HttpServletRequest.getAuthType() method on requests that match a specific URL
pattern (see javax.servlet.http.HttpServletRequest.getAuthType() in the Java
Platform, Enterprise Edition 6 API Specification, available at
http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.
html#getAuthType). The WebLogic Server ContextHandler makes this
HttpServletRequest object available to the Authorization and Role Mapping
providers for all requests that come through the servlet container. Any policy for a
URL resource can invoke this or other HttpServletRequest methods.
A-12 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
WebLogic Server Functions for XACML
DataType="http://www.w3.org/2001/XMLSchema#string"
MustBePresent="true"/>
</ResourceMatch>
</Resource>
</Resources>
</Target>
<!-- Declaring the instance-method function as a variable because this policy
invokes it multiple times.
-->
<VariableDefinition VariableId="authType">
<Apply FunctionId="urn:bea:xacml:2.0:function:instance-method">
<!-- Passing the HttpServletRequest object to the function, which the
BEA ContextHandler makes available to the security framework.
-->
<Apply FunctionId="urn:bea:xacml:2.0:function:object-one-and-only">
<EnvironmentAttributeDesignator
DataType="urn:bea:xacml:2.0:data-type:object"
AttributeId="urn:bea:xacml:2.0:environment:context:com.bea.
contextelement.servlet.HttpServletRequest" />
</Apply>
<!-- Passing "getAuthType()" as the name of the HttpServletRequest
method to invoke
-->
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">getAuthType</AttributeValue>
<!-- Because the getAuthType() method signature contains no parameters,
pass an empty bag of Class.
-->
<Apply FunctionId="urn:bea:xacml:2.0:function:class-bag" />
</Apply>
</VariableDefinition>
<!-- Creating a rule that allows access to the resource only if
the getAuthType() returns a non-null value and if the non-null
value is "CLIENT_CERT"
-->
<Rule RuleId="primary-rule" Effect="Permit">
<Condition>
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:not">
<Apply FunctionId="urn:bea:xacml:2.0:function:object-is-null">
<VariableReference VariableId="authType" />
</Apply>
</Apply>
<Apply
FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
<!-- Because the instance-method function returns a bea:Object,
this policy wraps the function in an object-to-string function,
which enables comparison a of the function output with another
string.
-->
<Apply FunctionId="urn:bea:xacml:2.0:function:object-to-string">
<VariableReference VariableId="authType" />
</Apply>
<!-- Declaring a String object to compare to the
HttpServletRequest.getAuthType() return value.
-->
<AttributeValue
DataType="http://www.w3.org/2001/XMLSchema#string">CLIENT_CERT</AttributeValue>
</Apply>
</Apply>
</Condition>
</Rule>
<Rule RuleId="deny-rule" Effect="Deny" />
</Policy>
A-14 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
WebLogic Server Functions for XACML
A-16 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
WebLogic Server Functions for XACML
A-18 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
WebLogic Server Functions for XACML
where type is the name of a XACML data type. Table A–9 lists all data types and the
Java object that the corresponding function returns.
For example, this function returns "test" as a java.lang.String object:
<Apply
FunctionId="urn:bea:xacml:2.0:function:string-to-object">test</Apply>
Table A–10 lists the functions that Oracle provides to convert strings or Java objects to
different data or object types. To pass objects that the container makes available to the
current context, use the urn:bea:xacml:2.0:environment:context:key environment
identifier to specify the bea:Object. See Section A.3, "Environment Identifiers."
A-20 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
WebLogic Server Functions for XACML
A-22 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3
WebLogic Server Functions for XACML
A-24 Securing Resources Using Roles and Policies for Oracle WebLogic Server 12.1.3