default Stream<? extends Ticket> getSessionsFor(final String principalId) {
        return getTickets(ticket -> ticket instanceof final TicketGrantingTicket ticketGrantingTicket
            && !ticket.isExpired()
            && ticketGrantingTicket.getAuthentication().getPrincipal().getId().equals(principalId));
    }
Gets sessions for principal.

@param principalId the principal id
@return the sessions for
api/cas-server-core-api-ticket/src/main/java/org/apereo/cas/ticket/registry/TicketRegistry.java