@GetMapping(path = BASE_ENDPOINT_SERVICE_PROVIDER + "/idp/metadata", consumes = MediaType.ALL_VALUE,
        produces = MediaType.APPLICATION_XML_VALUE)
    @Operation(summary = "Get identity provider metadata")
    public ResponseEntity<String> getFirstIdentityProviderMetadata(final HttpServletRequest request,
                                                                   final HttpServletResponse response) {
        val webContext = new JEEContext(request, response);
        val saml2Client = identityProviders.findAllClients(webContext)
            .stream()
            .filter(SAML2Client.class::isInstance)
            .map(SAML2Client.class::cast).findFirst();
        return saml2Client.map(this::getSaml2ClientIdentityProviderMetadataResponseEntity)
            .orElseGet(DelegatedSaml2ClientMetadataController::getNotAcceptableResponseEntity);
    }
Gets first idp metadata.

@param request  the request
@param response the response
@return the first service provider metadata
support/cas-server-support-pac4j-saml/src/main/java/org/apereo/cas/web/saml2/DelegatedSaml2ClientMetadataController.java