protected void buildAuthorizedServices(final RequestContext requestContext, final TicketGrantingTicket ticket,
                                           final WebApplicationService service) {
        val authzAttributes = (Map) CollectionUtils.merge(ticket.getAuthentication().getAttributes(),
            ticket.getAuthentication().getPrincipal().getAttributes());
        val authorizedServices = servicesManager.getAllServices()
            .stream()
            .filter(registeredService -> FunctionUtils.doAndHandle(
                () -> principalAccessStrategyEnforcer.authorize(
                    RegisteredServicePrincipalAccessStrategyEnforcer.PrincipalAccessStrategyContext.builder()
                        .registeredService(registeredService)
                        .principalId(ticket.getAuthentication().getPrincipal().getId())
                        .principalAttributes(authzAttributes)
                        .service(service)
                        .applicationContext(requestContext.getActiveFlow().getApplicationContext())
                        .build()),
                throwable -> false).get())
            .sorted()
            .collect(Collectors.toList());
        WebUtils.putAuthorizedServices(requestContext, authorizedServices);
    }
Prepare the authenticated account for view.

@author Misagh Moayyed
@since 6.6.0
support/cas-server-support-actions-core/src/main/java/org/apereo/cas/web/flow/account/PrepareAccountProfileViewAction.java