private OAuth20DeviceUserCode getDeviceUserCodeFromRegistry(final OAuth20DeviceToken deviceCodeTicket) {
        return FunctionUtils.doAndHandle(
                () -> ticketRegistry.getTicket(deviceCodeTicket.getUserCode(), OAuth20DeviceUserCode.class),
                throwable -> {
                    LOGGER.error("Provided user code [{}] is invalid or expired and cannot be found in the ticket registry",
                        deviceCodeTicket.getUserCode());
                    throw new InvalidOAuth20DeviceTokenException(deviceCodeTicket.getUserCode());
                })
            .get();
    }
This is {@link OAuth20DefaultTokenGenerator}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/accesstoken/OAuth20DefaultTokenGenerator.java