private DuoSecurityAuthenticationResult authenticateDuoPasscodeCredential(final DuoSecurityPasscodeCredential credential) {
        try {
            val request = buildHttpPostAuthRequest();
            signHttpAuthRequest(request, Map.of("username", credential.getId().trim(),
                "factor", "passcode", "passcode", credential.getPassword().trim()));
            val result = executeDuoApiRequest(request);
            LOGGER.debug("Duo authentication response: [{}]", result);
            if ("allow".equalsIgnoreCase(result.getString("result"))) {
                return DuoSecurityAuthenticationResult.builder().success(true).username(credential.getId()).build();
            }
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
        }
        return DuoSecurityAuthenticationResult.builder().success(false).username(credential.getId()).build();
    }
This is {@link BaseDuoSecurityAuthenticationService}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-duo-core/src/main/java/org/apereo/cas/adaptors/duo/authn/BaseDuoSecurityAuthenticationService.java