Oracle9iAS Portal Developer Kit (PDK)
How to Build a URL-Based Portlet with Basic Authentication

Creation Date: January 18, 2002
Status: Production
Version: PDK Release 2, (9.0.2 and later)

Introduction

In the article How to Build a URL-Based Portlet with Single Sign-On to an External Application, you learned how to create a URL-based portlet that provided Single Sign-On to an external application requiring user credentials.  The example used in that article was MyYahoo! Weather.  PDK-URL Services also enables you to create URL-based portlets that provide Single Sign-On to URL applications that use basic authentication.

This article shows you how to create a URL-based portlet with Single Sign-On to an external application requiring basic authentication.  The example used in this article is Oracle MetaLink.

Assumptions

  1. You have successfully installed the PDK framework by following the article Installing the PDK Framework and Samples.
  2. You understand the steps required to display a URL-based portlet on a portal page.  Refer to the article Installing the URL-Based PDK Samples.

Creating an XML Provider Definition

Using a text editor, create an XML file for your portlet provider. Use the authentication and authType tags to specify that this portlet is to use basic authentication. You may use the sample XML file below (you must change the httpProxyHost and httpProxyPort values to point to your own proxy server and port). Please refer to the article Understanding provider.xml for URL-Based Portlets for an explanation of the required XML tags and their functions.

After you have created the file, save it somewhere on your file system and call it "provider.xml".

<?xml version = '1.0' encoding = 'UTF-8'?>
<?providerDefinition version="3.1"?>
   <provider class="oracle.portal.provider.v2.http.URLProviderDefinition">
   <providerInstanceClass>oracle.portal.provider.v2.http.URLProviderInstance</providerInstanceClass>
   <session>true</session>
   <authentication class="oracle.portal.provider.v2.security.Authentication">
      <authType>basic</authType>
   </authentication>
   <proxyInfo class="oracle.portal.provider.v2.ProxyInformation">
      <httpProxyHost>www-proxy.us.oracle.com</httpProxyHost>
      <httpProxyPort>80</httpProxyPort>
   </proxyInfo>
   <httpsProxyInfo class="oracle.portal.provider.v2.ProxyInformation">
      <httpsProxyHost>www-proxy.us.oracle.com</httpsProxyHost>
      <httpsProxyPort>80</httpsProxyPort>
   </httpsProxyInfo>
   <portlet class="oracle.portal.provider.v2.http.URLPortletDefinition">
      <id>1</id>
      <name>MetalinkPortlet</name>
      <title>Metalink Portlet</title>
      <description>This portlet displays an 3rd Party Application 
         which uses Basic Authentication as a portlet.  The 3rd party 
         application is Oracle Metalink</description>
      <timeout>100</timeout>
      <timeoutMessage>Metalink portlet timed out</timeoutMessage>
      <showEdit>false</showEdit>
      <showEditDefault>false</showEditDefault>
      <showPreview>false</showPreview>
      <showDetails>false</showDetails>
      <hasHelp>false</hasHelp>
      <hasAbout>false</hasAbout>
      <acceptContentType>text/html</acceptContentType>
      <registrationPortlet>false</registrationPortlet>
      <renderer class="oracle.portal.provider.v2.render.RenderManager">
         <showPage class="oracle.portal.provider.v2.render.http.URLRenderer">
            <contentType>text/html</contentType>
            <pageUrl>http://metalink.oracle.com/metalink/plsql/sit_main.showSitemap?p_showTitle=0</pageUrl>
            <filter class="oracle.portal.provider.v2.render.HtmlFilter">
               <headerTrimTag>&#60;body</headerTrimTag>
               <footerTrimTag>/body></footerTrimTag>
               <useAuthLinks>true</useAuthLinks>
            </filter>
         </showPage>
      </renderer>
      <securityManager class="oracle.portal.provider.v2.security.URLSecurityManager">
         <authorizType>public</authorizType>
      </securityManager>
   </portlet>
</provider>

Deploying Your Provider

To configure and deploy your provider on OC4J, please see the section called "Deploying Your Provider on OC4J" in the article, How to Build a URL-Based Portlet.

Creating the External Application

You now need to create a new external application in Oracle9iAS Portal for the Oracle MetaLink Portlet. This external application maps any given Portal user to a desired Oracle MetaLink account so that every Portal user can have Single Sign-On access to Oracle MetaLink.

  1. On the Administer tab in Oracle9iAS Portal, click Administer External Applications
  2. In the Administer External Applications screen, click Add External Application.
  3. Enter the following information.
    1. Application Name: PDK-URL Basic Auth Application
    2. Login URL: http://metalink.oracle.com/metalink/plsql/sit_main.showSitemap?p_showTitle=0
    3. User Name/ID Field Name: (leave this field blank)
    4. Password Field Name: (leave this field blank)
    5. Authentication Method:  BASIC AUTHENTICATION
  4. Click OK.

Registering the Provider

If you are registering your provider on Oracle9iAS Portal 3.1, the registration wizard includes fields for both the provider URL and the service identifier (it will still include fields for name, display name, description, etc., see the steps below). You should specify both the URL and the service name.

For Oracle9iAS Portal 3.0.9, you must register the provider by appending the service ID to the provider URL as shown below.

  1. On the Administer tab in Oracle9iAS Portal, click Add a Portlet Provider within the portlet called Provider.
  2. Enter the following provider information.
    1. Name: MetalinkProvider
    2. Display Name: PDK-URL Basic Auth Sample (Metalink)
    3. Timeout: 100
    4. Timeout Message: Basic Auth sample Timed Out
    5. Implementation Style: Web
    6. Provider Login Frequency: Once Per User Session
    7. Check the box: Require session specific information such as session id, user, and login time. This field is relevant only for Web providers.
    8. URL: [your provider URL, e.g., http://myhost.com:8888/jpdk/providers/urlbasicauth]
    9. Check the following radio button: The user's identity needs to be mapped to a different name in the Web provider's application, and/or the Web provider requires an external application login to establish a browser session. If selecting this option, specify the external application ID below.
    10. Click on the list of values box next to the External Application ID and select the PDK-URL Basic Auth Application.
  3. Click OK.

Adding the Portlet to a Page

Now add your new portlet to a page.  If you have not already entered your MetaLink credentials into the Login Server, you will see a message telling you to Update Login Information.  Click the link to enter your MetaLink account username and password.  After entering your credentials you will see the MetaLink portlet.

Now that you have successfully created URL-based portlet with single sign-on to an application that uses basic authentication, please look for other portlet development articles that describe how to add extra features to your portlet, including single sign-on to external URL-based applications, XML filtering and more.

Here are some reference articles to help you better understand the architecture and technical details of URL-based portlets:

Revision History:
Revision No Last Update
1.0 August 31, 2002

Oracle Corporation
World Headquarters
500 Oracle Parkway
Redwood Shores, CA 94065, USA
http://www.oracle.com/
Worldwide Inquiries:
1-800-ORACLE1
Fax 650.506.7200
Copyright and Corporate Info