Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
OraBlogs
[go: Go Back, main page]

Skip navigation elements to page contents
OraBlogs
Blogs: Currently selected tabAbout: Select to go to this tab

Welcome

OraBlogs aggregates Oracle community blogs. To include your blog on this page, email Brian Duff. Oracle employees should email blogs_us for more information about setting up an external blog.
Developed with

Look and Feel

About this feature

Bloggers (posts, last update)

Recent Posts

Ajax Security: Container Managed Security

Ajax - Asynchronous JavaScript and XML - clearly is in the focus of software development. Strongly associated with the new Web 2.0 term, Ajax today is everbody's darling.

Inspired by the promise and the developer uptake of Ajax, I thought on doing a reality check on one of my favorite pets: container managed security, authentication in particular. There are a couple of issues that just don't work well with container managed security

a) Basic Authentication logon dialogs cannot be customized
b) Forms based authentication takes the focus off the current page
c) Forms based authentication hardly works with JavaServer Faces pages because it requires the form to be submitted to j_security_check, something JSf is not capable todo

With Ajax, so my theory, I could request for a protected page, intercept the server side http response and do whatever I want.

For basic authentication, I could try and add the WWW-Authenticate: Basic username:password information to the header (where "username:password" need to be base64 encoded). I would repeat this game for as many attempts the user would need to eventually remember the correct password.

First surprise: You don't have to think so difficult, username and password can be passed to the server as part of the open function of the XmlHttpRequest object

username_var=document.htmlform.usernamefield.value;
password_var= document.htmlform.passwordfield.value;
requestObject = xmlHttpRequestHandler.createXmlHttpRequest();
requestObject.onreadystatechange=onReadyStateChangeResponse;
requestObject.open("POST","protectedpage.html",true);
requestObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
requestObject.send(null);

I think that authentication is a good usecase for synchronous Ajax requests because there is no sense in continuing the user work if there isn't a clear decision about who he is and what he is allowed to do.

Note that I used an asynchronous request - despite the fact I think the synchronous call is a better usecase - because this is what Ajax is good for. Using asynchronous requests allows you to add some end-user entertainment like showing a progress bar through the process of authentication. This can be done based on the current XmlHttpRequest state (0,1,2,3,4).

function onReadyStateChangeResponse(){
var ready = requestObject.readyState;
if(ready==0){
//animation 1 here
}else if(ready==1){
//animation 2 here
}
else if(ready==2){
//animation 3 here
}
...

}


Back to my authentication challenge: Basic autentication the Ajax way worked great! At least it did until I entered the wrong password. And there it was again, the browser logon dialog.

My lesson learned from this approach is that it is good to know that the XmlHttpRequest object cannot bypass container managed security. It seems that the browser looks at the returned http error code first before XmlHttpRequest gets to see it. Thus the browser logon dialog pops up instead of giving me a second change to do it my way.

Form based authentication is next. The idea is that I create a logon form that only retruns the JavaScript and form fields needed to send the logon information. I could use a <DIV></DIV> element to show the logon and error form instantly on my JSP page.

I haven't yet implemented this yet and thus cannot say if it is again a waste of my time, but one thing I can see already is that it is a far too complicated approach compared to how easy it is in Web 1.0 (Note that while Web 2.0 exist, there is no Web 1.0. I just don't want to call it the "old days Web" because the old days are too current).

I hope that Ajax isn't moving farther away from container managed security though and that there will be an option in the near future to programmatically handle this type of authentication.

A JAAS callback handler for Ajax also could make sense if it is integrated with the container. In fact, there are some more good requirements to list for good authentication in Ajax. Or, why should everybody deal himself with encryption, decryption and nonrepudation? Maybe wen browsers will become client comntainers similar to what J2EE containers are on the server. Of course, I don' forget that Ajax is not J2EE ;-)

I'll keep on trying and will post a note whenever I am blessed with some success, or a new lesson learned that is worth sharing.

Frank

