There seems to be three common approaches for mapping an application end user to a database user.
- One to One Mapping: Each Application user (bob, nancy and fred) also get a corresponding database user account (bob nancy and fred).
- N to M mapping: Each application user is mapped to a database user that represents their role. bob and nancy are mapped to the 'clerk' database user while fred is mapped to the 'manager' database user.
- N to 1 mapping: Each application user is mapped to a single database user (app_user) and identity is only managed at the application tier.
It seems that #3 is the most common in web application development. Why is there not a greater emphasis on the other two options?
Oracle encourages techniques like #2 using its proxy authentication features for the following reason:
Limited trust model-controlling the users on whose behalf middle tiers can connect, and the roles the middle tiers can assume for the user
Scalability-by supporting lightweight user sessions and eliminating the overhead of re-authenticating clients
Accountability, by preserving the identity of the real user through to the database, and enabling auditing of actions taken on behalf of the real user