@@ -95,7 +95,7 @@ public String index(ModelMap model, HttpServletResponse response) throws Excepti
9595 }
9696
9797 if (config .getQuickstart ().equals ("true" ) && config .getSelectedApiIndex ().equals (ApiIndex .ESIGNATURE ) &&
98- !(SecurityContextHolder .getContext ().getAuthentication () instanceof OAuth2AuthenticationToken )) {
98+ !(SecurityContextHolder .getContext ().getAuthentication () instanceof OAuth2AuthenticationToken )) {
9999 String site = ApiIndex .ESIGNATURE .getPathOfFirstExample ();
100100 response .setStatus (response .SC_MOVED_TEMPORARILY );
101101 response .setHeader (LOCATION_HEADER , site );
@@ -114,7 +114,7 @@ public String index(ModelMap model, HttpServletResponse response) throws Excepti
114114
115115 @ GetMapping (path = "/ds/mustAuthenticate" )
116116 public ModelAndView mustAuthenticateController (ModelMap model , HttpServletRequest req , HttpServletResponse resp )
117- throws IOException {
117+ throws IOException {
118118 model .addAttribute (LAUNCHER_TEXTS , config .getCodeExamplesText ().SupportingTexts );
119119 model .addAttribute (ATTR_TITLE , config .getCodeExamplesText ().SupportingTexts .LoginPage .LoginButton );
120120
@@ -124,11 +124,12 @@ public ModelAndView mustAuthenticateController(ModelMap model, HttpServletReques
124124 config .setIsConsentRedirectActivated (false );
125125 this .session .setAuthTypeSelected (AuthType .JWT );
126126
127- return new ModelAndView (new JWTAuthenticationMethod ().loginUsingJWT (config , session , redirectURL ));
127+ return new ModelAndView (
128+ new JWTAuthenticationMethod ().loginUsingJWT (config , session , redirectURL , ApiType .getScopeList ()));
128129 }
129130
130131 boolean isRedirectToMonitor = redirectURL .toLowerCase ().contains ("/m" ) &&
131- !redirectURL .toLowerCase ().contains ("/mae" );
132+ !redirectURL .toLowerCase ().contains ("/mae" );
132133 if (session .isRefreshToken () || config .getQuickstart ().equals ("true" )) {
133134 config .setQuickstart ("false" );
134135
@@ -148,12 +149,13 @@ private ModelAndView checkForMonitorRedirects(String redirectURL) {
148149 this .session .setAuthTypeSelected (AuthType .JWT );
149150 redirectURL = redirectURL != "/" ? redirectURL : session .getMonitorExampleRedirect ();
150151 this .session .setMonitorExampleRedirect (null );
151- return new ModelAndView (new JWTAuthenticationMethod ().loginUsingJWT (config , session , redirectURL ));
152+ return new ModelAndView (
153+ new JWTAuthenticationMethod ().loginUsingJWT (config , session , redirectURL , ApiType .getScopeList ()));
152154 }
153155
154156 @ GetMapping ("/pkce" )
155157 public RedirectView pkce (String code , String state , HttpServletRequest req , HttpServletResponse resp )
156- throws Exception {
158+ throws Exception {
157159 String redirectURL = getRedirectURLForJWTAuthentication (req , resp );
158160 RedirectView redirect ;
159161 try {
@@ -167,25 +169,25 @@ public RedirectView pkce(String code, String state, HttpServletRequest req, Http
167169 }
168170
169171 @ PostMapping ("/ds/authenticate" )
170- public RedirectView authenticate (ModelMap model , @ RequestBody MultiValueMap <String , String > formParams ,
171- HttpServletRequest req , HttpServletResponse resp ) throws Exception {
172+ public RedirectView authenticate (ModelMap model , @ RequestBody MultiValueMap <String , String > formParams ,
173+ HttpServletRequest req , HttpServletResponse resp ) throws Exception {
172174 if (!formParams .containsKey ("selectAuthType" )) {
173175 model .addAttribute ("message" , "Select option with selectAuthType name must be provided." );
174176 return new RedirectView ("pages/error" );
175177 }
176178
177179 String redirectURL = getRedirectURLForJWTAuthentication (req , resp );
178180
179- List <String > selectAuthTypeObject = formParams .get ("selectAuthType" );
181+ List <String > selectAuthTypeObject = formParams .get ("selectAuthType" );
180182 AuthType authTypeSelected = AuthType .valueOf (selectAuthTypeObject .get (0 ));
181183
182184 if (authTypeSelected .equals (AuthType .JWT )) {
183185 this .session .setAuthTypeSelected (AuthType .JWT );
184- return new JWTAuthenticationMethod ().loginUsingJWT (config , session , redirectURL );
186+ return new JWTAuthenticationMethod ().loginUsingJWT (config , session , redirectURL , ApiType . getScopeList () );
185187 } else {
186188 this .session .setAuthTypeSelected (AuthType .AGC );
187189 if (this .session .getIsPKCEWorking ()) {
188- return new ACGAuthenticationMethod ().initiateAuthorization (config );
190+ return new ACGAuthenticationMethod ().initiateAuthorization (config , ApiType . getScopeList () );
189191 } else {
190192 return getRedirectView (authTypeSelected );
191193 }
@@ -196,7 +198,7 @@ private String getRedirectURLForJWTAuthentication(HttpServletRequest req, HttpSe
196198 SavedRequest savedRequest = requestCache .getRequest (req , resp );
197199
198200 String [] examplesCodes = new String [] {
199- ApiIndex .CLICK .getExamplesPathCode (),
201+ ApiIndex .CLICK .getExamplesPathCode (),
200202 ApiIndex .ESIGNATURE .getExamplesPathCode (),
201203 ApiIndex .MONITOR .getExamplesPathCode (),
202204 ApiIndex .ADMIN .getExamplesPathCode (),
@@ -209,7 +211,7 @@ private String getRedirectURLForJWTAuthentication(HttpServletRequest req, HttpSe
209211
210212 if (indexOfExampleCodeInRedirect != -1 ) {
211213 Boolean hasNumbers = savedRequest .getRedirectUrl ().substring (indexOfExampleCodeInRedirect )
212- .matches (".*\\ d.*" );
214+ .matches (".*\\ d.*" );
213215
214216 return "GET" .equals (savedRequest .getMethod ()) && hasNumbers ? savedRequest .getRedirectUrl () : "/" ;
215217 }
@@ -220,8 +222,8 @@ private String getRedirectURLForJWTAuthentication(HttpServletRequest req, HttpSe
220222
221223 @ GetMapping (path = "/ds-return" )
222224 public String returnController (@ RequestParam (value = ATTR_STATE , required = false ) String state ,
223- @ RequestParam (value = ATTR_EVENT , required = false ) String event ,
224- @ RequestParam (required = false ) String envelopeId , ModelMap model ) {
225+ @ RequestParam (value = ATTR_EVENT , required = false ) String event ,
226+ @ RequestParam (required = false ) String envelopeId , ModelMap model ) {
225227 model .addAttribute (LAUNCHER_TEXTS , config .getCodeExamplesText ().SupportingTexts );
226228 model .addAttribute (ATTR_TITLE , "Return from DocuSign" );
227229 model .addAttribute (ATTR_EVENT , event );
0 commit comments