protected Set<Object> buildAuthenticationMethods(final Authentication authentication) {
        val allAttributes = new HashMap<>(authentication.getAttributes());
        allAttributes.putAll(authentication.getPrincipal().getAttributes());
        return Stream.of(AuthenticationHandler.SUCCESSFUL_AUTHENTICATION_HANDLERS, AuthenticationManager.AUTHENTICATION_METHOD_ATTRIBUTE)
            .filter(allAttributes::containsKey)
            .map(name -> CollectionUtils.toCollection(allAttributes.get(name)))
            .findFirst()
            .orElseGet(Set::of);
    }
This is {@link OidcIdTokenGeneratorService}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/token/OidcIdTokenGeneratorService.java