@Override
    public void process(final AuthenticationBuilder builder, final AuthenticationTransaction transaction) {
        FunctionUtils.doIfNotNull(transaction.getService(), service -> {
            val authentication = builder.build();
            val registeredService = servicesManager.findServiceBy(service);
            val audit = AuditableContext.builder()
                .service(service)
                .authentication(authentication)
                .registeredService(registeredService)
                .build();
            val accessResult = registeredServiceAccessStrategyEnforcer.execute(audit);
            accessResult.throwExceptionIfNeeded();
            val token = TokenAuthenticationSecurity.forRegisteredService(registeredService).generateTokenFor(authentication);
            builder.addAttribute(TokenConstants.PARAMETER_NAME_TOKEN, token);
        });
    }
This is {@link TokenAuthenticationPostProcessor}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-token-authentication/src/main/java/org/apereo/cas/token/authentication/TokenAuthenticationPostProcessor.java