public Optional<Pair<? extends RequestAbstractType, MessageContext>> fetch(
        final WebContext context, final Class<? extends RequestAbstractType> clazz) {
        LOGGER.trace("Attempting to fetch SAML2 authentication session from [{}]", context.getFullRequestURL());
        val currentContext = sessionStore.get(context, SamlIdPSessionEntry.class.getName());
        return currentContext.map(ctx -> (Map<String, SamlIdPSessionEntry>) ctx)
            .flatMap(ctx -> context.getRequestParameter(SamlIdPConstants.AUTHN_REQUEST_ID)
                .map(ctx::get)
                .or(Unchecked.supplier(() -> getSamlIdPSessionEntryFromRequest(context, ctx))))
            .filter(entry -> StringUtils.isNotBlank(entry.getSamlRequest()))
            .map(entry -> {
                val authnRequest = fetch(clazz, entry.getSamlRequest());
                val messageContext = SamlIdPAuthenticationContext.decode(entry.getContext()).toMessageContext(authnRequest);
                return Pair.of((AuthnRequest) messageContext.getMessage(), messageContext);
            });
    }
Retrieve authn request authn request.

@param context the context
@param clazz   the clazz
@return the request
support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/idp/SamlIdPSessionManager.java