Skip Headers
Oracle® HTML DB User's Guide
Release 1.6

Part Number B14303-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

14 Managing Security

You can provide security for your application through authentication and authorization. Authentication is the process of establishing users' identities before they can access an application. Authorization controls user access to specific controls or components based on user privileges.

This section contains the following topics:

Escaping Special Characters Rendered from Session State

Cross site scripting (also referred to as XSS) is a security breach that takes advantage of dynamically generated Web pages. In a XSS attack, a Web application is sent a script that activates when it is read by a user's browser. Once activated, these scripts can steal data or even session credentials and return the information to the attacker. If malicious code was introduced into an Oracle HTML DB application, it could be rendered into HTML regions and other places within the application during normal page rendering. To prevent the introduction of malicious code into session state, the HTML DB engine escapes characters in certain cases as outlined below.

Specifically, Oracle HTML DB escapes special character:

Additionally, form field values submitted to be saved in session state are passed in POSTDATA so that they are received by the ACCEPT procedure and saved in session state in unescaped format. Oracle HTML DB does not attempt to filter output sent to the browser. As a developer, you have full control of any dynamic content sent to the browser, including PL/SQL regions or any other developer provided code.

As an added precaution, always follow best practices to guard against cross site scripting attacks. For example, during the development process think about whether or not an item could have malicious content stored in it by URL tampering or another means. Avoid referencing form items using &MY_ITEM. for rendering in most types of static areas since it can lead to security vulnerabilities. Instead, use application level items or page items of type Display as text (does not save state). Another easy safeguard is to escape less than (<), greater than (>), and ampersands (&).

Understanding Security

You can provide security for your application through authentication and authorization. Authentication is the process of establishing users' identities before they can access an application. Authorization controls user access to specific controls or components based on user privileges.

To access either the Authentication Schemes or Authorization Schemes pages:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. On the Application Builder home page, click Shared Components.

    The Shared Components page appears.

  4. Under Security, select either Authentication or Authorization.

Using the Security Navigation List

The Security Navigation list displays on the right side of the Authentication Schemes and Authorization Schemes pages. This list offers quick access to relevant security homes pages as well as related utilization reports.

To access the Security Navigation list:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. On the Application Builder home page, click Shared Components.

    The Shared Components page appears.

  4. Under Security, select either Authentication or Authorization.

    The Security Navigation list displays on the right side of the page and contains the following links:

    • Security Home

    • Authentication Schemes

    • Manage Authentication Scheme Subscriptions

    • Authorization Schemes

    • Manage Authorization Scheme Subscriptions

    • Authorization Scheme Utilization

Establishing User Identity Through Authentication

Authentication is the process of establishing each user's identify before they can access your application. Authentication may require a user identify a username and password or could involve the use of digital certificates or a secure key.

When you create an authentication scheme, you have the option of choosing from a number of preconfigured authentication schemes, copying an authentication scheme from an existing application, or creating your own custom authentication scheme.

Topics in this section include:

Understanding How Authentication Works

You determine how your application interacts with users. If all users have the same rights and privileges they are referred to as public users. However, if your application needs to track each user individually, you need to specify an authentication method.

Authentication establishes the identity of each user who accesses your application. Many authentication processes require a user provide some type of credentials such as a username and password. These credentials are then evaluated and they either pass or fail. If the credentials pass, the user has access to the application. Otherwise, access is denied.

Once a user has been identified, the HTML DB engine keeps track of each user by setting the value of a built-in substitution string. As a user navigates from page to page, the HTML DB engine sets the value of APP_USER to identify who they are. The HTML DB engine uses APP_USER as one component of a key for tracking each user's session state.

From a programming perspective, you can access APP_USER using the following syntax:

  • From PL/SQL:

    V('APP_USER')
    
    
  • As a bind variable from either PL/SQL or SQL:

    :APP_USER
    
    

You can use APP_USER to perform your own security checks and conditional processing. For example, suppose you created the following table:

CREATE TABLE my_security_table (
  user_id   VARCHAR2(30),
  privilege VARCHAR2(30));

Once created, you could populate this table with user privilege information and then use it to control the display of pages, tabs, navigation bars, buttons, regions, or any other control or component.

Creating an Authentication Scheme

