Skip to content

Commit

Permalink
Make getScopes in the ARM Authentication Policy Public (#22120)
Browse files Browse the repository at this point in the history
Make getScopes in the ARM Authentication Policy Public
  • Loading branch information
alzimmermsft committed Jun 7, 2021
1 parent 779a485 commit e80d82e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -98,8 +99,15 @@ public Mono<Boolean> 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<AuthenticationChallenge> parseChallenges(String header) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e80d82e

Please sign in to comment.