public WsFederationCredential createCredentialFromToken(final Assertion assertion) {
        val retrievedOn = ZonedDateTime.now(clock);
        LOGGER.trace("Retrieved on [{}]", retrievedOn);

        val credential = new WsFederationCredential();
        credential.setRetrievedOn(retrievedOn);
        credential.setId(assertion.getID());
        credential.setIssuer(assertion.getIssuer());
        credential.setIssuedOn(DateTimeUtils.zonedDateTimeOf(assertion.getIssueInstant()));
        val conditions = assertion.getConditions();
        if (conditions != null) {
            credential.setNotBefore(DateTimeUtils.zonedDateTimeOf(conditions.getNotBefore()));
            credential.setNotOnOrAfter(DateTimeUtils.zonedDateTimeOf(conditions.getNotOnOrAfter()));
            if (!conditions.getAudienceRestrictionConditions().isEmpty()) {
                credential.setAudience(conditions.getAudienceRestrictionConditions().getFirst().getAudiences().getFirst().getURI());
            }
        }
        if (!assertion.getAuthenticationStatements().isEmpty()) {
            credential.setAuthenticationMethod(assertion.getAuthenticationStatements().getFirst().getAuthenticationMethod());
        }
        val attributes = new HashMap<String, List<Object>>();
        assertion.getAttributeStatements()
            .stream()
            .flatMap(attributeStatement -> attributeStatement.getAttributes().stream())
            .forEach(item -> {
                LOGGER.trace("Processed attribute: [{}]", item.getAttributeName());
                final List<Object> itemList = item.getAttributeValues().stream()
                    .map(xmlObject -> ((XSAny) xmlObject).getTextContent())
                    .collect(Collectors.toList());
                if (!itemList.isEmpty()) {
                    attributes.put(item.getAttributeName(), itemList);
                }
            });
        credential.setAttributes(attributes);
        LOGGER.debug("WsFederation Credential retrieved as: [{}]", credential);
        return credential;
    }
createCredentialFromToken converts a SAML 1.1 assertion to a WSFederationCredential.

@param assertion the provided assertion
@return an equivalent credential.
support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/WsFederationHelper.java