@Override
 public AuthorizationRequest updateAfterApproval(
     AuthorizationRequest authorizationRequest, Authentication userAuthentication) {
   Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters();
   Set<String> scopes = new LinkedHashSet();
   for (Map.Entry<String, String> entry : approvalParameters.entrySet()) {
     String key = entry.getKey();
     String value = entry.getValue();
     if (value.equals("true")) {
       scopes.add(key);
     }
   }
   authorizationRequest.setScope(scopes);
   String flag = approvalParameters.get(approvalParameter);
   boolean approved = flag != null && flag.toLowerCase().equals("true");
   authorizationRequest.setApproved(approved);
   return authorizationRequest;
 }