Skip to content

Commit e80d82e

Browse files
authored
Make getScopes in the ARM Authentication Policy Public (Azure#22120)
Make getScopes in the ARM Authentication Policy Public
1 parent 779a485 commit e80d82e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

sdk/core/azure-core-management/src/main/java/com/azure/core/management/http/policy/ArmChallengeAuthenticationPolicy.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.azure.core.http.HttpResponse;
1010
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
1111
import com.azure.core.management.implementation.http.AuthenticationChallenge;
12+
import com.azure.core.util.CoreUtils;
1213
import reactor.core.publisher.Mono;
1314

1415
import java.nio.charset.StandardCharsets;
@@ -98,8 +99,15 @@ public Mono<Boolean> authorizeRequestOnChallenge(HttpPipelineCallContext context
9899
});
99100
}
100101

101-
protected String[] getScopes(HttpPipelineCallContext context, String[] scopes) {
102-
return scopes;
102+
/**
103+
* Gets the scopes for the specific request.
104+
*
105+
* @param context The request.
106+
* @param scopes Default scopes used by the policy.
107+
* @return The scopes for the specific request.
108+
*/
109+
public String[] getScopes(HttpPipelineCallContext context, String[] scopes) {
110+
return CoreUtils.clone(scopes);
103111
}
104112

105113
List<AuthenticationChallenge> parseChallenges(String header) {

sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluentcore/policy/AuthenticationPolicy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public AuthenticationPolicy(TokenCredential credential, AzureEnvironment environ
3030
}
3131

3232
@Override
33-
protected String[] getScopes(HttpPipelineCallContext context, String[] scopes) {
33+
public String[] getScopes(HttpPipelineCallContext context, String[] scopes) {
3434
if (CoreUtils.isNullOrEmpty(scopes)) {
3535
scopes = new String[1];
3636
scopes[0] = ResourceManagerUtils.getDefaultScopeFromRequest(context.getHttpRequest(), environment);

0 commit comments

Comments
 (0)