-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure cloud from keyvault uri (#20530)
* identify and configure cloud environment from keyvault uri * add unit test to check url initialization * remove slash in base uri * refactor contructors * add changelog
- Loading branch information
Showing
17 changed files
with
151 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...lt/azure-security-keyvault-jca/src/main/java/com/azure/security/keyvault/jca/UriUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
package com.azure.security.keyvault.jca; | ||
|
||
/** | ||
* Constants used for Key Vault related URLs. | ||
*/ | ||
public class UriUtil { | ||
|
||
public static final String KEY_VAULT_BASE_URI_GLOBAL = "https://vault.azure.net"; | ||
public static final String KEY_VAULT_BASE_URI_CN = "https://vault.azure.cn"; | ||
public static final String KEY_VAULT_BASE_URI_US = "https://vault.usgovcloudapi.net"; | ||
public static final String KEY_VAULT_BASE_URI_DE = "https://vault.microsoftazure.de"; | ||
|
||
public static final String AAD_LOGIN_URI_GLOBAL = "https://login.microsoftonline.com/"; | ||
public static final String AAD_LOGIN_URI_CN = "https://login.partner.microsoftonline.cn/"; | ||
public static final String AAD_LOGIN_URI_US = "https://login.microsoftonline.us/"; | ||
public static final String AAD_LOGIN_URI_DE = "https://login.microsoftonline.de/"; | ||
|
||
static String getAADLoginURIByKeyVaultBaseUri(String keyVaultBaseUri) { | ||
String aadAuthenticationUrl; | ||
switch (keyVaultBaseUri) { | ||
case KEY_VAULT_BASE_URI_GLOBAL : | ||
aadAuthenticationUrl = AAD_LOGIN_URI_GLOBAL; | ||
break; | ||
case KEY_VAULT_BASE_URI_CN : | ||
aadAuthenticationUrl = AAD_LOGIN_URI_CN; | ||
break; | ||
case KEY_VAULT_BASE_URI_US : | ||
aadAuthenticationUrl = AAD_LOGIN_URI_US; | ||
break; | ||
case KEY_VAULT_BASE_URI_DE: | ||
aadAuthenticationUrl = AAD_LOGIN_URI_DE; | ||
break; | ||
default: | ||
throw new IllegalArgumentException("Property of azure.keyvault.uri is illegal."); | ||
} | ||
return aadAuthenticationUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.