Posted on Apr 24, 2006 1:37:28 AM by Frank Nimphius
The Letter W...
Interesting. I cannot imagine what would have to take place to add a new letter to the American-English alphabet. I cannot even imagine it happening. (I called it the American-English alphabet because the UK-English one doesn?t seem to pay any attention to the fact that the letter Z exists and adds all kinds of U?s where they don?t belong and so on?) But the Swedish have gone and done just
Posted on Apr 23, 2006 7:33:00 PM by Thomas Kyte
Shrek!
I'm pleased to be able to use that as a blog title. Shrek (as he seems to be known by most people in the Oracle Community) is actually Bill Thater. His blog lives here. I met Shrek for the first time at the Hotsos Symposium last month and he's a lovely guy and been doing this Oracle thing for quite a while. Check it out. I also noticed that everyone seems to be in transit just now. Mark Rittman's
Posted on Apr 23, 2006 5:25:00 PM by Doug Burns
Arrived at Collaborate'06, Nashville
I've arrived at the Collaborate'06 hotel now and it's about a quarter to seven in the morning. I flew in to Nashville around 4 o'clock yesterday and got down to the venue, about an hour later. You can tell I...
Posted on Apr 23, 2006 2:34:44 PM by Mark Rittman
Shifting time...
Shifting time.Definitely looking forward to the Beer and Sausage (love good sausages).
Posted on Apr 23, 2006 1:58:35 PM by Thomas Kyte
Big, bad disk.
Over on Doug Burn?s blog there is a link to an interesting piece on large disks. Some people would think that the data warehousing community would welcome large disks. But probably for the majority (those of us that use conventional relational databases) this is not the case. An exception may be for those people that use data warehouse appliances; here data is hashed across all the available disks
Posted on Apr 22, 2006 10:35:55 PM by Peter Scott
BAHD for DBs
The Battle Against Huge Disks for Databases
Posted on Apr 22, 2006 9:38:00 AM by Doug Burns
[ws] Web?????????soapui
???????BPM(Oracle BPEL Process Manager)?ESB(Oracle ESB)????SOA????????????Web????????????????????????SOAP??????????????????? ???????????OracleAS Web Services?WSDL?URL????
Posted on Apr 22, 2006 1:00:00 AM by Naoki SATO
My site is moving so could go down for a short while

I have just completed the move of my site to the new dedicated host. Finally! with lots of trips away over the last month it has taken some time to get the new site up and running. I just have....[Read More]

Posted by Pete On 21/04/06 At 09:51 PM

Posted on Apr 21, 2006 9:54:21 PM by Pete Finnigan
Reading The Docs About Stuff You Know
How often do you read the reference guide for something you already know ? When I find little things like the one to follow, I wonder why Oracle doesn’t broadcast these small improvements more clearly. I needed to change the undo_retention parameter in a 10gR2 database. Unfortunately I forgot whether the parameter was in seconds or [...]
Posted on Apr 21, 2006 5:59:22 PM by Paul Vallee
Rootin'-Tootin' Blogs from Nashville
I'll be attending IOUG Collaborate next week in Nashville, Tenn. and will provide all the news that's fit to blog as it develops. The entire Oracle panoply is speaking there it seems - Charles Phillips, Thomas Kurian, Andy Mendelsohn, etc.

