Skip to content

Commit 4045970

Browse files
authored
Rollback MI MSI 2019 version support (Azure#17068)
1 parent 897fb53 commit 4045970

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

sdk/identity/azure-identity/src/main/java/com/azure/identity/AppServiceMsiCredential.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
*/
1717
@Immutable
1818
class AppServiceMsiCredential extends ManagedIdentityServiceCredential {
19-
private final String identityEndpoint;
2019
private final String msiEndpoint;
2120
private final String msiSecret;
22-
private final String identityHeader;
2321
private final ClientLogger logger = new ClientLogger(AppServiceMsiCredential.class);
2422

2523
/**
@@ -31,13 +29,8 @@ class AppServiceMsiCredential extends ManagedIdentityServiceCredential {
3129
AppServiceMsiCredential(String clientId, IdentityClient identityClient) {
3230
super(clientId, identityClient, "AZURE APP SERVICE MSI/IDENTITY ENDPOINT");
3331
Configuration configuration = Configuration.getGlobalConfiguration().clone();
34-
this.identityEndpoint = configuration.get(Configuration.PROPERTY_IDENTITY_ENDPOINT);
35-
this.identityHeader = configuration.get(Configuration.PROPERTY_IDENTITY_HEADER);
3632
this.msiEndpoint = configuration.get(Configuration.PROPERTY_MSI_ENDPOINT);
3733
this.msiSecret = configuration.get(Configuration.PROPERTY_MSI_SECRET);
38-
if (identityEndpoint != null) {
39-
validateEndpointProtocol(this.identityEndpoint, "Identity", logger);
40-
}
4134
if (msiEndpoint != null) {
4235
validateEndpointProtocol(this.msiEndpoint, "MSI", logger);
4336
}
@@ -50,7 +43,7 @@ class AppServiceMsiCredential extends ManagedIdentityServiceCredential {
5043
* @return A publisher that emits an {@link AccessToken}.
5144
*/
5245
public Mono<AccessToken> authenticate(TokenRequestContext request) {
53-
return identityClient.authenticateToManagedIdentityEndpoint(identityEndpoint, identityHeader, msiEndpoint,
46+
return identityClient.authenticateToManagedIdentityEndpoint(null, null, msiEndpoint,
5447
msiSecret, request);
5548
}
5649
}

sdk/identity/azure-identity/src/main/java/com/azure/identity/ManagedIdentityCredential.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public final class ManagedIdentityCredential implements TokenCredential {
3838
.identityClientOptions(identityClientOptions)
3939
.build();
4040
Configuration configuration = Configuration.getGlobalConfiguration().clone();
41+
//<<<<<<< HEAD
42+
// if (configuration.contains(Configuration.PROPERTY_MSI_ENDPOINT)) {
43+
// appServiceMSICredential = new AppServiceMsiCredential(clientId, identityClient);
44+
// virtualMachineMSICredential = null;
45+
//=======
4146
if (configuration.contains(Configuration.PROPERTY_IDENTITY_ENDPOINT)) {
4247
if (configuration.contains(Configuration.PROPERTY_IDENTITY_HEADER)) {
4348
if (configuration.contains(PROPERTY_IDENTITY_SERVER_THUMBPRINT)) {

sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ public void testValidServiceFabricCodeFlow() throws Exception {
225225
configuration.put("IDENTITY_ENDPOINT", endpoint);
226226
configuration.put("IDENTITY_HEADER", secret);
227227
configuration.put("IDENTITY_SERVER_THUMBPRINT", thumbprint);
228-
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("M/d/yyyy H:mm:ss XXX");
229-
String tokenJson = "{ \"access_token\" : \"token1\", \"expires_on\" : \"" + expiresOn.format(dtf) + "\" }";
228+
String tokenJson = "{ \"access_token\" : \"token1\", \"expires_on\" : \"" + expiresOn.toEpochSecond() + "\" }";
230229

231230
// mock
232231
mockForServiceFabricCodeFlow(tokenJson);

0 commit comments

Comments
 (0)