Pages

Monday, December 15, 2008

Using a WebLogic provider as authentication for ADF Security in 11G

With ADF Security of Jdeveloper 11g you can use ldap or a table as authentication provider in WebLogic. To make for example a new ldap provider see my blog or the one of Frank Nimphius.
Next blog I will show you how can use user and group tables as a provider in WLS.

First before we the ADF Security wizard we first need to configure WebLogic. I will using the internal WLS server of JDeveloper 11G. Start the instance and go to http://localhost:7101/console/ Go to the security realms. Default is your realm 'myrealm' and not jazn.com.



Go to your security provider and change the Control flag from optional to sufficient. Then this provider is used in the authentication process

Change the default authenticator from required to sufficient else the provider will never be used.


Now we can run the ADF Security wizard in JDeveloper 11g

Just use a authentication type


Now choose LDAP


Just fill in some values, it does not matter. ADF wil use the WebLogic LDAP provider

And we are finished with the wizard.

Change the weblogic.xml where we will map valid-users to users (Users is a role in WLS )




<?xml version = '1.0' encoding = 'windows-1252'?>

<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">

<security-role-assignment>

<role-name>valid-users</role-name>

<principal-name>users</principal-name>

</security-role-assignment>

</weblogic-web-app>





Now we have tto change the jazn-data.xml where we will add the realm and add the roles.

These roles will be used in the page authorization.

We need to use myrealm as realm and not jazn.com. Create the valid-users role



Create a valid-users application role

Now open the pagedef of the JSF page and add a security policy to this page or you can open the jazn-data.xml and select the page.

Select the page and select a role where we add actions to this role.

Now run your application and authenticate against the WebLogic provider





Here is the final result.


Probably this will change in other 11G versions where the ADF Security wizard will configure WLS.

Friday, December 5, 2008

Deploy your 11G webapp to a WebLogic Server

Deploying your web application from JDeveloper 11g to a WebLogic 10.3 Server is not so simple as with the internal WebLogic server of JDeveloper. Off course we need to install the WebLogic 10.3 and install the ADF runtime 11g to this server ( See my previous blog for this ).

The first step is to create the datasource in WebLogic. In the configuration of the ADF BC applications modules you can see what should be the jndi name in WLS. Default is this, the database connection name of the application with DS. For example database connection = scott then the jndi name will be jdbc/scottDS

Create the jdbc datasource in WLS

Very important, you must enable this datasource by selecting a target. Default the target is not selected and the datasource is disabled.
Add a war deployment to your application.
Give the application a root context.
Now we need to add a ear deployment to your application.

You have to select the just created war deployment profile. In the ear deployment contains the weblogic-deployment.xml where is defined that this application needs the adf 11g library
Now we can deploy the ear to WebLogic server
Here the result of the deployment
In the deployment view we can see our application with its j2ee modules
In the ADF 11g library deployment we can see the just deployed application as a reference to this library

Wednesday, December 3, 2008

Flat file to xml with Oracle Service Bus

With OSB you can easy transform a formatted flat file to a xml. To do this in OSB you have to create a MFL and XQuery definition. MFL is the output of the Format Builder tool where you can create descriptions of non XML files. XQuery can use the output of MFL to generate the xml.

This is an example of the flat file
10;0123456789;MR;JOHN;SMITH
20;0123456789;ACCT1
30;0123456789;SALARY;500000
30;0123456789;BONUS;1000
20;0123456789;ACCT2
30;0123456789;OTHER;100
10;1234566790;MR;DAVID;DOE
20;1234567890;ACCT1
30;1234567890;SALARY;10000

And this is the record definition of the flat file

one block is made of:
one record 10 (customer)
1 to N record 20 per record 10 (accounts)
1 to N record 30 per record 20 (transactions)

record 10
customer id
customer lastname
customer firstname

record 20
customer id
account id

record 30
customer id
label
value

Create a new MFL in the Oracle Workshop for Weblogic ( Eclipse plugin )

This will start Format builder tool where we can define the records groups and test the result.

First we add group 10 ( customer ) as child of the main element. Then we define the fields of recordtype 10. As child group of customer we add the Account group etc.

Here is a picture of the customer group where I enabled that the group is tagged option, with as value 10; and the group occurence is unlimited.
I add a child field which can occur once and has ; as delimiter

The last field of the record has as delimiter \n ( end of line )

Now we can test it ( menu tools and test ). Load the non xml data and transforms this to xml.

I made a new xml schema with I can use as target in Xquery. This is the xsd
Now we can create a new XQuery file where we can use the just created MFL definition as non xml source type and the xml schema as target type.


Let's map the source element to the targets element.
We are finished with XQuery and now we can create a proxy service. This proxy does the transformation and pass the xml output to an other service.

Create a new proxy service with messaging as service type. As Request message type we have to use the just created MFL.

Create a new message flow in this proxy service where we add 3 operations ( 2 assign and one insert )

In the first assign we will use the XQuey file and drag the personel in the body variable to the XQuery variable. Pass the output of this assign to the xml variable

In the second assign we will create a new body and pass this to the body variable

The last operation is insert, In this operation we copy the content of the xml variable to the body variable.

That's all now we have converted the flat file to a xml which we can passed on to other business services.