More important, though, looking forward to that BBQ...
Posted on Apr 21, 2006 4:54:57 PM by Justin Kestelyn
Spring days
It was a beautiful spring morning as I drove to Oracle in Reading today. I usually take the back roads through the Chiltern Hills as for me this is far quicker than the motorway route. Seeing the red kites hunting above the hills and the beech woods bursting into colour sets me up nicely for the day, even Reading?s traffic jams evaporated. Some days the world just looks too good.
Posted on Apr 21, 2006 4:49:28 PM by Peter Scott
Using a full Oracle Database with BPEL PM
Clemens Utschig has blogged about how to use the Oracle DB XE with BPEL developer install.  I have seen a couple of queries about this recently and thought it was worth repeating what Clement had said.  This is the configuration in which I run my BPEL installation on my laptop.
  • Install Oracle Database
    Should work with most versions, note that only certain DB versions are "certified" for use with BPEL, meaning they are tested and supported by Oracle.
  • Install BPEL developer on PC
    This will install Oracle Lite and configure the developer version to use this, we will fix this in a minute.
    Assume that we installed BPEL into $ORACLE_HOME then the $BPEL_HOME referred to in this entry will be $ORACLE_HOME/integration/orabpel
  • Create a user on the DB with connect and resource priviliges
    Using sqlplus connect to the database as user system or sys and create a user, the actual username and password doesn't matter.  Life will be easier if you start sqlplus from the $BPEL_HOME/system/database/scripts/server directory
    sqlplus system/manager@ORCL
    create user bpel101202 identified by bpel101202;

    grant connect, resource to bpel101202;
  • Install BPEL schema into DB using scripts in $BPEL_HOME/system/database/scripts/server
    Use your sqlplus session to login as the user you created (bpel101202 in our example) and execute the two scripts server_oracle.ddl and domain_oracle.ddl
    connect bpel101202/bpel101202
    @server_oracle.ddl
    @domain_oracle.ddl
  • Modify $BPEL_HOME/system/appserver/oc4j/j2ee/home/config/data-sources.xml to point at the database instead of OLite.
    Comment out the two Oracle Lite entries in the file
    <!-- Use these datasources to connect to Oracle Lite -->
    <!--
    <data-source class="com.evermind.sql.DriverManagerDataSource"
                 name="BPELServerDataSource"
                 location="jdbc/BPELServerDataSourceWorkflow"
                 xa-location="BPELServerDataSource"
                 ejb-location="jdbc/BPELServerDataSource"
                 connection-driver="oracle.lite.poljdbc.POLJDBCDriver"
                 username="system"
                 password="any"
                 max-connections="30"
                 min-connections="10"
                 connection-retry-interval="30"
                 max-connect-attempts="10"
                 url="jdbc:polite4@127.0.0.1:100:orabpel"/>
    <data-source class="com.evermind.sql.DriverManagerDataSource"
                 name="BPELSamplesDataSource"
                 location="jdbc/BPELSamplesDataSource"
                 xa-location="BPELSamplesDataSource"
                 ejb-location="jdbc/BPELSamplesDataSource"
                 connection-driver="oracle.lite.poljdbc.POLJDBCDriver"
                 username="system"
                 password="any"
                 max-connections="5"
                 min-connections="2"
                 connection-retry-interval="30"
                 max-connect-attempts="10"
                 url="jdbc:polite4@127.0.0.1:100:orabpel"/>
    <data-source class="com.evermind.sql.DriverManagerDataSource"
                 name="AdminConsoleDateSource"
                 location="jdbc/AdminConsoleDateSource"
                 xa-location="AdminConsoleDateSource"
                 ejb-location="jdbc/AdminConsoleDateSource"
                 connection-driver="oracle.lite.poljdbc.POLJDBCDriver"
                 username="system"
                 password="any"
                 max-connections="80"
                 min-connections="2"
                 connection-retry-interval="30"
                 max-connect-attempts="10"
                 url="jdbc:polite4@127.0.0.1:100:orabpel"/>
    -->
    Uncomment the Oracle 9i entries in the file (also works fine with 10g) and modify the three (3) entries to point to your database.
    <!-- Use this datasource to connect to Oracle 9i -->
    <data-source class="com.evermind.sql.DriverManagerDataSource"
             name="BPELServerDataSource"
             location="jdbc/BPELServerDataSourceWorkflow"
             xa-location="BPELServerDataSource"
             ejb-location="jdbc/BPELServerDataSource"
             connection-driver="oracle.jdbc.OracleDriver"
             max-connections="150"
             min-connections="10"
             connection-retry-interval="30"
             max-connect-attempts="10"
             url="jdbc:oracle:thin:orabpel101202/orabpel101202@localhost:1521:ORCL"/>

    <data-source class="com.evermind.sql.DriverManagerDataSource"
             name="BPELSamplesDataSource"
             location="jdbc/BPELSamplesDataSource"
             xa-location="BPELSamplesDataSource"
             ejb-location="jdbc/BPELSamplesDataSource"
             connection-driver="oracle.jdbc.OracleDriver"
             max-connections="150"
             min-connections="10"
             connection-retry-interval="30"
             max-connect-attempts="10"
             url="jdbc:oracle:thin:orabpel101202/orabpel101202@localhost:1521:ORCL"/>

    <data-source class="com.evermind.sql.DriverManagerDataSource"
                 name="AdminConsoleDateSource"
                 location="jdbc/AdminConsoleDateSource"
                 xa-location="AdminConsoleDateSource"
                 ejb-location="jdbc/AdminConsoleDateSource"
                 connection-driver="oracle.jdbc.OracleDriver"
                 max-connections="80"
                 min-connections="2"
             connection-retry-interval="30"
             max-connect-attempts="10"
             url="jdbc:oracle:thin:orabpel101202/orabpel101202@localhost:1521:ORCL"/>
