Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #8 from Azure-Samples/sagonzal/updateRedirectName
Browse files Browse the repository at this point in the history
Update getRedirectUrl to getAuthorizationCodeUrl
  • Loading branch information
sangonzal authored Sep 16, 2019
2 parents bc187c9 + 0493a0d commit d55ee4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/main/java/com/microsoft/azure/msalwebsample/AuthHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,19 @@ void sendAuthRedirect(HttpServletRequest httpRequest, HttpServletResponse httpRe
SessionManagementHelper.storeStateAndNonceInSession(httpRequest.getSession(), state, nonce);

httpResponse.setStatus(302);
String redirectUrl = getRedirectUrl(httpRequest.getParameter("claims"), scope, redirectURL, state, nonce);
httpResponse.sendRedirect(redirectUrl);
String authorizationCodeUrl = getAuthorizationCodeUrl(httpRequest.getParameter("claims"), scope, redirectURL, state, nonce);
httpResponse.sendRedirect(authorizationCodeUrl);
}

String getRedirectUrl(String claims, String scope, String registeredRedirectURL, String state, String nonce)
String getAuthorizationCodeUrl(String claims, String scope, String registeredRedirectURL, String state, String nonce)
throws UnsupportedEncodingException {

String urlEncodedScopes = scope == null ?
URLEncoder.encode("openid offline_access profile", "UTF-8") :
URLEncoder.encode("openid offline_access profile" + " " + scope, "UTF-8");


String redirectUrl = authority + "oauth2/v2.0/authorize?" +
String authorizationCodeUrl = authority + "oauth2/v2.0/authorize?" +
"response_type=code&" +
"response_mode=form_post&" +
"redirect_uri=" + URLEncoder.encode(registeredRedirectURL, "UTF-8") +
Expand All @@ -170,7 +170,7 @@ String getRedirectUrl(String claims, String scope, String registeredRedirectURL,
"&state=" + state
+ "&nonce=" + nonce;

return redirectUrl;
return authorizationCodeUrl;
}

private IAuthenticationResult getAuthResultByAuthCode(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ public ModelAndView getUsersFromGraph(HttpServletRequest httpRequest, HttpServle

SessionManagementHelper.storeStateAndNonceInSession(httpRequest.getSession(), state, nonce);

String redirectUrl = authHelper.getRedirectUrl(
String authorizationCodeUrl = authHelper.getAuthorizationCodeUrl(
httpRequest.getParameter("claims"),
"User.ReadBasic.all",
authHelper.getRedirectUriGraphUsers(),
state,
nonce);

return new ModelAndView("redirect:" + redirectUrl);
return new ModelAndView("redirect:" + authorizationCodeUrl);
} else {

mav = new ModelAndView("error");
Expand Down

0 comments on commit d55ee4a

Please sign in to comment.