Skip to content

Commit f1385c4

Browse files
committed
removed the call of security helper in ACGAuthorizationMethod
1 parent 077470f commit f1385c4

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/main/java/com/docusign/core/controller/IndexController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ public RedirectView pkce(String code, String state, HttpServletRequest req, Http
159159
String redirectURL = getRedirectURLForJWTAuthentication(req, resp);
160160
RedirectView redirect;
161161
try {
162-
redirect = new ACGAuthenticationMethod().exchangeCodeForToken(code, config, session, redirectURL);
162+
redirect = new ACGAuthenticationMethod().exchangeCodeForToken(code, config, session, redirectURL,
163+
ApiType.getScopeList());
163164
} catch (Exception e) {
164165
redirect = getRedirectView(AuthType.AGC);
165166
this.session.setIsPKCEWorking(false);

src/main/java/com/docusign/core/security/acg/ACGAuthenticationMethod.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public RedirectView exchangeCodeForToken(
4444
String oAuthToken,
4545
DSConfiguration configuration,
4646
Session session,
47-
String redirect) throws Exception {
47+
String redirect,
48+
List<String> scopes) throws Exception {
4849
String requestBody = buildRequestBody(oAuthToken);
4950
String authHeader = generateAuthHeader(configuration);
5051

@@ -59,7 +60,7 @@ public RedirectView exchangeCodeForToken(
5960
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
6061

6162
if (response.statusCode() == 200) {
62-
processTokenResponse(response.body(), configuration, session);
63+
processTokenResponse(response.body(), configuration, session, scopes);
6364
} else {
6465
throw new IOException("Failed to exchange code for token. Status code: " + response.statusCode());
6566
}
@@ -79,7 +80,8 @@ private String generateAuthHeader(DSConfiguration configuration) {
7980
(configuration.getUserId() + ":" + configuration.getSecretUserId()).getBytes(StandardCharsets.UTF_8));
8081
}
8182

82-
private void processTokenResponse(String responseBody, DSConfiguration configuration, Session session)
83+
private void processTokenResponse(String responseBody, DSConfiguration configuration, Session session,
84+
List<String> scopes)
8385
throws Exception {
8486
ApiClient apiClient = new ApiClient(configuration.getBasePath());
8587
String accessToken = SecurityHelpers.parseJsonField(responseBody, "access_token");
@@ -88,7 +90,7 @@ private void processTokenResponse(String responseBody, DSConfiguration configura
8890
OAuth.UserInfo userInfo = apiClient.getUserInfo(accessToken);
8991
String accountId = userInfo.getAccounts().size() > 0 ? userInfo.getAccounts().get(0).getAccountId() : "";
9092

91-
SecurityHelpers.setSpringSecurityAuthentication(SecurityHelpers.getScopeList(), accessToken, userInfo,
93+
SecurityHelpers.setSpringSecurityAuthentication(scopes, accessToken, userInfo,
9294
accountId, session,
9395
expiresIn);
9496
}

0 commit comments

Comments
 (0)