Blocking Users by IP Address in Oracle Apex

This tutorial will show you how you can block users from logging in by their IP address in Oracle Apex. Follow these steps:

Block Users by Their IP Address in Oracle Apex

Create a table to hold the list of IP addresses you want to block. Below is an example of a table:

Create Table block_ips (
   ip_address varchar2(100),
   block_date date
);

After creating the table, you can insert a record of your system IP address so that you would be able to test. Below is an example:

insert into block_ips values (owa_util.get_cgi_env('X-FORWARDED-FOR'), sysdate);

To learn how to record a user's IP address on logon, check the following tutorial:

Now create an Authorization Scheme and set the following properties:

  • Name: Block_IP
  • Scheme Type: NOT Exists SQL Query
  • SQL Query: add the below query:
Select 1 from block_ips where ip_address = owa_util.get_cgi_env('X-FORWARDED-FOR');
  • Identify error message displayed when scheme violated: You are blocked!
  • Validate authorization scheme: Always (No Caching)

Below is the screenshot of the above settings:

Create authorization scheme in Oracle Apex.

After configuring the above setting, click on Apply Changes button.

You have created an authorization scheme and you can now apply this scheme to your login page (9999) as shown below:

Block ip authorization scheme.

 

Vinish Kapoor
Vinish Kapoor

Vinish Kapoor is a seasoned software development professional and a fervent enthusiast of artificial intelligence (AI). His impressive career spans over 20 years, marked by a relentless pursuit of innovation and excellence in the field of information technology. As an Oracle ACE, Vinish has distinguished himself as a leading expert in Oracle technologies, a title awarded to individuals who have demonstrated their deep commitment, leadership, and expertise in the Oracle community.