Voila!  You should now be able to start BPEL Process Manager and it should be pointing to a full Oracle database.  If you want to run multiple versions of BPEL PM then just create a seperate database user for each version.

If it doesn't work and you get strange errors most likely cause is the data-sources.xml has not been edited correctly so shutdown BPEL PM, check your data-sources.xml and try again.

Note that in a production environment you may well run BPEL Process Manager inside a full application server (say an Oracle App Server mid-tier install) and so could use the nice GUI tools to change datasources.  Also it is worth pointing out that if you are using BPEL in a production environment then you should use it with a version of the database that BPEL PM has been certified with.

Posted on Apr 21, 2006 4:26:16 PM by Anthony Reynolds
750G Disks Are BAHD for DBs: A Call To Arms
I was reading the morning newspaper with a cup of coffee, well, actually I was reading slashdot.org, and I tripped across this story about some new 750G disks @ 7200 RPM soon to be released by Seagate. This filled me with a sense of dread about having to, once again, go through the process of [...]
Posted on Apr 21, 2006 3:33:12 PM by Paul Vallee
Need to login twice for Oracle Discoverer Plus
Having the problem that, each time when starting up Oracle Discoverer Plus (10.1.2) and you try to login, you need to login twice to because the first time login failed. Well here’s the solution to your problem. This behaviour is caused by an incorrect conversion of the URL in OC4J. Quick fix The shorttime solution (for end users) [...]
Posted on Apr 21, 2006 1:43:44 PM by IT Eye
Big Trouble In Little Kyoto
The Register has some interesting analysis of the slanging match that has developed between Larry Ellison and Red Hat chief executive Matthew Szulik sparked by the latter's purchase of JBoss. "Why...

[[ This is a content summary only. Visit my website for full links, other content, and more! ]]
Posted on Apr 21, 2006 1:17:00 PM by Andrew Clarke
dbms_sheduler jobs
I read in blog from Pete Finnigan about the potential security hole in DBMS_SCHEDULER package. DBMS_SCHEDULER as a new alternative for DBMS_JOB by Patrick Sinke Note that on some OS, like AIX5L / oracle 10.2.0.2, the job runs as ORACLE, not as NOBODY

[[ ... ]]
Posted on Apr 21, 2006 1:03:00 PM by Laurent Schneider
OCP Column
There is a new INSIDE OCP column in the Oracle Magazine this month (May-June 2006 Edition). It is about the Application Server exam. In the magazine, it is referenced as 1Z1-311, but the beta phase ended half a year ago, so the exam is now production 1Z0-311. I could guess most answers, and I hope I can succeed at first try, which is no sure thing. Anyway, I will try it next Friday at Oracle University in Baden/Zurich.

[[ ... ]]
Posted on Apr 21, 2006 12:39:00 PM by Laurent Schneider
JDeveloper tip of the week #1: Bring in the extras
New in JDeveloper 10.1.3 are scalable vector icons for the modelers. You have a choice of three predefined actor models. Just right click on an actor and select "Attach Image" to switch between them or use your own.

As well as the new kid on the block, "Big Head" Balthazar, there's a special cameo from Skeletor, reprising his role from 10.1.2 and previous releases, and Schubert. You may remember him from such Oracle products as Real Time Collaboration aka OIM. Troy McClure had other commitments.

actors in jdeveloper use case modeler

Posted on Apr 21, 2006 12:32:17 PM by Brian Duff
Wiring ADF into Ajax
If you're an ADF user and want to start to consume rich Ajax components then I have just the article for you. I've just published the following on the Ajax Resources Page on OTN: "Ajax Transactions Using ADF and JavaServer Faces".
In the paper I show how to hook Ajax callback events up so that they have access to ADF   [Read entire post...]
Posted on Apr 21, 2006 8:00:40 AM by Duncan Mills
And you thought your commute was bad!?!?!?
Non-oracle post here. How would you like to drive 370 miles to work. That's TO work. You would then turn around and drive back home in the evening. 740 miles per day. 7 hours a day in traffic. And the...
Posted on Apr 21, 2006 3:03:03 AM by Lewis Cunningham
Dimensions And Query Rewrite
AMIS has a good write-up about declaring dimensions to help query rewrite.
Posted on Apr 21, 2006 12:53:55 AM by Edward Stangler
Exploit code available for one of the bugs fixed in April 2006 CPU

