default Credential prepareCredential(final HttpServletRequest request, final Credential credential) {
        if (credential instanceof final AbstractCredential ac) {
            val credentialMetadata = Optional.ofNullable(ac.getCredentialMetadata())
                .orElseGet(() -> new BasicCredentialMetadata(credential));
            credentialMetadata.putProperties(HttpRequestUtils.getRequestHeaders(request));
            ac.setCredentialMetadata(credentialMetadata);
        }
        return credential;
    }
Prepare credential.

@param request    the request
@param credential the credential
@return the credential
core/cas-server-core-rest-api/src/main/java/org/apereo/cas/rest/factory/RestHttpRequestCredentialFactory.java