I am currently porting several Windows desktop applications to a single website.
The current setup includes several basic SQL Server databases configured with Windows Authentication (SSPI) only, and each user / group / role has specific rights to certain objects. This is convenient because at the application level, access control is not necessary.
I would like to keep it the same as with the web server, Apache on a Windows machine. But every connection to the database is done using an Apache account. This is understandable and expected, because Apache intentionally gains access to public data in order to provide public content.
But if a domain user logs in (the login process has already been implemented), I would like the Apache process to process the request to impersonate this user and, thus, execute them throughout the request.
At first I tried using php fastcgi.impersonate using IIS as a web server. But in the end, I refused this, mainly because (1) we still had to port to Apache and (2) it was php-specific, and it turned out that we should focus on the web server as a whole ...
So, I redirected my search to Apache modules. Months of research yielded nothing but mod_auth_sspi and the like, which is obviously not what I am looking for (authentication and personification are two different things).
Finally, I decided to create my own module. Most of the examples of "101" that I could find are written in C, but I managed to find 2-3 in Lazarus / FPC , which I have been using for a long time, but never for such a task.
I know that I need to create a .dll project, I know (more or less) which units to use, and I know that functions such as LogonUser()and ImpersonateLoggedOnUser()should be in my toolbox.
Has anyone done something like this? Can someone point me in the right direction?
An example will be appreciated, even if it is a simple proof of concept. This question is far from asking for a final final decision.