Home > AS/400 Tips > WebSphere Strategies for iSeries professionals > Authenticate use of Web applications via user profiles
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

WEBSPHERE STRATEGIES FOR ISERIES PROFESSIONALS

Authenticate use of Web applications via user profiles


Craig Pelkie
01.01.2005
Rating: -5.00- (out of 5)


iSeries news and advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


This tip is an excerpt of the article "Web authentication: Protecting your Web server" published in the January/February 2005 edition (volume 8, number 1) of the iSeries 400 Experts Journal. Provided courtesy of iSeries 400 Experts.


Authentication using OS/400 user profiles

One technique you can use to authenticate users to the HTTP server is to request and validate an OS/400 user profile and password. Although this approach will intuitively make sense to iSeries programmers and administrators, it offers the least flexibility. In most cases, it will be advisable to use this authentication method only if the Web application user population is limited to people in your enterprise who already have OS/400 user profiles. If you plan to let outsiders use the Web application, it is unlikely that you will want to create OS/400 user profiles for them.

It takes almost no time to configure your Web server to use OS/400 user profile authentication. Figure 2 shows the IBM Web Administration for iSeries page. As shown at the top of the image, the configuration is for a server named WEBSECURE. The server area being affected by the configuration is the root directory of the Web server. Once you navigate to the Web server and server area, you click the Security option in the navigation frame (the left frame on the page). On the Security page, click the Authentication tab and select the OS/400 user profiles option, as shown in the figure. You need to enter a text value for Authentication name or realm. The value you enter is displayed in the browser prompt, as shown in Figure 1.

Figure 1. The ultimate goal is to require a Web user to sign on with a user ID and password

Once you've selected the option and entered the authentication name, you simply restart your Web server. The next time you access the Web server, you will be prompted to enter the user ID and password.

More about the server area

In some cases, what I’ve described above will be all that you need. However, there is “the rest of the story” that you need to be aware of so that you’ll make proper choices for your environment when you use the OS/400 user profiles option.

Figure 2. Select the OS/400 user profiles option on the Authentication tab of the Security page

Starting at the top of Figure 2, you need to select the server area that you want to protect. The IBM HTTP server (powered by Apache) applies authentication based on directories in your Web site. The server area Directory / shown in Figure 2 does not mean that the authentication is applied to the root directory of the Integrated File System (IFS). Instead, the Directory / means that this authentication is applied to the document root of the server configuration. When you create a Web server configuration using the IBM HTTP Server Configuration wizard, you specify the document root. You can see the document root directory under the General Settings tab for the Global configuration server area, as shown in Figure 3. For the WEBSECURE Web server, the document root is the IFS directory /www/Websecure/htdocs. So when you select the Directory / in Figure 2 as the server area to protect, you are actually applying the authentication to the document root directory (/www/Websecure/htdocs).

Figure 3. The Document root is set when you create the Web server. View it on the General Server Configuration page

The important point to note is that you don’t necessarily have to protect the document root directory. For example, your Web site might contain a combination of static pages and dynamic pages. If the static pages are located in one directory and the dynamic pages in another, you can let all users into your site to access the static pages. You then configure authentication for the directory that contains the dynamic page resources. When Web users click a link in the static page part of your site that links into the dynamic page directory, they are prompted to enter their user ID and password. Many “membership” sites are configured this way, to allow users access to some of the site content but require a user ID and password for access to paid content.

Who’s running the show?

In Figure 2, the next decision you need to make is what user profile will be used after the authentication is completed. For example, you might look at Figure 1 and assume that because user cpelkie entered a user ID and password, the user profile cpelkie is used to process the request.

However, by default, the HTTP server ignores the user profile that is provided on the password entry prompt. In Figure 2, the Process requests using client’s authority option is set to Disabled. Another option, toward the bottom of Figure 2, is to use the OS/400 user profile to process requests.

The general rule is that when you use the default options, all requests to the IBM HTTP server for static pages are handled by user profile QTMHHTTP, and all requests for CGI programs are handled by user profile QTMHHTP1. That means that you need to pay attention to your IFS directory and file permissions so that those user profiles (or *PUBLIC) have read and execute access to the directories and files. (As an aside, I was always puzzled by the requirement for execute access to a directory until I learned that execute access is required for a user profile to search within and traverse a directory. If you have directories that are several levels deep, the user profile will need to execute access to the higher-level directories so that it can get to the lower-level directories.)

As shown in Figure 2, you have two additional options for designating the user profile that is used after authentication. If you change the Process requests using client’s authority to Enabled, the user profile that you enter in Figure 1 is used, much as with a green-screen sign-on. However, if you supply an OS/400 user profile to process requests (toward the bottom of Figure 2), you are essentially overriding the user profile that was entered with the specific user profile that you supply.

Rather than attempt to describe how these options are related, I refer you to Table 1. The table shows what happens when you select various combinations of OS/400 user profile and process request options.

Table 1. How the "process requests" options are related

Accessing the user profile in your programs

Before leaving the OS/400 user profile option, you should know that you could programmatically access the OS/400 user profile that is used to process your request. For example, in some programs, you might want to know the user profile name to perform additional processing based on that profile.

The HTTP server makes the user profile that was used for sign-on (in Figure 1) available to your program in an environment variable named REMOTE_USER. How you access an environment variable is language dependent; for example, RPG CGI uses a different technique than Net.Data.

If you enter the OS/400 user profile to process request option (bottom of Figure 2), you can also select the option to provide a profile token to CGI programs. When you use that option, you use the environment variable HTTP_AS_AUTH_PROFILETKN to access the profile token that was generated by the Web server to represent the user profile. In some cases, you might have to enter a user profile to sign on but provide a user profile to process requests (Result 5 in Table 1). If so, you can access both of the environment variables to determine the user profile used to sign on and the user profile that is used to process the request.

---------------------------
About the author: Craig Pelkie develops training materials for iSeries programmers. You can find information about his materials and additional articles at www.Lab400.com. He can be contacted at pelkie@Lab400.com.


This tip is an excerpt of the article "Web authentication: Protecting your Web server" published in the January/February 2005 edition (volume 8, number 1) of the iSeries 400 Experts Journal. Provided courtesy of iSeries 400 Experts.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
WebSphere Strategies for iSeries professionals
Application modernization strategies for System i
Application modernization in the i world
Natively supported Web applications for Power running i
Enterprise open source basics
Basic security considerations for a Domino/WebSphere system
Simplifying data access using Java Standard Tag Library
Integrating Microsoft ActiveX components with WebSphere
Choices for running Web workloads on iSeries
Virtual hosting for iSeries Web applications
Automate WebSphere configuration backups on the iSeries (i5)

Web Security
PCI data security standards and the System i
New chapter and verse on Ajax security
Secure your iSeries Web applications
Introduction to J2EE-based WebSphere security
Security services for each Web environment layer
Top advice on securing your iSeries
Top Security Issues for the Integrated File System (IFS)
Tightening iSeries security
How secure are you, really?
iSeries regains top spot for secure Web transactions

Web Development
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
IBM i shop boosts online sales with RPG-based Web platform
Migrating from RPG to EGL on IBM i
Groovy programming on IBM i
Running PHP open source applications: NOBODY needs authority
Zend Web software teams up with IBM System i
The best technologies and tools for System i programmers in 2009
Seven IBM i project lessons learned in 2008
AS/400 lessons from the past, present, and future: A holiday tale

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
WebSphere Development Studio Client (WDSC)  (Search400.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts