|
39 | 39 | import reactor.core.publisher.Mono;
|
40 | 40 |
|
41 | 41 | import javax.net.ssl.HttpsURLConnection;
|
| 42 | +import java.io.File; |
42 | 43 | import java.io.IOException;
|
43 | 44 | import java.net.HttpURLConnection;
|
44 | 45 | import java.net.MalformedURLException;
|
|
50 | 51 | import java.net.URLEncoder;
|
51 | 52 | import java.nio.charset.StandardCharsets;
|
52 | 53 | import java.nio.file.Files;
|
| 54 | +import java.nio.file.Path; |
53 | 55 | import java.nio.file.Paths;
|
54 | 56 | import java.time.Duration;
|
55 | 57 | import java.time.OffsetDateTime;
|
|
65 | 67 | import java.util.function.Function;
|
66 | 68 | import java.util.function.Supplier;
|
67 | 69 |
|
| 70 | +import static com.azure.identity.implementation.util.ValidationUtil.validateSecretFile; |
| 71 | + |
68 | 72 | /**
|
69 | 73 | * The identity client that contains APIs to retrieve access tokens
|
70 | 74 | * from various configurations.
|
@@ -956,8 +960,10 @@ private Mono<AccessToken> authenticateToArcManagedIdentityEndpoint(String identi
|
956 | 960 | null));
|
957 | 961 | }
|
958 | 962 |
|
959 |
| - String secretKeyPath = realm.substring(separatorIndex + 1); |
960 |
| - secretKey = new String(Files.readAllBytes(Paths.get(secretKeyPath)), StandardCharsets.UTF_8); |
| 963 | + String secretKeyPathHeaderValue = realm.substring(separatorIndex + 1); |
| 964 | + Path secretKeyPath = validateSecretFile(new File(secretKeyPathHeaderValue), LOGGER); |
| 965 | + |
| 966 | + secretKey = new String(Files.readAllBytes(secretKeyPath), StandardCharsets.UTF_8); |
961 | 967 |
|
962 | 968 |
|
963 | 969 | if (connection != null) {
|
|
0 commit comments