Someone called N1V1Hd $3c41r3 has posted exploit code for the bug in the package function SYS.DBMS_EXPORT_EXTENSION.GET_DOMAIN_INDEX_METADATA to the bugtraq mailing list. The post is titled " Oracle 10g 10.2.0.2.0 DBA exploit " and it details how a package function can....[Read More]

Posted by Pete On 20/04/06 At 11:13 PM

Posted on Apr 20, 2006 11:19:39 PM by Pete Finnigan
Security expert calls for Oracle makeover

Security expert calls for Oracle makeover - by Martin Veitch "A UK security expert has called for change in Oracle’s security strategy, including the removal of the firm’s chief security officer.....[Read More]

Posted by Pete On 20/04/06 At 10:46 PM

Posted on Apr 20, 2006 10:55:21 PM by Pete Finnigan
BPEL: Implementing an async callback with the BPEL Java API
In yesterdays note about async miracles, I promised some more info on how to implement a callback with a listener on top of the BPEL java API.

Why would you want to do that? Well, of course you can use the API, to find your instance and then get the result, but this would be blocking again, as long as you are not using a thread - and this is exactly what we will do today.

First here are the steps how you'd do it normally:
  • Step 1: your async process needs a unique ID that you can find it back - the easiest way to this, is to use com.collaxa.cube.util.GUIDGenerator:generateGUID() which returns you a really unique id

  • Step 2: This id must be stored in the NormalizedMessage as property with name conversationId, or you can use the constant (NormalizedMessage.CONVERSATION_ID)

  • Step 3: Initiate your process with the post() api (com.oracle.bpel.client.delivery.IDeliveryService:post())

  • Step 4: due to the async delivery mechanism in BPEL (and worker picks up the message from the delivery queue - it might take some seconds 'til you find the instance) -> introduce some wait time

  • Step 5: Find the instance through it's conversationId, via lookupInstanceByConversationId on the Locator API, which get's you either an instance of IInstanceHandle, or an ORABPEL-02154 -> instance not found

  • Step 6: Check if the instance is closed (completed or faulted) by using IInstanceHandle:getState() and IInstanceHandle.STATE_CLOSED_COMPLETED, or IInstanceHandle.STATE_CLOSED_FAULTED

  • Last step is to retrieve the variable defined in you BPEL flow by using getField(String fieldName):java.util.Hashtable(). Why a hashtable? Because you can have multiple parts and each part is an entry here, with the key being the name of the part



Ok - back to the real callback implementation:

  • First we need to define some kind of callback interface, I decided to go with 2 methods, that a developer needs to implement

    • public void onResult (Map pResultMessageParts); which is called when the process has finished, and

    • public String getVariableName (); which is called by our thread to determine the field we need to return to the above content


    An implementation of this callback would be passed later on to the thread, and would be used to signal the callback.

  • Now it's time to dive into the BPEL interfaces, and get an idea of what information you'd need to query for an instance, and where to get it from

    • To logon to the domain you need a DomainAuth object (which represents a "BPEL" session) - this can be retrieved from the Locator:getDomainAuth()

    • A conversationId to find your process instance back

    • and the field name to examine the data, all from the interface described a step above



  • Next step was to implement a Thread (say be extending java.lang.Thread, that would query the BPEL Server for getting the instance, and later its state)

  • All you need to do next is add a constructor, that takes these parameters, and add some logic to the run() method - with a condition when the thread should stop. I chose to break after I triggered the callback's onResult method

  • The run() method does the following

    • has an initial sleep, to minimize the chance of an instance not found error

    • uses the Locator to findthe instance (lookupInstanceByConversationId)

    • asks the instance for it's state - if completed it (IInstanceHandle:getState())

    • retrieves the field (IInstanceHandle:getField(String))

    • and calls the onResult method on the passed callback instance. When this happens it breaks the loop



All you need to do now is to initiate the thread from your client program, pass the parameters, and start it :-D

Happy threading ..

Having questions? send your feedback on Implementing an async callback with the BPEL java api here
Posted on Apr 20, 2006 10:53:00 PM by Clemens Utschig
Blogs  |  About
The opinions expressed in these blogs are those of individual authors. This site is not owned or sponsored by Oracle Corporation.
OraBlogs Aggregator release 0.2. All your base are belong to us. $Id: orablogs.uix,v 1.4 2004/03/02 12:05:32 brian Exp $