protected void notify(final Principal principal, final AbstractCasEvent event) throws Throwable {
        val eventDetails = event.toString();
        if (communicationsManager.isSmsSenderDefined()) {
            val sms = casProperties.getAuthn().getSurrogate().getSms();
            val text = SmsBodyBuilder.builder()
                .properties(sms)
                .parameters(Map.of("details", eventDetails))
                .build().
                get();

            val smsRequests = sms.getAttributeName()
                .stream()
                .map(attribute ->
                    SmsRequest.builder()
                        .principal(principal)
                        .attribute(SpringExpressionLanguageValueResolver.getInstance().resolve(attribute))
                        .from(sms.getFrom())
                        .text(text)
                        .build())
                .collect(Collectors.<SmsRequest>toList());

            communicationsManager.sms(smsRequests);
        } else {
            LOGGER.trace("CAS is unable to send surrogate-authentication SMS messages given no settings are defined to account for servers, etc");
        }
        if (communicationsManager.isMailSenderDefined()) {
            val emailAttributes = casProperties.getAuthn().getSurrogate().getMail().getAttributeName();
            emailAttributes.forEach(attribute -> sendEmail(principal, attribute, eventDetails, event.getClientInfo()));
        } else {
            LOGGER.trace("CAS is unable to send surrogate-authentication email messages given no settings are defined to account for servers, etc");
        }
    }
This is {@link DefaultSurrogateAuthenticationEventListener}.

@author Misagh Moayyed
@since 6.2.0
support/cas-server-support-surrogate-core/src/main/java/org/apereo/cas/authentication/event/DefaultSurrogateAuthenticationEventListener.java