Reworking the LAMP - moving authentication and access control to the database
Channel: Linux.conf.au 2009 -- Hobart, Australia
Date: 2014-12-08

Presenter(s): Robert (Bob) Edwards
URL: http://www.linux.org.au/conf/2009/programme/schedule/view_talk/66%3Fday=thursday.html

The standard LAMP methodology relies on the middleware application logicto manage user authentication and to impose access control over the datain the database. Typically access to the database is as a single user.In some cases, access to the database may be required from differentpieces of middleware simultaneously, maybe even from code written indifferent languages (PHP, Python, Java, C etc.). In order to keep theauthentication and access control consistent, it is necessary to pushthese functions into the database itself.This presentation will outline one approach developed using thePostgreSQL database server using views, triggers and the PL/pgSQL procedural language. A patch to PostgreSQL to allow an "at connection"trigger to invoke a PL/pgSQL function will also be discussed, as anperformance enhancement to the approach outlined. I will also discusssome of the development/debugging issues encountered by moving theauthentication and access control into SQL functions instead of PHPor Python.

http://lca2009.linux.org.au - http://www.linux.org.au
CC BY-SA - http://creativecommons.org/licenses/by-sa/4.0/legalcode.txt