if (!(messageContext instanceof SAMLMessageContext)) {
log.debug("Invalid message context type, this policy rule only supports SAMLMessageContext");
return;
}
SAMLMessageContext samlMsgCtx = (SAMLMessageContext) messageContext;
String messageIsuer = DatatypeHelper.safeTrimOrNullString(samlMsgCtx.getInboundMessageIssuer());
if (messageIsuer == null && requiredRule) {
log.error("Message contained no Issuer ID, replay check not possible");
throw new SecurityPolicyException("Message contained no Issuer ID, replay check not possible");
}
String messageId = DatatypeHelper.safeTrimOrNullString(samlMsgCtx.getInboundSAMLMessageId());
if (messageId == null && requiredRule) {
log.error("Message contained no ID, replay check not possible");
throw new SecurityPolicyException("SAML message from issuer " + messageIsuer + " did not contain an ID");
}