Skip Headers

OracleŽ Application Server Containers for J2EE Security Guide
10g (9.0.4)

Part Number Part No. B10325-02
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Go to previous page Go to next page

2
Overview of JAAS in Oracle Application Server

This chapter introduces support for Oracle Application Server Java Authentication and Authorization Service (JAAS), in Oracle Application Server Containers for J2EE (OC4J). JAAS enables application developers to integrate authentication, authorization, and delegation services with their applications.

This chapter contains these topics:

The JAAS Provider

OracleAS supports JAAS by implementing a JAAS Provider. The JAAS Provider implements user authentication, authorization, and delegation services that developers can integrate into their application environments. Instead of devoting resources to developing these services, application developers can focus on the presentation and business logic of their applications.


Note:

Some class and component names contain the word "JAZN," which is a shortened name for the OC4J JAAS Provider.


The JAAS framework and the Java 2 Security model form the foundation of JAAS. The OracleAS JAAS Provider implements support for JAAS policies. Policies contain the rules (permissions) that authorize a user to use resources, such as reading a file. Using JAAS, services can authenticate and enforce access control upon resource users. The JAAS Provider is easily integrated with J2SE and J2EE applications that use the Java 2 Security model.

Provider Types

The OC4J JAAS implementation supports two different provider types. Each provider type implements a repository for secure, centralized storage, retrieval, and administration of provider data. This data consists of realm (users and roles) and JAAS policy (permissions) information.

What Is JAAS?

JAAS is a Java package that enables applications to authenticate and enforce access controls upon users. The JAAS Provider is an implementation of the JAAS interface.

JAAS is designed to complement the existing code-based Java 2 security. JAAS implements a Java version of the standard Pluggable Authentication Module (PAM) framework. This enables an application to remain independent from the authentication service.

JAAS extends the access control architecture of the Java 2 Security Model to support principal-based authorization.

This section describes JAAS support for the following authentication, authorization, and user community (realm) features. The JAAS Provider enhances some of these features.

Login Module Authentication

To associate a principal (such as frank) with a subject, a client attempts to log into an application. In login module authentication, the LoginContext class provides the basic methods used to authenticate subjects such as users, roles, or computing services. The LoginContext class consults configuration settings to determine whether the authentication modules (known as login modules) are configured for use with the particular application that the subject is attempting to access. Different login modules can be configured with different applications; furthermore, a single application can use multiple login modules.

Because the LoginContext separates the application code from the authentication services, you can plug a different login module into an application without affecting the application code.

Actual authentication is performed by the method LoginContext.login(). If authentication succeeds, then the authenticated subject can be retrieved by invoking LoginContext.getSubject(). The real authentication process can involve multiple login modules. The JAAS framework defines a two-phase authentication process to coordinate the login modules configured for an application.

After retrieving the subject from the LoginContext, the application then performs work as the subject by invoking Subject.doAs() or Subject.doAsPrivileged().

Roles

The JAAS framework does not explicitly define roles or groups. Instead, roles or groups are implemented as concrete classes that use the interface java.security.Principal.

The JAAS framework does not define how to support the role-based access control (RBAC) role hierarchy, in which you can grant a role to a role.

Realms

The JAAS framework does not explicitly define user communities. However, the J2EE reference implementation (RI) defines a similar concept of user communities called realms. A realm provides access to users and roles (groups) and optionally provides administrative functionality. A user community instance is essentially a realm that is maintained internally by the authorization system. The J2EE RI Realm API supports user-defined realms through subclassing.

See Also:

"JAAS Provider Realm Framework" for JAAS Provider enhancements to realms

Applications

The JAAS framework does not explicitly define an application or subsystem for partitioning authorization rules.

Policies and Permissions

A policy is a repository of JAAS authorization rules. The policy includes grants of permissions to principals, thus answering the question: given a grantee, what are the granted permissions of the grantee?

Policy information is supplied by the JAAS Provider. The JAAS framework does not define an administrative API for policy administration. The administrative API provided by the JAAS Provider is an Oracle extension.

Table 2-1 describes the Sun Microsystems implementation of policy file parameters.

Table 2-1 Policy File Parameters
Where Is Defined As Example

subject

one or more principal(s)

duke

codesource

