public Optional<Authentication> isCasAuthenticationAvailable(final WebContext context) {
        val webContext = (JEEContext) context;
        if (webContext != null) {
            val tgtId = ticketGrantingTicketCookieGenerator.retrieveCookieValue(webContext.getNativeRequest());

            if (StringUtils.isNotBlank(tgtId)) {
                val authentication = ticketRegistrySupport.getAuthenticationFrom(tgtId);
                if (authentication != null) {
                    return Optional.of(authentication);
                }
            }
        }
        return Optional.empty();
    }
Is cas authentication available?

@param context the context
@return the optional authn
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/util/OidcRequestSupport.java