As you create your application, you need to determine whether to include authentication. You can:

  • Choose to not require authentication.

    Oracle HTML DB does not check any user credentials. All pages of your application are accessible to all users.

  • Select a built-in authentication scheme.

    Create an authentication method based on available preconfigured authentication schemes. Depending on which scheme you choose, you may also have to configure the corresponding components of Oracle 9iAS, Oracle Internet Directory, or other external services.

  • Create custom authentication scheme.

    Create a custom authentication method, giving you complete control over the authentication interface. To implement this approach, you must provide a PL/SQL function the HTML DB engine executes before processing each page request. This function's Boolean return value determines whether the HTML DB engine processes the page normally or displays a failure page.

To create an authentication scheme:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. On the Application Builder home page, click Shared Components.

    The Shared Components page appears.

  4. Under Security, select either Authentication.

    The Authentication Schemes page appears.

  5. To create a new authentication scheme, click Create Scheme.

  6. Specify how the scheme should be created by selecting one of the following:

    • Based on preconfigured scheme

    • As a copy of an existing scheme

    • From Scratch

  7. Follow the on-screen instructions

Using the Authentication Scheme Repository

Once created, available authentication schemes display in the Authentication Schemes Repository.

To navigate to the Authentication Schemes Repository:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. On the Application Builder home page, click Shared Components.

    The Shared Components page appears.

  4. Under Security, select either Authentication.

    The Authentication Schemes page appears.

From the Authentication Schemes repository, you can:

  • Make an authentication scheme current by selecting the make current link

  • Edit an authentication scheme by clicking the Edit icon

  • View a flow chart explanation of an authentication scheme by clicking the View icon

  • Create a new authentication scheme by clicking Create Scheme and following the on-screen instructions

Viewing the Current Authentication Scheme for an Application

To view the current authentication scheme for an application:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. Click the Edit Attributes icon.

    The Edit Application Attributes page appears.

  4. Scroll down to the Session Management attribute and click manage.

    The Authentication Schemes page appears. Available authentication schemes display in the Authentication Schemes Repository. You apply an authentication scheme to an application by designating it as current.

  5. To apply an authentication scheme to the current application, select the make current link

About Preconfigured Authentication Schemes

When you select a preconfigured authentication scheme, Oracle HTML DB creates an authentication scheme for your application that follows a standard behavior for authentication and session management. The following list describes available preconfigured authentication schemes:

  • Open Door Credentials enables anyone to access your application using a built-in login page which captures a username. This can be useful during application development.

  • HTML DB Account Credentials refers to the internal user accounts (also known as "cookie user" accounts) created and managed in the Oracle HTML DB user repository. Using this scheme authentication method, your application can easily authenticate against these accounts.

  • LDAP Credentials Verification requires you specify configuration parameters about the external LDAP directory you will be using.

  • No Authentication (using DAD) gets the username from the Database Access Descriptor (DAD), either as the value stored in the DAD configuration or, if the account information is not stored in the DAD configuration, as the username captured using the basic authentication challenge.

  • Oracle Application Server Single Sign-On (HTML DB engine as Partner App) delegates authentication to the Oracle AS Single Sign-On (SSO) Server. To you use authentication scheme, your site must have already been registered as a partner application with the SSO server. For more information, contact your administrator.

  • Oracle Application Server Single Sign-On (My application as Partner App) delegates authentication to the SSO server. Requires you register an application with SSO as a partner application.

About DAD Credentials Verification

Database Access Descriptor (DAD) database authentication uses the Oracle database native authentication and user mechanisms to authenticate users using a basic authentication scheme. To use DAD credentials verification:

  • Each application user must have a user account in the Oracle database.

  • You must configure a PL/SQL DAD for basic authentication (without account information).

    This results in one username/password challenge for browser session for your application users. The user identity token is then made available in the APP_USER item.

DAD database authentication is useful when you need to implement an authentication method that requires minimal setup for a manageable number of users. Ideally these users would already have self-managed accounts in the database and your use of this authentication method would be short lived (for example, during the demonstration or prototyping stages of development).

The main drawback of this approach is burdensome account maintenance, especially if users do not administer their own passwords, or if their database accounts exist only to facilitate authentication to your application.

About HTML DB Account Credentials

