[DBAUTH] owa.cfg = /usr/oracle/ows2/admin/owa.cfg server.cfg = /usr/oracle/ows2/admin/svdbaut2.cfg authenticate = ows-bin owa_dba web_authent_prefix = web$ dirSeparator = /We can see that
This authentication mechanism, logging users in using their own username/password, is really quite simple. Using WebServer 2.0.3 and up, we can supply a replacement routine for doing Basic Authentication. This routine is called immediately before the routine that produces the page and returns either TRUE or FALSE signifying success (yes, this client can get this page) or failure (deny access to this page, put up the 'Authorization Failed' dialog).
When our cartridge is started up, it will process the contents of the svXXXX.cfg (to discover valid mime types and the like), svXXXX.app (to get the DBAUTH section), and the owa.cfg file. Using the information from the DBAUTH section of the svXXXX.app, we can determine what DCD's will require a username/password and which ones won't.
Every time a request comes into our cartrige, we determine from the URL what the DCD name is. The general form of any OWA URL is:
http://YourHost/X/Y/Z/DCDName/owa/ProcedureName eg: http://aria.us.oracle.com/wa/ows-bin/owa/owa_util.print_cgi_envwhere
http://aria.us.oracle.com/wa/ows-bin/owa/x/y/z/index.htmlis a valid URL that can return a page. It would be using our version of Database Server Side Includes. The assumption would be that
http://aria.us.oracle.com/x/y/z/index.htmlwould map to some physical file and would return such a file. Our Web Agent replacement will find the same file, look for <ORACLE> tags in it and preprocess it, inserting the output of pl/sql blocks into it.
http://YourHost/ows-bin/owa/x/y/z/document.name for example http://YourHost/ows-bin/owa/x/y/z/sensitive.pdf
See Database Server Side Includes.
For more info on this capability.
Logging Off
In order to understand how we 'logoff', it is useful to understand how Basic
Authentication works in the first place.
This is not a basic question actually, it's pretty complex. Lets start with
a freshly loaded browser. Lets say at site1, the url /foo/ is protected via
basic authentication. Then......
----------------------------------------- GET /foo/hello.html HTTP/1.0 -----------------------------------------
------------------------------------------- Content-Type: text/html Status: 401 Unauthorized WWW-Authenticate: Basic realm="SomeRealmName" This document is protected. You must send the proper authorization information to access it. -------------------------------------------
------------------------------------- GET /foo/hello.html HTTP/1.0 Username: scott:tiger -------------------------------------------------(the username: part is wrong, I forget what the client puts there but the point is made... some other word then username goes there)
-------------------------------------------
Content-Type: text/html
Status: 401 Unauthorized
WWW-Authenticate: Basic realm="SomeRealmName"
This document is protected. You must send the proper authorization information
to access it.
-------------------------------------------
the browser will take the hostname/portno/someRealmName and look in its little
in memory cache. this time it will find it since we just did it a couple of
pages ago. It will resend the request with the username and password and we
get our page.....
This brings us now to, how do you log off. What we need to do is trick the browser into remembering a 'bad' username/password pair for a given Realm/Host/Port. We do this in the cartridge (or cgi-bin) application by recognizing a special URL, 'LogMeOff'. In order to log off you will:
http://YourHost:YourPort/YourDCDName/owa/LogMeOffThis will alway cause the cartridge to fail authentication (unless the magic username is used). It will not attempt to log in or do anything in the database, it will just fail the authentication.
This will cause the browser to pop up the basic authentication dialog. No matter what combination of username/password you put in, it will fail at this point (unless the magic username is used). In order to complete the 'logout', you would enter "bye" in the username field. This will cause the cartridge to signal success on the authorization and send back a static page to the web browser. This page simply states "You are de-authenticated". The next time you visit a regular page, you will be prompted for a username/password since the username 'bye' is not a valid username for the page.
This implies 2 things:
The owner of this package needs the 'ALTER USER' privilige. They need this privilige granted directly to them. They cannot get this privilige via a role.
The simplest way to use this package is to:
http://YourHost:YourPort/YourDCDName/owa/change_password.show_formThis will generate a form that looks like: