Oracle9iAS Portal Developer Kit (PDK)
How to Build URL-Based Portlets with SSO to External Applications

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, you learned how to create a portlet that displayed the content of a URL-based application.  The example used in that article was Google.com.  However, often, you may wish to create a URL-based portlet that retrieves its content from an external application that is protected.  In other words, the URL you wish to display in your portlet may require you to enter specific user credentials.  With the PDK, you can create URL-based portlets that provide single sign-on to external applications requiring user credentials.

This article shows you how to create a URL-based portlet with Single Sign-On to an external application requiring user credentials.  The example used in this article is MyYahoo! Weather.  This example uses cookie-based sign-in.  If the URL you are using uses a different sign-in mechanism (i.e., basic authentication), please refer to the appropriate article.

Assumption

  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 external application-based 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>ExternalApp</authType>
      <errorPageMessages>Invalid Yahoo ID/Password.</errorPageMessages>
   </authentication>
   <proxyInfo class="oracle.portal.provider.v2.ProxyInformation">
      <httpProxyHost>www-proxy.us.oracle.com</httpProxyHost>
      <httpProxyPort>80</httpProxyPort>
   </proxyInfo>
   <portlet class="oracle.portal.provider.v2.http.URLPortletDefinition">
      <id>1</id>
      <name>Yahoo Weather Portlet</name>
      <title>Yahoo Weather Portlet</title>
      <description>This is a PDK-URL Services sample portlet that 
        demonstrates single sign-on to an external application.</description>
      <timeout>100</timeout>
      <timeoutMessage>yahoo timed out</timeoutMessage>
      <acceptContentType>text/html</acceptContentType>
      <showEdit>false</showEdit>
      <showEditToPublic>false</showEditToPublic>
      <showEditDefault>false</showEditDefault>
      <showPreview>false</showPreview>
      <showDetails>false</showDetails>
      <hasHelp>false</hasHelp>
      <hasAbout>false</hasAbout>
      <renderer class="oracle.portal.provider.v2.render.RenderManager">
         <showPage class="oracle.portal.provider.v2.render.http.URLRenderer">
            <contentType>text/html</contentType>
            <pageUrl>http://weather.yahoo.com</pageUrl>
            <filter class="oracle.portal.provider.v2.render.HtmlFilter">
               <headerTrimTag>&#60;body</headerTrimTag>
               <footerTrimTag>/body></footerTrimTag>
            </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 Yahoo! Single Sign-On Portlet. This external application map any given Portal user to a desired Yahoo! account so that every Portal user can have Single Sign-On access to Yahoo! Weather.

  1. Go to the Administer tab in Oracle9iAS Portal , then click Administer External Applications.  In the Administer External Applications screen, click Add External Application.
  2. Enter the following information.
    1. Application Name: PDK-URL Auth External App
    2. Login URL: http://login.yahoo.com
    3. User Name/ID Field Name: login
    4. Password Field Name: passwd
    5. Authentication Method:  POST
  3. Click OK.

Registering the Provider

If you are registering your provider on Oracle9iAS Portal 3.1, the registration wizard will include 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: YahooProvider
    2. Display Name: PDK-URL Authenticated External App (Yahoo)
    3. Timeout: 100
    4. Timeout Message: Yahoo sample Timed Out
    5. Implementation Style: Web
    6. Provider Login Frequency: Once Per User Session
    7. URL: [your provider URL, e.g., http://myhost.com:8888/jpdk/providers/urlexternalauth]
    8. 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 for establishment of a browser session. If selecting this option, specify the external application ID below
    9. Click on the list of values box next to the External Application ID. Select the PDK-URL Auth External App
  3. Click OK.

Adding the Portlet to the Page

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

Now that you have successfully built your own external application portlet using the PDK, please look for future articles that will guide you through adding services to your portlet such as SSL handling, inline rendering of links, parameter passing, etc.

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 28, 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