Commit b0a0e2eb authored by michael.simon's avatar michael.simon
Browse files

change cookie value for idp/op preselection

Back to only number style. To be downwards compatible.
parent 8e7d10ad
......@@ -168,36 +168,24 @@ public class DiscoveryLoginBean implements Serializable {
Cookie idpCookie = cookieHelper.getCookie("preselect_idp");
if (idpCookie != null) {
String cookieValue = idpCookie.getValue();
if (cookieValue.startsWith("i_")) {
Long idpId = Long.parseLong(cookieValue.substring(2));
SamlIdpMetadataEntity idp = idpService.findById(idpId);
if (idp != null) {
selectedIdp = idp;
storeIdpSelection = true;
preSelectedIdp = true;
PrimeFaces.current().focus("quicklogin");
}
cookieValue = cookieValue.replaceAll("[^0-9]", "");
Long idpId = Long.parseLong(cookieValue);
SamlIdpMetadataEntity idp = idpService.findById(idpId);
if (idp != null) {
selectedIdp = idp;
storeIdpSelection = true;
preSelectedIdp = true;
PrimeFaces.current().focus("quicklogin");
}
else if (cookieValue.startsWith("o_")) {
Long opId = Long.parseLong(cookieValue.substring(2));
OidcRpConfigurationEntity op = oidcRpService.findById(opId);
else {
OidcRpConfigurationEntity op = oidcRpService.findById(idpId);
if (op != null) {
selectedIdp = op;
storeIdpSelection = true;
preSelectedIdp = true;
PrimeFaces.current().focus("quicklogin");
}
}
else if (cookieValue.matches("^[0-9]{1,}$")) {
Long idpId = Long.parseLong(cookieValue);
SamlIdpMetadataEntity idp = idpService.findById(idpId);
if (idp != null) {
selectedIdp = idp;
storeIdpSelection = true;
preSelectedIdp = true;
PrimeFaces.current().focus("quicklogin");
}
}
}
}
initialized = true;
......@@ -223,7 +211,7 @@ public class DiscoveryLoginBean implements Serializable {
sessionManager.setSpId(spConfig.getId());
sessionManager.setIdpId(idp.getId());
if (storeIdpSelection != null && storeIdpSelection) {
cookieHelper.setCookie("preselect_idp", "i_" + idp.getId().toString(), 356 * 24 * 3600);
cookieHelper.setCookie("preselect_idp", idp.getId().toString(), 356 * 24 * 3600);
}
else {
cookieHelper.setCookie("preselect_idp", "", 0);
......@@ -240,7 +228,7 @@ public class DiscoveryLoginBean implements Serializable {
sessionManager.setOidcRelyingPartyId(rp.getId());
if (storeIdpSelection != null && storeIdpSelection) {
cookieHelper.setCookie("preselect_idp", "o_" + rp.getId().toString(), 356 * 24 * 3600);
cookieHelper.setCookie("preselect_idp", rp.getId().toString(), 356 * 24 * 3600);
}
else {
cookieHelper.setCookie("preselect_idp", "", 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment