diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/ArmChallengeAuthenticationPolicy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/ArmChallengeAuthenticationPolicy.java index 3b74abbcd487c..599f18db6537d 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/ArmChallengeAuthenticationPolicy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/ArmChallengeAuthenticationPolicy.java @@ -9,6 +9,7 @@ import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.management.implementation.http.AuthenticationChallenge; +import com.azure.core.util.CoreUtils; import reactor.core.publisher.Mono; import java.nio.charset.StandardCharsets; @@ -98,8 +99,15 @@ public Mono authorizeRequestOnChallenge(HttpPipelineCallContext context }); } - protected String[] getScopes(HttpPipelineCallContext context, String[] scopes) { - return scopes; + /** + * Gets the scopes for the specific request. + * + * @param context The request. + * @param scopes Default scopes used by the policy. + * @return The scopes for the specific request. + */ + public String[] getScopes(HttpPipelineCallContext context, String[] scopes) { + return CoreUtils.clone(scopes); } List parseChallenges(String header) { diff --git a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/AuthenticationPolicy.java b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/AuthenticationPolicy.java index ae8a4c06a37cc..fade979209d55 100644 --- a/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/AuthenticationPolicy.java +++ b/sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/AuthenticationPolicy.java @@ -30,7 +30,7 @@ public AuthenticationPolicy(TokenCredential credential, AzureEnvironment environ } @Override - protected String[] getScopes(HttpPipelineCallContext context, String[] scopes) { + public String[] getScopes(HttpPipelineCallContext context, String[] scopes) { if (CoreUtils.isNullOrEmpty(scopes)) { scopes = new String[1]; scopes[0] = ResourceManagerUtils.getDefaultScopeFromRequest(context.getHttpRequest(), environment);