hanicz opened a new pull request, #1134: URL: https://github.com/apache/knox/pull/1134
…ls into DataSourceFactory [KNOX-3202](https://issues.apache.org/jira/browse/KNOX-3202) - Add support for Oracle DB as a Token State backend ## What changes were proposed in this pull request? - Added `com.oracle.database.jdbc.ojdbc11` dependency [FDHUT license](https://download.oracle.com/otn-pub/otn_software/jdbc/FDHUT_LICENSE.txt?AuthParam=1766128282_8dc11b81b7f2e6b326377dd9a559a1c9). - Refactored `JDBCUtils` into factory pattern so every class has its clear responsibilities. - Introduced a new enum for database types. - Created new sql files to separate derby, oracle and common DDL scripts. This removes the on-the-fly replace calls on a single DDL script. - Added new unit tests for Oracle database type. ## How was this patch tested? `mvn clear verify` Below manual tests: I started up Knox with a specific database type, created a new token, queried that token on the token management UI and also verified in the DB. Tested oracle, derby, mysql, postgres and mariadb locally with docker images Oracle: `gvenzl/oracle-free` `jdbc:oracle:thin:localhost:1521/FREEPDB1` MariaDB: `mariadb:11` `jdbc:mariadb://127.0.0.1:3306/testdb?user=testuser&password=testpass` MySQL: `mysql:8.4` PostgreSQL: `postgres:16` Oracle: ``` <property> <name>gateway.service.tokenstate.impl</name> <value>org.apache.knox.gateway.services.token.impl.JDBCTokenStateService</value> </property> <property> <name>gateway.database.type</name> <value>oracle</value> </property> <property> <name>gateway.database.port</name> <value>1521</value> </property> <property> <name>gateway.database.host</name> <value>localhost</value> </property> <property> <name>gateway.database.name</name> <value>FREEPDB1</value> </property> OR <property> <name>gateway.database.connection.url</name> <value>jdbc:oracle:thin:localhost:1521/FREEPDB1</value> </property> ``` ``` install/knox-3.0.0-SNAPSHOT/bin/knoxcli.sh generate-jwk --saveAlias knox.token.hash.key install/knox-3.0.0-SNAPSHOT/bin/knoxcli.sh create-aliases --alias gateway_database_user --value SYSTEM --alias gateway_database_password --value test install/knox-3.0.0-SNAPSHOT/bin/knoxcli.sh create-aliases --alias gateway_database_user --value appuser --alias gateway_database_password --value apppass ``` <img width="1873" height="754" alt="Screenshot 2025-12-19 at 8 29 50" src="https://github.com/user-attachments/assets/687baf0e-3cd9-4d39-b34e-fde93e005e88" /> <img width="1906" height="385" alt="Screenshot 2025-12-19 at 8 29 57" src="https://github.com/user-attachments/assets/ed4103b1-bb57-478c-9388-4c5911cce804" /> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
