@Override
    public Optional<String> getCandidateUsername(final RequestContext context) {
        val passwordlessRequest = PasswordlessWebflowUtils.getPasswordlessAuthenticationRequest(context, PasswordlessAuthenticationRequest.class);
        return Optional.ofNullable(passwordlessRequest)
            .map(PasswordlessAuthenticationRequest::getProvidedUsername)
            .filter(StringUtils::isNotBlank)
            .or(() -> {
                val account = PasswordlessWebflowUtils.getPasswordlessAuthenticationAccount(context, PasswordlessUserAccount.class);
                return Optional.ofNullable(account).map(PasswordlessUserAccount::getUsername);
            });
    }
This is {@link PasswordlessCasWebflowLoginContextProvider}.

@author Misagh Moayyed
@since 6.4.0
support/cas-server-support-passwordless-webflow/src/main/java/org/apereo/cas/web/flow/PasswordlessCasWebflowLoginContextProvider.java