private DeviceTokens createDeviceTokensInTicketRegistry(
        final AccessTokenRequestContext tokenRequestContext) throws Throwable {

        val deviceTokenFactory = (OAuth20DeviceTokenFactory) ticketFactory.get(OAuth20DeviceToken.class);
        val deviceUserCodeFactory = (OAuth20DeviceUserCodeFactory) ticketFactory.get(OAuth20DeviceUserCode.class);

        val deviceToken = deviceTokenFactory.createDeviceCode(tokenRequestContext.getService());
        LOGGER.debug("Created device code token [{}]", deviceToken.getId());

        val deviceUserCode = deviceUserCodeFactory.createDeviceUserCode(deviceToken.getService());
        LOGGER.debug("Created device user code token [{}]", deviceUserCode.getId());

        val addedDeviceUserCode = addTicketToRegistry(deviceUserCode);
        LOGGER.debug("Added device user code [{}] to registry", addedDeviceUserCode);

        deviceToken.setUserCode(addedDeviceUserCode.getId());
        val addedDeviceToken = addTicketToRegistry(deviceToken);
        LOGGER.debug("Added device token [{}] to registry", addedDeviceToken);

        return new DeviceTokens(addedDeviceToken, addedDeviceUserCode);
    }
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