codebase, signer

http://www.example.com, mysigner

Sun Policy Example

The following example shows a typical entry in the JAAS policy file as implemented by Sun's implementation of the JAAS policy provider:

grant   CodeBase "http://www.example.com",
        Principal com.sun.security.auth.SolarisPrincipal "duke" 
{ 
        permission java.io.FilePermission "/home/duke", "read, write"; 
};

Code from www.example.com running as a SolarisPrincipal with the username duke has the permission that permits the executing code to read and write files in /home/duke.

XML-Based Example

The JAAS XML-based provider can store policy data in the file jazn-data.xml. In the following example, a segment of the jazn-data.xml file grants the jazn.com /administrators permission to modify realm data, to drop realms, and to create roles:

<!--JAZN Policy Data -->
<jazn-policy>
  <grant>
     <grantee>
        <principals>
            <principal>
                <realm>jazn.com</realm>  
                <type>role</type>                  
                <class>oracle.security.jazn.spi.xml.XMLRealmRole
                     </class>
                <name>jazn.com/administrators</name>                    
             </principal>
         </principals>
     </grantee>
     <permissions>
        <permission>
           <class>oracle.security.jazn.policy.AdminPermission</class>
           <name>oracle.security.jazn.realm.
RealmPermission$jazn.com$modifyrealmmetadata</name> </permission> <permission> <class>oracle.security.jazn.policy.AdminPermission</class> <name>oracle.security.jazn.realm.
RealmPermission$jazn.com$droprealm</name> </permission> <permission> <class>oracle.security.jazn.policy.AdminPermission</class> <name>oracle.security.jazn.realm.RealmPermission$jazn. com$createrole</name> </permission> <permission> <class>oracle.security.jazn.realm.RealmPermission</class> <name>jazn.com</name> <actions>createrealm</actions> </permission> </permissions> </grant> </jazn-policy>

See Also:

JAAS Framework Features

Table 2-2 contains the JAAS framework features implemented by the Oracle Application Server JAAS Provider.

Table 2-2 JAAS Provider Features
Feature Description See Also

Authentication

  • Integrates with Oracle Application Server Single Sign-On (SSO) for SSO login authentication in J2EE application environments.

  • Supplies an out-of-the-box RealmLoginModule class for non-SSO environments, such as OracleAS Core or Java Edition

  • Supports any JAAS-compliant custom LoginModule

Chapter 6, "Security and J2EE Applications"

Declarative Model

  • Integrates J2EE deployment descriptors, such as. web.xml, with JAAS security

  • Supports programmatic model as well

Chapter 3, "Configuring And Deploying the JAAS Provider"

Role-based access control (RBAC)

  • Provides centralized role-based access control, including support for hierarchical roles

"Role-Based Access Control (RBAC)"

Realms

  • Organizes users and roles (groups) around user communities. An Oracle API package (oracle.security.jazn.realm) is provided to support user and role management. This API includes a RealmPrincipal interface that extends from java.security.Principal and associates a realm with users and roles.

"Realms"

"JAAS Provider Realm Framework"

Management

  • Manages settings and data using command-line tool (Admintool) or programmatic level APIs

  • Supports a centrally managed provider type with Oracle Internet Directory

Chapter 4, "JAAS Provider Administration Tasks"

JAZNUserManager

  • Provides an implementation of the OC4J UserManager that integrates with both the XML-based and the LDAP-based providers.

"OC4J and the JAAS Provider"

Chapter 6, "Security and J2EE Applications"

User Managers

OC4J security employs a user manager to authenticate and authorize users and groups that attempt to access a J2EE application. You base your choice of user manager on performance and security needs.

All UserManager classes implement the com.evermind.security.UserManager interface. UserManager classes manage users, groups, and passwords through methods such as createUser(), getUser(), and getGroup().

OC4J provides two predefined user managers, JAZNUserManager and XMLUserManager. JAZNUserManager supports both XML-based and LDAP-based providers. We recommend using JAZNUserManager because it is based on the JAAS specification and is integrated with Oracle Application Server Single Sign-On and Oracle Internet Directory. JAZNUserManager is the default security provider, because it offers powerful and flexible security control. Customers can also supply their own classes that implement the UserManager interface.


