@Override
    public Ticket expand(final String ticketId) throws Throwable {
        val structure = parse(ticketId);
        val service = serviceFactory.createService(structure.ticketElements().get(CompactTicketIndexes.SERVICE.getIndex()));
        val clientId = structure.ticketElements().get(3);
        val scopes = StringUtils.isNotBlank(structure.ticketElements().get(4))
            ? Splitter.on("|").splitToList(structure.ticketElements().get(4))
            : new HashSet<String>();
        val codeChallenge = StringUtils.trimToNull(structure.ticketElements().get(5));
        val codeChallengeMethod = StringUtils.trimToNull(structure.ticketElements().get(6));

        val responseType = OAuth20ResponseTypes.values()[Integer.parseInt(structure.ticketElements().get(7))];
        val grantType = OAuth20GrantTypes.values()[Integer.parseInt(structure.ticketElements().get(8))];

        val authentication = expandAuthentication(principalFactory, structure);
        val codeFactory = (OAuth20CodeFactory) ticketFactory.getObject().get(getTicketType());
        val code = codeFactory.create(service, authentication, null,
            scopes, codeChallenge, codeChallengeMethod, clientId, new HashMap<>(), responseType, grantType);
        code.setExpirationPolicy(new FixedInstantExpirationPolicy(structure.expirationTime()));
        code.setCreationTime(DateTimeUtils.zonedDateTimeOf(structure.creationTime()));
        return code;
    }
This is {@link OAuth20CodeCompactor}.

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