Skip to content

Commit

Permalink
fix(jans auth server): well known uppercase grant_types response_mode (
Browse files Browse the repository at this point in the history
…#2706)

* fix(jans-auth-server): #2183 well-known/openid-configuration first request uppercase

* fix(jans-auth-server): #2183 using toString() to get value

* fix(jans-auth-server): #2183 return to use getValue() due to code analysis
  • Loading branch information
jmunozherbas committed Oct 24, 2022
1 parent 5a48592 commit 39f613d
Showing 1 changed file with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;

import static io.jans.as.model.configuration.ConfigurationResponseClaim.*;
import static io.jans.as.model.util.StringUtils.implode;
Expand Down Expand Up @@ -147,22 +144,22 @@ protected void processRequest(HttpServletRequest servletRequest, HttpServletResp
jsonObj.put(RESPONSE_TYPES_SUPPORTED, responseTypesSupported);
}

JSONArray responseModesSupported = new JSONArray();
List<String> listResponseModesSupported = new ArrayList<>();
if (appConfiguration.getResponseModesSupported() != null) {
for (ResponseMode responseMode : appConfiguration.getResponseModesSupported()) {
responseModesSupported.put(responseMode);
listResponseModesSupported.add(responseMode.getValue());
}
}
if (responseModesSupported.length() > 0) {
jsonObj.put(RESPONSE_MODES_SUPPORTED, responseModesSupported);
if (!listResponseModesSupported.isEmpty()) {
Util.putArray(jsonObj, listResponseModesSupported, RESPONSE_MODES_SUPPORTED);
}

JSONArray grantTypesSupported = new JSONArray();
List<String> listGrantTypesSupported = new ArrayList<>();
for (GrantType grantType : appConfiguration.getGrantTypesSupported()) {
grantTypesSupported.put(grantType);
listGrantTypesSupported.add(grantType.getValue());
}
if (grantTypesSupported.length() > 0) {
jsonObj.put(GRANT_TYPES_SUPPORTED, grantTypesSupported);
if (!listGrantTypesSupported.isEmpty()) {
Util.putArray(jsonObj, listGrantTypesSupported, GRANT_TYPES_SUPPORTED);
}

JSONArray acrValuesSupported = new JSONArray();
Expand Down

0 comments on commit 39f613d

Please sign in to comment.