Skip to content

Commit b5bb501

Browse files
Add optional tenantId to Azure interactive auth (#263)
1 parent cd3e244 commit b5bb501

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

ojdbc-provider-azure/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,13 @@ The user can provide an optional parameter `AUTHENTICATION` (case-ignored) which
219219
<td><b>AZURE_CLIENT_ID</b> (only required for user assigned)</td>
220220
</tr>
221221
<tr>
222-
<td rowspan="2"><b>AZURE_INTERACTIVE</b></td>
223-
<td rowspan="2">InteractiveBrowserCredential</td>
224-
<td><b>AZURE_CLIENT_ID</b></td>
225-
<td><b>AZURE_REDIRECT_URL</b></td>
222+
<td rowspan="3"><b>AZURE_INTERACTIVE</b></td>
223+
<td rowspan="3">InteractiveBrowserCredential</td>
224+
<td rowspan="3">&nbsp;</td>
225+
<td><b>AZURE_TENANT_ID</b></td>
226226
</tr>
227+
<tr><td><b>AZURE_CLIENT_ID</b></td></tr>
228+
<tr><td><b>AZURE_REDIRECT_URL</b></td></tr>
227229
</tbody>
228230
</table>
229231

@@ -732,7 +734,7 @@ common set of parameters.
732734
<a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/reply-url">
733735
Redirect URL
734736
</a>
735-
for <code>authentication-method=interactive</code>
737+
for <code>authenticationMethod=interactive</code>
736738
</td>
737739
<td>
738740
A URL of the form <code>http://localhost[:port-number]</code> is accepted.
@@ -813,7 +815,8 @@ A browser link is output to the standard output stream.
813815
<dt>interactive</dt>
814816
<dd>
815817
Authenticate interactively by logging in to a cloud account with your
816-
default web browser. The browser window is opened automatically.
818+
default web browser. The browser window is opened automatically. The optional
819+
<code>tenantId</code> parameter may be configured to target a specific tenant.
817820
</dd>
818821
<dt>auto-detect</dt>
819822
<dd>

ojdbc-provider-azure/src/main/java/oracle/jdbc/provider/azure/authentication/TokenCredentialFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@ private static TokenCredential defaultCredentials(ParameterSet parameterSet) {
202202

203203
/**
204204
* Returns credentials for interactive authentication in a web browser.
205-
* @param parameterSet Configures the request with a client ID (optional), and
206-
* redirect URL (required).
205+
* @param parameterSet Configures the request with optional tenant ID, client ID,
206+
* and redirect URL.
207207
* @return Credentials for interactive authentication
208-
* //throws //TODO: What does this throw?
209208
*/
210209
private static InteractiveBrowserCredential interactiveCredentials(
211210
ParameterSet parameterSet) {
212211
return new InteractiveBrowserCredentialBuilder()
213212
.clientId(parameterSet.getOptional(CLIENT_ID))
213+
.tenantId(parameterSet.getOptional(TENANT_ID))
214214
.redirectUrl(parameterSet.getOptional(REDIRECT_URL))
215215
.build();
216216
}

0 commit comments

Comments
 (0)