HTML DB Account Credentials authentication uses internal user accounts (also known as "cookie user" accounts) created and managed in the Oracle HTML DB user repository. Workspace administrators can create and edit user accounts using the Manage Users page. HTML DB Account Credentials is a good solution when:

  • You want control of the user account repository

  • Username and password based approach to security is sufficient

  • You do not need to integrate into a single sign-on framework

This is an especially good approach when you need to get a group of users up and running on a new application quickly.


See Also:

"Managing Users" for more information on creating and managing user accounts

About LDAP Credentials Verification

Any authentication scheme that uses a login page may be configured to use Lightweight Directory Access Protocol (LDAP) to verify the username and password submitted on the login page. Application Builder includes wizards and edit pages that explain how to configure this option. These wizards assume that an LDAP directory accessible to your application for this purpose already exists and that it can respond to a SIMPLE_BIND_S call for credentials verification. When you create a LDAP Credentials authentication scheme, the wizard requests and saves the LDAP host name, LDAP port, and the DN string. An optional pre-processing function can be specified to adjust formatting of the username passed to the API.

About Single Sign-On Server Verification

Oracle HTML DB applications can operate as partner applications with Oracle Application Server's Single Sign-On (SSO) infrastructure. To accomplish this, you must register your application (or register the HTML DB engine) as the partner application. To register your application or the HTML DB engine as a partner application, follow the Oracle Application Server instructions for registering partner applications and install the Oracle 9iAS SSO Software Developer Kit (SDK).

If you choose this approach, your application will not use an integrated login page. Instead, when a user accesses your application in a new browser session, the HTML DB engine redirects to the Single Sign-On login page. After the user is authentication by SSO, the SSO components redirect back to your application, passing the user identity and other information to the HTML DB engine. The user can then continue to use the application until they log off, terminate their browser session, or until some other session-terminating event occurs.

About Creating an Authentication Scheme from Scratch

Creating an authentication scheme from scratch gives you complete control over your authentication interface. This is the best approach for applications when any of the following is true:

  • Database authentication, or other methods are not adequate.

  • You want to develop your own login form and associated methods.

  • You want to delegate all aspects of user authentication to external services such as Oracle 9iAS Single Sign-On.

  • You want to control security aspects of Oracle HTML DB session management.

  • You want to record or audit activity at the user or session level.

  • You want to enforce session activity or expiry limits.

  • You want to program conditional n-way redirection logic before Oracle HTML DB page processing.

  • You want to integrate your application with non-Oracle HTML DB applications using a common session management framework.

  • Your application consists of multiple applications that operate seamlessly (for example, more than one Oracle HTML DB application ID).


See Also:

"HTMLDB_CUSTOM_AUTH" for more information

About Session Management Security

When running custom authentication, Oracle HTML DB attempts to prevent two improper situations:

  • Intentional attempts by a user to access session state belonging to someone else. However, users can still type in an arbitrary application session ID into the URL.

  • Inadvertent access to a stale session state (probably belonging to the same user from an earlier time). This would commonly result from using bookmarks to application pages.

Oracle HTML DB checks that the user identity token set by the custom authentication function matches the user identity recorded when the application session was first created. If the user has not yet been authenticated and the user identity is not yet known, the session state being accessed does not belong to someone else. These checks determine whether the session ID in the request can be used. If not, the HTML DB engine redirects back the same page using an appropriate session ID.

Building a Login Page

When you create a new application in Oracle HTML DB, a login page is created. The alias for the page is 'LOGIN'. You can use this page as the 'invalid session page' in an authentication scheme. The page is constructed with processes that call the Oracle HTML DB login API to perform credentials verification and session registration.

You can also build your own login pages using the pre-built pages as models and tailoring all of the user interface and processing logic to your requirements.

To create a login page for your application:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. Click Create Page.

  4. From the Tasks list on the right side of the page, select Create Login Page.

  5. Follow the on-screen instructions.

About Deep Linking

Deep linking refers to the ability to link to an Oracle HTML DB page out of context (for example, from a hyperlink in an e-mail or workflow notification). When you link to a page out of context and the application requires the user be authenticated, the user will be taken to the login page. After credentials verification, the HTML DB engine automatically displays the page that was referenced in the original link. Deep linking is supported for applications that use authentication schemes.

