|
15 | 15 | * the IDTokenSource interface and provides a method for obtaining ID tokens specifically from Azure |
16 | 16 | * DevOps Pipeline environment. |
17 | 17 | * |
18 | | - * <p>This implementation relies on the <a href="https://learn.microsoft.com/en-us/rest/api/azure/devops/distributedtask/oidctoken/create">Azure DevOps OIDC token API</a>. |
| 18 | + * <p>This implementation relies on the <a |
| 19 | + * href="https://learn.microsoft.com/en-us/rest/api/azure/devops/distributedtask/oidctoken/create">Azure |
| 20 | + * DevOps OIDC token API</a>. |
19 | 21 | */ |
20 | 22 | public class AzureDevOpsIDTokenSource implements IDTokenSource { |
21 | 23 | /* Access token for authenticating with Azure DevOps API */ |
@@ -99,7 +101,9 @@ private String validateEnvironmentVariable(String varName) { |
99 | 101 | varName)); |
100 | 102 | } |
101 | 103 | throw new DatabricksException( |
102 | | - String.format("Missing environment variable %s, likely not calling from Azure DevOps Pipeline", varName)); |
| 104 | + String.format( |
| 105 | + "Missing environment variable %s, likely not calling from Azure DevOps Pipeline", |
| 106 | + varName)); |
103 | 107 | } |
104 | 108 | return value; |
105 | 109 | } |
@@ -164,15 +168,9 @@ public IDToken getIDToken(String audience) { |
164 | 168 | throw new DatabricksException("Azure DevOps OIDC token response missing 'oidcToken' field"); |
165 | 169 | } |
166 | 170 |
|
167 | | - try { |
168 | | - String tokenValue = jsonResp.get("oidcToken").textValue(); |
169 | | - } catch (IllegalArgumentException e) { |
170 | | - throw new DatabricksException( |
171 | | - "Received invalid OIDC token from Azure DevOps: " + e.getMessage(), e); |
172 | | - } |
173 | | - |
| 171 | + String tokenValue = jsonResp.get("oidcToken").textValue(); |
174 | 172 | if (Strings.isNullOrEmpty(tokenValue)) { |
175 | | - throw new DatabricksException("Received empty OIDC token from Azure DevOps"); |
| 173 | + throw new DatabricksException("Received empty OIDC token from Azure DevOps"); |
176 | 174 | } |
177 | 175 | return new IDToken(tokenValue); |
178 | 176 | } |
|
0 commit comments