Using secure application roles
Secure application roles can be used to grant roles selectively based on the specific needs of the application users. The main advantage is that secure application roles do not require hardcoded passwords in the application code, and can be enabled in the background using a stored procedure. In this way, you can develop some strict rules to allow users to receive certain privileges only while the application is in use. Also in this recipe we will create two users vw_america
and vw_europe
that will also be used in the further recipes.
Getting ready
All the steps will be performed on the HACKDB
database.
How to do it...
The application role will be enabled by using the default context sys_context
. A detailed coverage on contexts can be found in Chapter 5, Beyond Privileges: Oracle Virtual Private Database.
Connect as the user
system
. Create two usersvw_america
andvw_europe
and grant create session privilege to each of them as follows:SQL> create user vw_america...