Provider::revokeToken

Revoke OAuth Consumer Token.

@param string $token oauth_token

@return bool
519109
public function revokeToken($token)
    {
        $this->oauth->token = $token;
        $this->oauth->calltokenHandler();

        if ( ! $this->hasErrors()) {
            return $this->model->deleteToken(['key' => $token]);
        }

        return false;
    }
187212
public function invalidateToken(Token $token)
    {
        $this->tokenCache->remove($token->getHash());

        $this->logger->log(sprintf('Deleted token %s.', $token->getIdentifier()), LOG_INFO);
    }
1149832
def revoke_authorization(self):
        """"""
        self.request_handler.post(
            endpoint='oauth/token/revoke',
            omit_api_version=True,
            data={
                'client_id': self.auth.client_id,
                'client_secret': self.auth.client_secret,
                'token': self.auth.access_token,
            }
        )
        self.auth.update(
            token_expiration=None,
            access_token=None,
            refresh_token=None,
        )
539943
public function expireToken($token)
    {
        $tokenData = $this->getTokenData($token);
        if ($tokenData == false) {
            return false;
        }

        $tokenData->date_of_expiry = time() - 1;
        return $tokenData->save();
    }
835640
def revoke_token(token_id, user):
    
    try:
        token = TokenBlacklist.query.filter_by(id=token_id, user_identity=user).one()
        token.revoked = True
        db.session.commit()
    except NoResultFound:
        raise TokenNotFound("Could not find the token {}".format(token_id))
909259
public function invalidate(Token $token)
    {
        if (! $this->blacklistEnabled) {
            throw new JWTException('You must have the blacklist enabled to invalidate a token.');
        }

        return $this->blacklist->add($this->decode($token));
    }
64812
def revoke(access_token)
      response = client.as(access_token).post(path: "/oauth/revoke")
      response.code == 200 && response.empty?
    end
815086
public function acknowledgeTransaction($token = null)
    {
        if (!$token) {
            $token = $_POST['token_ws'];
        }

        return $this->service->acknowledgeTransaction($token);
    }
570098
def revoke_token
      r = HTTP.auth('Bearer ' + @access_token).post(API + '/auth/token/revoke')
      raise ApiError.new(r) if r.code != 200
    end
1240745
public function resetAction($token)
    {
        $user = $this->container->get('fos_user.user_manager')->findUserByConfirmationToken($token);

        if (null === $user) {
            throw new NotFoundHttpException(sprintf('The user with "confirmation token" does not exist for value "%s"', $token));
        }

        if (!$user->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) {
            return new RedirectResponse($this->container->get('router')->generate('sonata_user_resetting_request'));
        }

        $form = $this->container->get('bruery.user.resetting.form');
        $formHandler = $this->container->get('bruery.user.resetting.form.handler');
        $process = $formHandler->process($user);

        if ($process) {
            if ($user->isEnabled() &&
                !$user->isLocked() &&
                !($user->isCredentialsExpired() || ($user->getCredentialsExpireAt() && $user->getCredentialsExpireAt()->diff(new \DateTime()) >= 0))  &&
                !($user->isExpired() || ($user->getExpiresAt() && $user->getExpiresAt()->diff(new \DateTime()) >= 0))) {
                $this->setFlash('bruery_user_success', 'resetting.flash.success');
                $response = new RedirectResponse($this->getRedirectionUrl($user));
                $this->authenticateUser($user, $response);
            } else {
                $response = new RedirectResponse($this->container->get('router')->generate('sonata_user_security_login'));
                $this->setFlash('bruery_user_error', 'account.flash.error');
            }
            return $response;
        }

        $template = $this->container->get('bruery_core.template_loader')->getTemplates();

        return $this->container->get('templating')->renderResponse($template['bruery_user.template.resetting.form'], array(
            'token' => $token,
            'form' => $form->createView(),
        ));
    }
194792
public function revokeRefreshToken($tokenId)
    {
        $this->getEntityManager()->transactional(function(EntityManagerInterface $em) use ($tokenId) {
            $token = $this->find($tokenId);

            if ($token) {
                $em->remove($token);
            }
        });
    }
227835
protected function userDefFilter($token)
    {
        if (isset($this->userDefs[$token[1]])) {
            $token[0] = $this->userDefs[$token[1]];
        }
        return $token;
    }
624217
public function refresh(Token $token)
    {
        $payload = $this->setRefreshFlow()->decode($token);

        if ($this->blacklistEnabled) {
            // invalidate old token
            $this->blacklist->add($payload);
        }

        // return the new token
        return $this->encode(
            $this->payloadFactory->make([
                'sub' => $payload['sub'],
                'iat' => $payload['iat'],
            ])
        );
    }
783319
public function delete($token)
    {
        $query = $this->find(compact('token'));

        return $query->count() ? $this->getTable()->delete($query->first()) : false;
    }
449467
public function verifyAndDecodeToken($token, $checkRevoked=true)
    {
        $payload = JWT::decode($token, $this->getPublicKey(), [self::CRYPTO_ALG]);
        if($checkRevoked && $this->checkRevokedToken($token, $payload))
            throw new TokenRevokedException('Token is revoked.');
        return $payload;
    }
139846
private function deleteToken($token)
    {
        $obj = $this->modelFactory()->create(LostPasswordToken::class);
        $obj->setToken($token);
        $obj->delete();
    }
905724
def revoke_oauth_credential(self):
        """"""
        if self.session.token_type == auth.SERVER_TOKEN_TYPE:
            return

        credential = self.session.oauth2credential
        revoke_access_token(credential)