Home » General

Combining Oracle ADF and OID

Written By: Pascal Alma on March 24, 2008 3 Comments

In an upcoming project, I have to work with the Oracle Internet Directory. The situation: there are some existing Oracle Report and Forms applications. I will help them to develop their first Oracle ADF application. All these applications will use SSO for the authentication and autorisation. The accounts for the SSO are stored in OID. Now, I have used SSO before, but that was just the Java SSO of OC4J container (as described here). And this jSSO was based on a file-based sevurity provider. But now I have to use the Oracle SSO and it must be based on the Oracle Identity Management Security Provider instead of the XML file.
So this extra long weekend (in Holland we have an extra day off because of Easter) I started to look in to this matter. The first thing to do was to install the OID. I soon found out that this isn't installable as a separate product like Oracle XE, for example. I eventually ended up here and downloaded the necessary stuff (Oracle Identity Management Infrastructure and Oracle Identity Federation).
Running the setup went without any 'big' issues and some minutes later I had it running on my machine. (The only issue I had was that I had to remove the environment variable 'ORACLE_HOME' which I used for running the standalone OC4J Server on my laptop).
The first thing I wanted to try out was to use an ADF application in combination with the OID, without the SSO part. As ADF application I used the TUHRA application. TUHRA stands for 'The Ultimate Human Resource Application' and can be found here. Tha application is used in the book 'Oracle JDeveloper 10g for Forms & PL/SQL Developers' about which I blogged before. Anyway, if you have worked yourself through chapter 14 (about security), you will end up with an ADF application that has a web.xml that has something similar to:

XML:
  1. ...
  2.  <security-constraint>
  3.     <web-resource-collection>
  4.       <web-resource-name>AdminZone</web-resource-name>
  5.       <url-pattern>faces/pages/admin/*</url-pattern>
  6.     </web-resource-collection>
  7.     <auth-constraint>
  8.       <role-name>admin</role-name>
  9.     </auth-constraint>
  10.   </security-constraint>
  11.   <security-constraint>
  12.     <web-resource-collection>
  13.       <web-resource-name>UserZone</web-resource-name>
  14.       <url-pattern>faces/pages/*</url-pattern>
  15.     </web-resource-collection>
  16.     <auth-constraint>
  17.       <role-name>admin</role-name>
  18.       <role-name>user</role-name>
  19.       <role-name>manager</role-name>
  20.     </auth-constraint>
  21.   </security-constraint>
  22.   <login-config>
  23.     <auth-method>FORM</auth-method>
  24.     <form-login-config>
  25.       <form-login-page>security/login.jsp</form-login-page>
  26.       <form-error-page>security/login.jsp</form-error-page>
  27.     </form-login-config>
  28.   </login-config>
  29.   <security-role>
  30.     <role-name>admin</role-name>
  31.   </security-role>
  32.   <security-role>
  33.     <role-name>user</role-name>
  34.   </security-role> <security-role>
  35.     <role-name>manager</role-name>
  36.   </security-role>
  37. ...

If you deploy the application to your standalone OC4J Server, it will default use the file-based security provider. So the first thing to do is to modify the OC4J instance, so you can also use the OID as security provider. You do this to go to the OC4J Enterprise Manager and click the tab 'Administration'. See this picture:
OC4J Administration You can then choose the option 'Identity Management' in the topic 'Security' and setup the connection to the OID installation you just did:
Config Identity Management
After this, you can change the security provider for each deployed application by choosing the option 'Security Providers' in the topic 'Security'. See this picture:
OC4J App Level Security
The final thing to configure is the TUHRA application itself. If you open the project 'ViewController' in JDeveloper, you can find a file 'orion-application.xml' in the directory 'META-INF'. With this file you can tell OC4J the application uses the LDAP security provider by giving the file the following content:

XML:
  1. <orion-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-application-10_0.xsd">
  2. ...
  3. <jazn provider="LDAP" default-realm="jazn.com"/>
  4. ...
  5. </orion-application>

Now deploy the application and run it. You can now only access the application with users that are defined in the OID and that belong to a group in the OID that matches one of the roles in the web.xml, like this:
OID User

So far, so good, but now for the next challenge: to use the Oracle SSO module. A quick look at the documentation and howto makes me conclude that this cannot be done with a simple standalone OC4J Server, because a HTTP server is required. But I will dive into this and if I have it running, I will post it rightaway :)

Tags: ,

Digg this!Add to del.icio.us!Stumble this!Add to Techorati!Share on Facebook!Seed Newsvine!Reddit!Add to Yahoo!

3 Responses to “Combining Oracle ADF and OID”

  1. Jean-Marc Desvaux said:

    You can also use in JDev, the ADF Security Wizard (in Tools menu) which updates the LDAP url, realm etc.. (realm should not be jazn.com like you set here but the actual IDM default realm of your OID). It also adds adfAuthentification to your project which enhances/extents J2EE security.

  2. ks said:

    Have you succeeded in your next challenge, namely standalone oc4j 'work' with Oracle SSO?

  3. Pascal Alma said:

    Hi KS,

    I must admit I haven't tried it anymore. The customer has got it running, but only with a full Oracle AS instance (including Apache webserver).

Copyright © 2009 Pascal’s Blog, All rights reserved.| Powered by WordPress