Skip to content
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 @@ -34,6 +34,9 @@ public class AuthorizationRequestUrlParameters {
private String correlationId;
private boolean instanceAware;

//Unlike other prompts (which are sent as query parameters), admin consent has its own endpoint format
private static final String ADMIN_CONSENT_ENDPOINT = "https://login.microsoftonline.com/{tenant}/adminconsent";

Map<String, List<String>> requestParameters = new HashMap<>();

public static Builder builder(String redirectUri,
Expand Down Expand Up @@ -155,7 +158,14 @@ URL createAuthorizationURL(Authority authority,
Map<String, List<String>> requestParameters) {
URL authorizationRequestUrl;
try {
String authorizationCodeEndpoint = authority.authorizationEndpoint();
String authorizationCodeEndpoint;
if (prompt == Prompt.ADMIN_CONSENT) {
authorizationCodeEndpoint = ADMIN_CONSENT_ENDPOINT
.replace("{tenant}", authority.tenant);
} else {
authorizationCodeEndpoint = authority.authorizationEndpoint();
}

String uriString = authorizationCodeEndpoint + "?" +
URLUtils.serializeParameters(requestParameters);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ public enum Prompt {
*/
CONSENT("consent"),

/**
* An administrator should be prompted to consent on behalf of all users in their organization.
* <p>
* Deprecated, instead use Prompt.ADMIN_CONSENT
*/
@Deprecated
ADMING_CONSENT("admin_consent"),

/**
* An administrator should be prompted to consent on behalf of all users in their organization.
*/
Expand Down