Note:

For a discussion of creating a custom UserManager, see http://otn.oracle.com/sample_code/tech/xml/xmlnews/News_Security.html


Table 2-3 lists the user managers provided by OC4J.

Table 2-3 OC4J User Managers And Repositories
User Manager Class User Repository

oracle.security.jazn.oc4j.JAZNUserManager

Two types:

  • using the XML-based provider --
    jazn-data.xml

  • using the LDAP-based provider--Oracle Internet Directory

com.evermind.server.XMLUserManager

The principals.xml file

Custom user manager

Customized user repository

See "Specifying UserManagers" for directions on how to use Enterprise Manager to define the default UserManager for all applications or a single UserManager for a specific application.

The following sections describe the JAZN and XML user managers:

Using JAZNUserManager

The JAZNUserManager class is the default user manager. The primary purpose of the JAZNUserManager class is to leverage the JAAS Provider as the security infrastructure for OC4J.

There are two JAAS Providers supplied with OC4J security: XML-based and LDAP-based.

Figure 2-1 shows the two different JAAS Providers supplied with OC4J.

Figure 2-1 OC4J Security Architecture Under the JAZNUserManager Class

Text description of jaas_ina.gif follows

Text description of the illustration jaas_ina.gif

Using XMLUserManager

The XMLUserManager class is a simple user manager that manages users, groups, and roles in an XML-based system. It stores user passwords in the clear, and therefore is not as secure as the JAZNUserManager. All XMLUserManager configuration information is stored in the principals.xml file, which is the user repository for the XMLUserManager class.


Note:

The XMLUserManager class is supported for backward compatibility only. Oracle recommends that you use one of the JAAS provider types.


Specifying UserManagers

The user manager, employing the user name and password, verifies the user's identity using information in the user repository. The user manager contains your definitions for users, groups, or roles. The default user manager is the JAZNUserManager.

You can define a user manager for all applications or for specific applications.

Capability Model of Access Control

The capability model is a method for organizing authorization information. The JAAS Provider is based on the Java 2 Security Model, which uses the capability model to control access to permissions. With the capability model, authorization is associated with the principal (a user named frank in the following example). Table 2-4 shows the permissions that user frank is authorized to use:

Table 2-4 User Permissions
User Has These File Permissions

frank

Read and write permissions on a file named salaries.txt in the /home/user directory

When user frank logs in and is successfully authenticated, the permissions described in Table 2-4 are retrieved from the JAAS Provider (whether the LDAP- based Oracle Internet Directory or XML-based provider) and granted to user frank. User frank is then free to execute the actions permitted by these permissions.

Role-Based Access Control (RBAC)

RBAC enables you to assign permissions to roles. You grant users permissions by making them members of appropriate roles. Support for RBAC is a key JAAS feature. This section describes the following RBAC features:

Role Hierarchy

RBAC simplifies the management problems created by direct assignment of permissions to users. Assigning permissions directly to multiple users is potentially a major management task. If multiple users no longer require access to a specific permission, you must individually remove that permission from each user.

Instead of directly assigning permissions to users, permissions are assigned to a role, and users are granted their permissions by being made members of that role. Multiple roles can be granted to a user. A role can also be granted to another role, thus forming a role hierarchy that provides administrators with a tool to model enterprise security policies. Figure 2-2 provides an example of role-based access control.

Figure 2-2 Role-Based Access Control

Text description of jaz006.gif follows.

Text description of the illustration jaz006.gif

When a user's responsibilities change (for example, through a promotion), the user's authorization information is easily updated by assigning a different role to the user instead of a massive update of access control lists containing entries for that individual user.

For example, if multiple users no longer require write permissions on a file named salaries in the /home/user directory, those privileges are removed from the HR role. All members of the HR role then have their permissions and privileges automatically updated.

Role Activation

A user is typically granted multiple roles. However, not all roles are enabled by default. An application can selectively enable the required roles to accomplish a specific task in a user session with the run-as security identity and Subject.doAS(). Selectively enabling roles upholds the principle of least privilege: the application is not enabling permissions or privileges unnecessary for the task. This limits the damage that can potentially result from an accident or error.


Go to previous page Go to next page
Oracle
Copyright © 1996, 2003 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index