Updated 5 June 2023
Looking to secure your Oracle Database REST APIs served by ORDS using BASIC Auth? You can create an ‘ORDS’ user for this.
ORDS will have a set of known users and passwords that can be used to authenticate and authorize REST APIs.
When you create an ORDS user, you will be asked to provide:
- the name of the user
- a list of roles to grant to said user
- a password
One of the system roles ORDS maintains is ‘SQL Developer.’ This role is granted to any Database User authenticated session. You may for…reasons want to use that same Role to protect say an ORDS AUTOREST TABLE.
If the SCHEMA is ‘SCOTT’, you could then authenticate as SCOTT/TIGER when making GET, PUT, POST, DELETE calls to ords/scott/emp/ or ords/scott/emp/10
But, what if you wanted to create a user called ‘ords_dev’ that was only known to ORDS and not to the database?
ORDS 3 – 21.4
java -jar ords.war user ords_dev "SQL Developer"
By the way, this is covered in the Docs, the Admin and Dev Guide to be specific.
Now we’re cooking with gas. Now I can connect and pull down and push up modules for my RESTful Services.
ORDS 22.1 and higher
ords --config c:\ords\vbox23\ config user add ords_dev "SQL Developer"
Remember, you can use the –help for generating help on an ORDS command or subcommand.
❯ ords config user add --help ORDS: Release 23.1 Production on Mon Jun 05 12:49:44 2023 Copyright (c) 2010, 2023, Oracle. Configuration: /C:/ORDS/23.1/bin/ Usage: ords config user add [OPTIONS] <NAME> <ROLE> Add or update a user, specify its password and role(s). Options: -h, --help Show usage information for the command --password-stdin To run the ords config user add command non-interactively use this option to read the password value from STDIN Arguments: <name> The name of the user <role> One or more roles assigned to the user. Example: ords config user add user1 role1 Enclose in double quotes for multiple roles separated by commas, and for role(s) that contains spaces: ords config user add user2 "role1, role2" ords config user add user3 "Example Role" ORDS\23.1\bin took 2s