Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 
 

authid current_user Tips

Oracle Tips by Burleson Consulting

April 11, 2012

Question:  I need to understand the authid current_user syntax, and when to use authid current_user.

Answer:  The authid current_user is used when you want a piece of code (PL/SQL) to execute with the privileges of the current user, and NOT the user ID that created the procedure.  This is termed a "invoker rights", the opposite of "definer rights".

The authid current_user is the opposite of authid definer.

In the same sense, the authid current_user is the reverse of the "grant execute" where the current user does not matter, the privileges of the creating user are used.

PL/SQL, by default, run with the privileges of the schema within which they are created no matter who invokes the procedure. In order for a PL/SQL package to run with invokers rights AUTHID CURRENT_USER has to be explicitly written into the package.

To understand the authid current_user, consider this type definition:

CREATE TYPE address_t
   AUTHID CURRENT_USER
AS OBJECT (
   address_line1 varchar2(80),
   address_line2 varchar2(80),
   street_name varchar2(30),
   street_number number,
   city varchar2(30),
   state_or_province varchar2(2),
   zip number(5),
   zip_4 number(4),

   country_code varchar2(20));

The authid current_user clause tells the kernel that any methods that may be used in the type specification (in the above example, none) should execute with the privilege of the executing user, not the owner.

The default option is authid definer, which would correspond to the behavior in pre-Oracle8i releases, where the method would execute with the privileges of the user creating the type.

See this example of authid current_user to understand how this syntax causes invoker rights, which, in turn, changes the behavior of the PL/SQL code.

WARNING: Writing PL/SQL code with the default authid definer, can facilitate SQL injection attacks, because an intruder would get privileges that they would not get if they used authid current_user.

 

 

 
Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.


 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright ? 1996 -  2014

All rights reserved by Burleson

Oracle ? is the registered trademark of Oracle Corporation.


 

��
 
 
 
 

 
 
 

 
Oracle performance tuning software 
 
oracle dba poster
Oracle Linux poster