@Override
    public Ticket expand(final String ticketId) {
        val structure = parse(ticketId);
        val codeFactory = (OAuth20DeviceUserCodeFactory) ticketFactory.getObject().get(getTicketType());
        val service = serviceFactory.createService(structure.ticketElements().get(CompactTicketIndexes.SERVICE.getIndex()));
        val isApproved = BooleanUtils.toBoolean(structure.ticketElements().get(3));
        val id = structure.ticketElements().get(4);
        val userCode = codeFactory.createDeviceUserCode(id, service);
        userCode.setUserCodeApproved(isApproved);
        userCode.setExpirationPolicy(new FixedInstantExpirationPolicy(structure.expirationTime()));
        userCode.setCreationTime(DateTimeUtils.zonedDateTimeOf(structure.creationTime()));
        return userCode;
    }
This is {@link OAuth20DeviceUserCodeCompactor}.

@author Misagh Moayyed
@since 7.1.0
support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/ticket/device/OAuth20DeviceUserCodeCompactor.java