CAS 5.3.x introduces a breaking change to how RequestIDs are handled when validating SAML Services.
In 5.2.x (and all previous version of CAS), if the RequestID is not present, it will gracefully fail by returning a null value:
requestId = extractRequestId(requestBody);
/** * Extract request id from the body. * * @param requestBody the request body * @return the string */ private static String extractRequestId(final String requestBody) { if (!requestBody.contains("RequestID")) { LOGGER.debug("Request body does not contain a request id"); return null; }
try { final int position = requestBody.indexOf("RequestID=\"") + CONST_REQUEST_ID_LENGTH; final int nextPosition = requestBody.indexOf('"', position);
return requestBody.substring(position, nextPosition); } catch (final Exception e) { LOGGER.debug("Exception parsing RequestID from request.", e); return null; } } |
|
In 5.3.x, if the RequestID is not present it will throw a NullPointerException:
@NonNull
final Attribute requestIdAttribute = requestChild.getAttribute("RequestID"); |
|
requestId = requestIdAttribute.getValue();
This
change will break all versions of apereo/mod_auth_cas (See:
https://github.com/apereo/mod_auth_cas/issues/148) along with any other
client that does not properly implement support for the RequestID
parameter.
This
change should be reverted (this is as simple as removing the @NonNull
Lombok annotation so the request will failback to a null response).
Breaking every install of mod_auth_cas along with other legacy clients
cannot be considered acceptable.