concrete/src/Api/OAuth/Controller.php
private function pruneTokens()
    {
        $now = new \DateTime('now');
        // Delete access tokens that have no refresh token associated
        $qb = $this->entityManager->createQueryBuilder();
        $items = $qb->select('token')
            ->from(AccessToken::class, 'token')
            ->where($qb->expr()->lt('token.expiryDateTime', ':now'))
            ->getQuery()->execute([':now' => $now]);

        $this->pruneResults($items);

        // Delete all expired access tokens that have expired refresh tokens
        $qb = $this->entityManager->createQueryBuilder();
        $items = $qb->select('token')
            ->from(AccessToken::class, 'token')
            ->where($qb->expr()->lt('token.expiryDateTime', ':now'))
            ->getQuery()->execute([':now' => $now]);

        $this->pruneResults($items);

        // Delete all expired auth codes
        $qb = $this->entityManager->createQueryBuilder();
        $qb->delete(AuthCode::class, 'token')
            ->where($qb->expr()->lt('token.expiryDateTime', ':now'))
            ->getQuery()->execute([':now' => $now]);
    }
private function pruneTokens()
    {
        $now = new \DateTime('now');
        // Delete access tokens that have no refresh token associated
        $qb = $this->entityManager->createQueryBuilder();
        $items = $qb->select('token')
            ->from(AccessToken::class, 'token')
            ->where($qb->expr()->lt('token.expiryDateTime', ':now'))
            ->getQuery()->execute([':now' => $now]);

        $this->pruneResults($items);

        // Delete all expired access tokens that have expired refresh tokens
        $qb = $this->entityManager->createQueryBuilder();
        $items = $qb->select('token')
            ->from(AccessToken::class, 'token')
            ->where($qb->expr()->lt('token.expiryDateTime', ':now'))
            ->getQuery()->execute([':now' => $now]);

        $this->pruneResults($items);

        // Delete all expired auth codes
        $qb = $this->entityManager->createQueryBuilder();
        $qb->delete(AuthCode::class, 'token')
            ->where($qb->expr()->lt('token.expiryDateTime', ':now'))
            ->getQuery()->execute([':now' => $now]);
    }
private function pruneTokens ( ) { $ now = new \ DateTime ( 'now' ) ; // Delete access tokens that have no refresh token associated $ qb = $ this -> entityManager -> createQueryBuilder ( ) ; $ items = $ qb -> select ( 'token' ) -> from ( AccessToken :: class , 'token' ) -> where ( $ qb -> expr ( ) -> lt ( 'token.expiryDateTime' , ':now' ) ) -> getQuery ( ) -> execute ( [ ':now' => $ now ] ) ; $ this -> pruneResults ( $ items ) ; // Delete all expired access tokens that have expired refresh tokens $ qb = $ this -> entityManager -> createQueryBuilder ( ) ; $ items = $ qb -> select ( 'token' ) -> from ( AccessToken :: class , 'token' ) -> where ( $ qb -> expr ( ) -> lt ( 'token.expiryDateTime' , ':now' ) ) -> getQuery ( ) -> execute ( [ ':now' => $ now ] ) ; $ this -> pruneResults ( $ items ) ; // Delete all expired auth codes $ qb = $ this -> entityManager -> createQueryBuilder ( ) ; $ qb -> delete ( AuthCode :: class , 'token' ) -> where ( $ qb -> expr ( ) -> lt ( 'token.expiryDateTime' , ':now' ) ) -> getQuery ( ) -> execute ( [ ':now' => $ now ] ) ; }
Prune old authentication tokens
Prune old authentication tokens