DB.DBA.DBEV_DAV_LOGIN (inout user_name varchar, in password varchar, in http_auth any);
This function, if defined, will always be called by Virtuoso just before a HTTP client is authenticated against the WebDAV Server. Three parameters are available for audit purposes or any other pre-processing purpose totally user definable.
The data structure of the http_auth is an array containing name/value pairs as described below.
For HTTP Basic authentication:
For HTTP Digest authentication:
An example of the http_auth value:
vector ('method', 'GET', 'authtype', 'basic', 'username', 'MyUser', 'pass', 'My!Secret')
This hook can be used to control how Virtuoso proceeds with the WebDAV client login by responding to 3 possible return values:
create procedure
DB.DBA.DBEV_DAV_LOGIN (inout user_name varchar, in pwd any, in auth any)
{
declare result any;
WHENEVER SQLSTATE '28000' GOTO validation_failure;
-- All accounts that are not WebDAV admin are going here
if (lcase(user_name) <> 'dav')
{
declare pass any;
-- use password from request if basic HTTP authentication is used
if (get_keyword ('authtype', auth) = 'basic')
pass := get_keyword ('pass', auth);
else -- or use the password from database if digest
pass := pwd_magic_calc (user_name, pwd, 1);
-- set appropriate LDAP protocol version
connection_set ('LDAP_VERSION', 2);
commit work;
result := LDAP_SEARCH('ldap://mail2.openlinksw.com:389',
0, 'ou=Accounts, o=OpenLink Software, c=US', sprintf ('(uid=%s)', user_name),
sprintf('uid=%s, ou=Accounts, o=OpenLink Software, c=US', user_name),
pass);
return 1;
}
-- normal authentication for WebDAV admin
return -1;
-- all accounts that are not authenticated by LDAP are rejected
validation_failure:
return 0;
};
|
Previous
SQL Parse Tree |
Chapter Contents |
Next
Associating Auxiliary Data With A Connection |