Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Commit 5f201bf

Browse files
sumauppayaminikb
authored andcommitted
Fixes #21223 : Fixed realm create and edit operations (#21973)
1 parent 88312fe commit 5f201bf

File tree

7 files changed

+13
-16
lines changed

7 files changed

+13
-16
lines changed

appserver/admingui/common/src/main/java/org/glassfish/admingui/common/handlers/SecurityHandler.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,6 @@ public static void saveRealm(HandlerContext handlerCtx) {
253253
putOptional(attrMap, propList, "assign-groups", "fileAsGroups");
254254
}else
255255
if(classname.indexOf("LDAPRealm")!= -1){
256-
if (!edit) {
257-
attrMap.put("baseDn", "\"" + attrMap.get("baseDn") + "\"");
258-
attrMap.put("directory", "\"" + attrMap.get("directory") + "\"");
259-
for (Map<String,String> m : propList) {
260-
m.put("value", "\"" + m.get("value") + "\"");
261-
}
262-
}
263256
putOptional(attrMap, propList, "jaas-context", "ldapJaax");
264257
putOptional(attrMap, propList, "base-dn", "baseDn");
265258
putOptional(attrMap, propList, "directory", "directory");

appserver/admingui/common/src/main/java/org/glassfish/admingui/common/handlers/UtilHandlers.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,7 @@ public static String escapePropertyValue(String str){
11161116
case '\\':
11171117
case '\'':
11181118
case '"':
1119+
case '=':
11191120
builder.append("\\");
11201121
builder.append(ch);
11211122
break;

appserver/admingui/common/src/main/java/org/glassfish/admingui/common/util/JSONUtil.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ public static String javaToJSON(Object obj, int depth) {
142142
case '\\':
143143
case '\'':
144144
case '"':
145+
case '=':
145146
builder.append("\\");
146147
builder.append(ch);
147148
break;

appserver/admingui/common/src/main/resources/security/realms/realmEdit.jsf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@
5959
urlencode(value="#{pageSession.configName}" encoding="UTF-8" result="#{pageSession.encodedConfigName}");
6060
setPageSessionAttribute(key="parentPage" value="#{request.contextPath}/common/security/realms/realms.jsf");
6161
setPageSessionAttribute(key="selfPage" value="#{request.contextPath}/common/security/realms/realmEdit.jsf?name=#{pageSession.encodedName}&configName=#{pageSession.encodedConfigName}");
62-
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/configs/config/#{pageSession.configName}/security-service/auth-realm/#{pageSession.encodedName}");
62+
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/configs/config/#{pageSession.encodedConfigName}/security-service/auth-realm/#{pageSession.encodedName}");
6363
setPageSessionAttribute(key="rest-api" value="true");
6464
getRealmAttrForEdit(endpoint="#{parentUrl}" attrMap=>$page{attrMap}, classnameOption=>$page{classnameOption}, realmClasses=>$page{realmClasses}, properties="#{pageSession.tableList}" );
6565
createMap(result="#{pageSession.valueMap}");
6666
mapPut(map="#{pageSession.valueMap}" key="target" value="#{pageSession.configName}");
6767
mapPut(map="#{pageSession.attrMap}" key="target" value="#{pageSession.valueMap['target']}");
6868
setPageSessionAttribute(key="myOption" value="$pageSession{classnameOption}");
69-
gf.restRequest(endpoint="#{sessionScope.REST_URL}/configs/config/#{pageSession.configName}/security-service/auth-realm/#{pageSession.Name}/supports-user-management.json?target=#{pageSession.configName}", method="get", result="#{requestScope.result}");
69+
gf.restRequest(endpoint="#{sessionScope.REST_URL}/configs/config/#{pageSession.encodedConfigName}/security-service/auth-realm/#{pageSession.encodedName}/supports-user-management.json?target=#{pageSession.encodedConfigName}", method="get", result="#{requestScope.result}");
7070
setPageSessionAttribute(key="showUserButton" value="#{false}");
7171
if ("#{requestScope.result.data['message']}=true") {
7272
setPageSessionAttribute(key="showUserButton" value="#{true}");

appserver/admingui/common/src/main/resources/security/realms/realmNew.jsf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@
7777
setPageSessionAttribute(key="edit" value="#{false}" );
7878
setPageSessionAttribute(key="showUserButton" value="#{false}" )
7979
getRequestValue(key="configName" value=>$page{configName} default="server-config");
80+
urlencode(value="#{pageSession.configName}" encoding="UTF-8" result="#{pageSession.encodedConfigName}");
8081
setPageSessionAttribute(key="parentPage" value="#{request.contextPath}/common/security/realms/realms.jsf");
81-
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/configs/config/#{pageSession.configName}/security-service");
82+
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/configs/config/#{pageSession.encodedConfigName}/security-service");
8283
setPageSessionAttribute(key="rest-api" value="true");
8384
getRealmAttrForCreate(attrMap=>$page{attrMap}, classnameOption=>$page{classnameOption}, realmClasses=>$page{realmClasses}, properties=>$page{props} );
8485
createMap(result="#{pageSession.valueMap}");

appserver/admingui/common/src/main/resources/security/realms/realms.jsf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,18 @@
5252
<event>
5353
<!beforeCreate
5454
getRequestValue(key="configName" value=>$page{configName});
55-
urlencode(value="#{pageSession.name}" encoding="UTF-8" result=>$page{encodedConfigName});
55+
urlencode(value="#{pageSession.configName}" encoding="UTF-8" result="#{pageSession.encodedConfigName}");
5656
setPageSessionAttribute(key="childType" value="auth-realm");
57-
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/configs/config/#{pageSession.configName}/security-service");
57+
setPageSessionAttribute(key="parentUrl", value="#{sessionScope.REST_URL}/configs/config/#{pageSession.encodedConfigName}/security-service");
5858
setPageSessionAttribute(key="selfUrl", value="#{pageSession.parentUrl}/#{pageSession.childType}");
5959
setPageSessionAttribute(key="rest-api" value="true");
6060
gf.getChildList(parentEndpoint="#{pageSession.parentUrl}", childType="#{pageSession.childType}", result="#{requestScope.listOfRows}");
6161
createMap(result="#{pageSession.valueMap}");
6262
mapPut(map="#{pageSession.valueMap}" key="target" value="#{pageSession.configName}");
6363
setPageSessionAttribute(key="confirmDeleteMsg" value="$resource{i18nc.msg.JS.confirmDeleteRealms}");
64-
setPageSessionAttribute(key="createLink" value="#{request.contextPath}/common/security/realms/realmNew.jsf?configName=#{pageSession.configName}");
65-
setPageSessionAttribute(key="listLink" value="#{request.contextPath}/common/security/realms/realms.jsf?configName=#{pageSession.configName}");
66-
setPageSessionAttribute(key="editLink" value="#{request.contextPath}/common/security/realms/realmEdit.jsf?configName=#{pageSession.configName}");
64+
setPageSessionAttribute(key="createLink" value="#{request.contextPath}/common/security/realms/realmNew.jsf?configName=#{pageSession.encodedConfigName}");
65+
setPageSessionAttribute(key="listLink" value="#{request.contextPath}/common/security/realms/realms.jsf?configName=#{pageSession.encodedConfigName}");
66+
setPageSessionAttribute(key="editLink" value="#{request.contextPath}/common/security/realms/realmEdit.jsf?configName=#{pageSession.encodedConfigName}");
6767
setPageSessionAttribute(key="tableTitle" value="$resource{i18nc.realm.TableTitle}");
6868
/>
6969
</event>

appserver/admingui/common/src/main/resources/shared/listTableConfigButtons.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
getSelectedSingleMapRows(TableRowGroup="${tableRowGroup}" selectedRows=>$attribute{selectedRows});
6262

6363
if (#{pageSession['rest-api']}){
64-
gf.deleteConfigCascade(endpoint="#{pageSession.parentUrl}/#{pageSession.childType}", target="#{pageSession.valueMap['target']}", selectedRows="${selectedRows}");
64+
urlencode(value="#{pageSession.valueMap['target']}" encoding="UTF-8" result="#{encodedTargetName}");
65+
gf.deleteConfigCascade(endpoint="#{pageSession.parentUrl}/#{pageSession.childType}", target="#{encodedTargetName}", selectedRows="${selectedRows}");
6566
}
6667
//REST-TODO: need to ensure page that has additionalDeleteHandler to change to use rest-api
6768
if (#{pageSession.additionalDeleteHandler}){

0 commit comments

Comments
 (0)