code: protected String handleAuthenticationException(final AuthenticationException e, final RequestContext requestContext) {
          if (e.getHandlerErrors().containsKey(UnauthorizedServiceForPrincipalException.class.getSimpleName())) {
              val url = WebUtils.getUnauthorizedRedirectUrlFromFlowScope(requestContext);
              if (url != null) {
                  LOGGER.warn("Unauthorized service access for principal; CAS will be redirecting to [{}]", url);
                  return CasWebflowConstants.STATE_ID_SERVICE_UNAUTHZ_CHECK;
              }
          }
          val values = e.getHandlerErrors().values().stream().map(Throwable::getClass).collect(Collectors.toList());
          val handlerErrorName = this.errors
              .stream()
              .filter(values::contains)
              .map(Class::getSimpleName)
              .findFirst()
              .orElseGet(() -> {
                  LOGGER.debug("Unable to translate handler errors of the authentication exception [{}]. Returning [{}]", e, UNKNOWN);
                  return UNKNOWN;
              });
  
          val messageContext = requestContext.getMessageContext();
          val messageCode = this.messageBundlePrefix + handlerErrorName;
          messageContext.addMessage(new MessageBuilder().error().code(messageCode).build());
          return handlerErrorName;
      }
docs: Maps an authentication exception onto a state name equal to the simple class name of the handler errors.
  with highest precedence. Also sets an ERROR severity message in the
  message context of the form {@code [messageBundlePrefix][exceptionClassSimpleName]}
  for for the first handler
  error that is configured. If no match is found, {@value #UNKNOWN} is returned.
  
  @param e              Authentication error to handle.
  @param requestContext the spring context
  @return Name of next flow state to transition to or {@value #UNKNOWN}