Providing Security Through Authorization

Authorization is a broad term for controlling access to resources based on user privileges. While conditions control the rendering and processing of specific page controls or components, authorization schemes control user access to specific controls or components.

Topics in this section include:

How Authorization Schemes Work

An authorization scheme extends the security of your application's authentication scheme. You can specify an authorization scheme for an entire application, a page, or specific control such as a region, item, or button. For example, you could use an authorization scheme to selectively determine which tabs, regions, or navigation bars a user sees.

An authorization scheme either succeeds or fails. If a component or control level authorization scheme succeeds, the user can view the component or control. If it fails, the user cannot view the component or control. If an application or page level authorization scheme fails, then Oracle HTML DB displays a previously defined message.

When you define an authorization scheme you give it a unique name. Once defined, you can attach it to any component or control in your application. To attach an authorization scheme to a component or control in your application, simply navigate to the appropriate attributes page and select an authorization scheme from the Authorization Scheme list.

Creating an Authorization Scheme

Before you can attach an authorization scheme to an application or an application component or control, you must first create it.

To create an authorization scheme:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. On the Application Builder home page, click Shared Components.

    The Shared Components page appears.

  4. Under Security, select Authorization.

  5. Click Create.

  6. Specify how to create an authorization scheme by selecting one of the following:

    • From Scratch

    • As a Copy of an Existing Authorization Scheme

  7. Follow the on-screen instructions.

To edit attributes of an existing authorization scheme:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. On the Application Builder home page, click Shared Components.

    The Shared Components page appears.

  4. Under Security, select Authorization.

    Existing Authorization Schemes display at the bottom of the page.

  5. To edit attributes for an existing authorizations scheme, click the Edit icon.

  6. Follow the on-screen instructions.

About the Evaluation Point Attribute

You can specify when your authorization scheme is validated in the Evaluation Point attribute. You can choose to have your authorization scheme validated once for each session or once for each page view.

Keep in mind, that if you specify that an authorization scheme should be evaluated once for each session and the authorization scheme passes, the underlying code, test, or query will not be executed again for the duration of the application session. If your authorization scheme consists of a test whose results might change if evaluated at different times during the session, then you should specify that the evaluation point be once for each page view.

About Resetting Authorization Scheme State

If an authorization scheme is validated once for each session, Oracle HTML DB caches the validation results in each user's session cache. You can reset a session's authorization scheme state by calling the HTMLDB_UTIL.RESET_AUTHORIZATIONS API:

Calling this procedure nulls out any previously cached authorization scheme results for the current session. Be aware that this procedure takes no arguments and is part of the publicly executable HTMLDB_UTIL package.

Attaching an Authorization Scheme to an Application, Page, or Components

Once you have created an authorization scheme you can attach it to an entire application, page, control, or component.

Topics in this section include:

Attaching an Authorization Scheme to an Application

To attach an authorization scheme to an application:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. Click the Edit Attributes icon.

    The Edit Application Attributes page appears.

  4. Scroll down to Authorization and make a selection from the Authorization Scheme list.

Attaching an Authorization Scheme to a Page

To attach an authorization scheme to a page:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. From the Pages list, select a page name.

  4. Click Edit Attributes.

  5. Scroll down to Security and make a selection from the Authorization Scheme list.

Attaching an Authorization Scheme to a Control or Component

To attach an authorization scheme to a page component or control:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. From the Pages list, select a page name.

    The Page Definition appears.

  4. Click the name of the component or control to which you want to apply the authorization scheme.

  5. Scroll down to Authorization and make a selection from the Authorization Scheme list.

Viewing Authorization Scheme Utilization Reports

You can use the Authorization Scheme Utilization Report to view details about authorization schemes included in your application.

To view Authorization Scheme Utilization Report:

  1. Navigate to the Workspace home page.

  2. From the Applications list, select an application.

  3. On the Application Builder home page, click Shared Components.

    The Shared Components page appears.

  4. Under Security, select either Authorization.

  5. From the Navigation list, select either Authorization Scheme Utilization.

  6. Make a selection from the Authorization Scheme list and click Go.

  7. To view additional reports indicating which pages having authorization schemes and which do not, make a selection from the Tasks list.