Skip to content

Commit d972d7c

Browse files
Thick: fixed the ability to use external authentication with connection
pools.
1 parent f363c25 commit d972d7c

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

doc/src/release_notes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ For deprecations, see :ref:`Deprecations <deprecations>`.
1010
oracledb 1.1.0 (TBD)
1111
--------------------
1212

13+
Thick Mode Changes
14+
++++++++++++++++++
15+
16+
#) Fixed the ability to use external authentication with connection pools.
17+
1318

1419
oracledb 1.0.1 (June 2022)
1520
--------------------------

src/oracledb/impl/thick/pool.pyx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ cdef class ThickPoolImpl(BasePoolImpl):
9191
create_params.pingInterval = params.ping_interval
9292
common_params.stmtCacheSize = params.stmtcachesize
9393
common_params.sodaMetadataCache = params.soda_metadata_cache
94+
create_params.externalAuth = params.externalauth
9495

9596
# prepare user, password and DSN for use
9697
if self.username is not None:

tests/test_5000_externalauth.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#------------------------------------------------------------------------------
2+
# Copyright (c) 2022, Oracle and/or its affiliates.
3+
#
4+
# This software is dual-licensed to you under the Universal Permissive License
5+
# (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
6+
# 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
7+
# either license.
8+
#
9+
# If you elect to accept the software under the Apache License, Version 2.0,
10+
# the following applies:
11+
#
12+
# Licensed under the Apache License, Version 2.0 (the "License");
13+
# you may not use this file except in compliance with the License.
14+
# You may obtain a copy of the License at
15+
#
16+
# https://www.apache.org/licenses/LICENSE-2.0
17+
#
18+
# Unless required by applicable law or agreed to in writing, software
19+
# distributed under the License is distributed on an "AS IS" BASIS,
20+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21+
# See the License for the specific language governing permissions and
22+
# limitations under the License.
23+
#------------------------------------------------------------------------------
24+
25+
"""
26+
5000 - Module for testing external authentication
27+
"""
28+
29+
import unittest
30+
31+
import oracledb
32+
import test_env
33+
34+
@unittest.skipIf(test_env.get_is_thin(),
35+
"thin mode doesn't support external authentication yet")
36+
class TestCase(test_env.BaseTestCase):
37+
require_connection = False
38+
39+
def test_5000_pool_with_user_and_password_and_externalauth_enabled(self):
40+
"""
41+
5000 - test error on creating a pool with user and password specified
42+
and externalauth enabled
43+
"""
44+
self.assertRaisesRegex(oracledb.DatabaseError, "^DPI-1032:",
45+
test_env.get_pool, min=1, max=2, increment=1,
46+
getmode=oracledb.POOL_GETMODE_WAIT,
47+
externalauth=True, homogeneous=False)
48+
49+
def test_5001_pool_with_no_password_and_externalauth_enabled(self):
50+
"""
51+
5001 - test error on creating a pool without password and with user
52+
specified and externalauth enabled
53+
"""
54+
self.assertRaisesRegex(oracledb.DatabaseError, "^DPI-1032:",
55+
oracledb.create_pool,
56+
user=test_env.get_main_user(),
57+
min=1, max=2, increment=1,
58+
getmode=oracledb.POOL_GETMODE_WAIT,
59+
externalauth=True, homogeneous=False)
60+
61+
def test_5002_pool_with_no_user_and_externalauth_enabled(self):
62+
"""
63+
5002 - test error on creating a pool without user and with password
64+
specified and externalauth enabled
65+
"""
66+
self.assertRaisesRegex(oracledb.DatabaseError, "^DPI-1032:",
67+
oracledb.create_pool,
68+
password=test_env.get_main_password(),
69+
min=1, max=2, increment=1,
70+
getmode=oracledb.POOL_GETMODE_WAIT,
71+
externalauth=True, homogeneous=False)
72+
73+
if __name__ == "__main__":
74+
test_env.run_test_cases()

0 commit comments

Comments
 (0)