public static Authentication getInProgressAuthentication() {
        val context = RequestContextHolder.getRequestContext();
        return Optional.ofNullable(context).map(WebUtils::getAuthentication).orElseGet(AuthenticationHolder::getCurrentAuthentication);
    }
Gets in progress authentication.

@return the in progress authentication
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java