TITLE
    WebObjects 4.5: Password Protecting the WOStats Page
Article ID:
Created:
Modified:
70152
3/2/00
12/8/00

TOPIC

    The WOStats page gives a WebObjects application administrator useful information about their application and its real-world usage. This document explains how to use password protection to keep external requests from accessing your site's statistics page.


DISCUSSION

    Overview

    If WebObjects 4.5 Update 2 or WebObjects Update 3 is installed, the WOStatsPage is protected by default. This document is only relevant if one of the WebObjects updates is not installed.

    By default, the password protection functions of WOStats are disabled. To enable them, you will need to change some of the files in the WOStatsPage project. The exact steps will depend on your operating system. After the function is enabled, it is easy to set a password in your application.

    Enabling Password Protection on MacOS X Server

    To enable password protection on MacOS X Server, first open the file

    System/Library/Frameworks/WOExtensions.framwork/Resources/WOStatsPage.wo

    in the WOBuilder application. If you do not have the development tools installed on this system, you will have to edit the files by hand; follow the instructions for Solaris and HP-UX systems, below.

    • After the file is open, switch to the "Text Mode" view. This will display the HTML file in the upper window, and the application .wod file in the lower window.
    • In the upper (HTML) window, line 10 is an HTML comment opening code, "<!--". Remove this line and the matching end comment line after the password object.
    • In the lower window, find the ALLOWED: WOConditional statement. The next line will read:

    condition=YES;

    Replace this statement with:

    condition=session.allowedToViewStatistics;

    • In the same window, find the "REFUSED: WOConditional" statement. The next line will read:

    condition=YES;

    Replace this statement with:

    condition=session.allowedToViewStatistics;

    Password protection is now enabled. Follow the instructions below to set a password for your application.

    Enabling Password Protection on Solaris or HP-UX

    To enable password protection on a Solaris or HP-UX system, first open this directory under your Apple root directory (usually /Apple or /opt/Apple):

    Library/Frameworks/WOExtensions.framwork/Resources/WOStatsPage.wo

    This directory will contains two files, WOStatsPage.html and WOStatsPage.wod. Using a text editor, make the following three changes:

    • Line 10 of the WOStatsPage.html file is an HTML comment opening code, "<!--". Remove this line and the matching end comment line after the password object.
    • In the WOStatsPage.wod file, find the "ALLOWED: WOConditional" The next line will read:

    condition=YES;

    Replace this statement with:

    condition=session.allowedToViewStatistics;

    • Also in the WOStatsPage.wod file, find the "REFUSED: WOConditional" statement. The next line will read:

    condition=YES;

    Replace this statement with:

    condition=session.allowedToViewStatistics;

    Password protection is now enabled. Follow the instructions below to set a password for your application.

    Enabling Password Protection on Windows NT 4.0

    To enable password protection on Windows NT, first open this directory under your Apple root directory (usually C:\Apple):

    Library/Frameworks/WOExtensions.framwork/Resources/WOStatsPage.wo/

    This directory will contains two files, WOStatsPage.html and WOStatsPage.wod. Using a text editor or WOBuilder, make the following three changes:

    • Line 10 of the WOStatsPage.html file is an HTML comment opening code, "<!--". Remove this line and the matching end comment line after the password object.
    • In the WOStatsPage.wod file, find the "ALLOWED: WOConditional" statement. Uncomment the next line and comment out the line that reads:

    condition=YES;

    The statement should now read:

    ALLOWED: WOConditional {
    condition=session.allowedToViewStatistics;
    //condition=YES;
    }

    • Also in the WOStatsPage.wod file, find the "REFUSED: WOConditional" statement. Uncomment the next line and comment out the line that reads:

    condition=YES;

    The statement should now read:

    REFUSED: WOConditional {
    condition=session.allowedToViewStatistics;
    //condition=YES;
    nagate="1";
    }


    Password protection is now enabled. Follow the instructions below to set a password for your application.


    Using Password Protection
    Once password protection is enabled, set the password in your Application.wos file's init method. The syntax is:

    [[self statisticsStore] setPassword: @"MyPassword"];


Document Information
Product Area: WebObjects
Category: WebObjects 4.5
Sub Category: Deployment
Keywords:

Copyright © 2000 Apple Computer, Inc. All rights reserved.