Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make getScopes in the ARM Authentication Policy Public #22120

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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