revokeAllAuthority

@param mixed $Authorization The basic authentication token
@param mixed $client_id The id of the client.
@return \GithubService\Operation\revokeAllAuthority The new operation
172386
public function revokeAllAuthority($authorization, $client_id) {
        $instance = new revokeAllAuthority($this, $this->getUserAgent(), $authorization, $client_id);
        return $instance;
    }
1374867
public function removeClientUser($client_id, $user_id)
    {
        $sql    = 'DELETE from %s where client_id = :client_id and user_id = :user_id';
        $sql    = sprintf($sql, $this->config['client_user_table']);
        $params = array_map('trim', compact('client_id', 'user_id'));

        return $this->db->prepare($sql)->execute($params);
    }
510585
public final function isValidAuth(ClientAuth $clientAuth) {
		return $clientAuth->publicKey === $this->getPublicKey() && $clientAuth->token === $this->getToken();
	}
519109
public function revokeToken($token)
    {
        $this->oauth->token = $token;
        $this->oauth->calltokenHandler();

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

        return false;
    }
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,
        )
466590
def update_client_grants(self, client_id, scope=[], authorities=[],
            grant_types=[], redirect_uri=[], replace=False):
        
        self.assert_has_permission('clients.write')

        client = self.get_client(client_id)
        if not client:
            raise ValueError("Must first create client: '%s'" % (client_id))

        if replace:
            changes = {
                'client_id': client_id,
                'scope': scope,
                'authorities': authorities,
                }
        else:
            changes = {'client_id': client_id}
            if scope:
                changes['scope'] = client['scope']
                changes['scope'].extend(scope)

            if authorities:
                changes['authorities'] = client['authorities']
                changes['authorities'].extend(authorities)

            if grant_types:
                if 'authorization_code' in grant_types and not redirect_uri:
                    logging.warning("A redirect_uri is required for authorization_code.")

                changes['authorized_grant_types'] = client['authorized_grant_types']
                changes['authorized_grant_types'].extend(grant_types)

            if redirect_uri:
                if 'redirect_uri' in client:
                    changes['redirect_uri'] = client['redirect_uri']
                    changes['redirect_uri'].extend(redirect_uri)
                else:
                    changes['redirect_uri'] = redirect_uri

        uri = self.uri + '/oauth/clients/' + client_id
        headers = {
            "pragma": "no-cache",
            "Cache-Control": "no-cache",
            "Content-Type": "application/json",
            "Accepts": "application/json",
            "Authorization": "Bearer " + self.get_token()
        }

        logging.debug("URI=" + str(uri))
        logging.debug("HEADERS=" + str(headers))
        logging.debug("BODY=" + json.dumps(changes))

        response = requests.put(uri, headers=headers, data=json.dumps(changes))

        logging.debug("STATUS=" + str(response.status_code))
        if response.status_code == 200:
            return response
        else:
            logging.error(response.content)
            response.raise_for_status()
704288
public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
    for(Authentication auth : authentications.values()) {
      if (auth instanceof OAuth) {
        OAuth oauth = (OAuth) auth;
        oauth.getTokenRequestBuilder()
              .setClientId(clientId)
              .setClientSecret(clientSecret)
              .setRedirectURI(redirectURI);
        oauth.getAuthenticationRequestBuilder()
              .setClientId(clientId)
              .setRedirectURI(redirectURI);
        return;
      }
    }
  }
1312124
BoxRevokeAuthRequest revokeOAuth(String token, String clientId, String clientSecret) {
        BoxRevokeAuthRequest request = new BoxRevokeAuthRequest(mSession, getTokenRevokeUrl(), token, clientId, clientSecret);
        request.setRequestHandler(new BoxRequest.BoxRequestHandler(request){

            @Override
            public boolean onException(BoxRequest request, BoxHttpResponse response, BoxException ex) throws BoxException.RefreshFailure {
                // if a revoke request fails for any reason we do not want to retry it again after the user refreshes or logs in again.
                return false;
            }
        });
        return request;
    }
549
public function getClientKey($client_id, $subject)
    {
        if (isset($this->jwt[$client_id])) {
            $jwt = $this->jwt[$client_id];
            if ($jwt) {
                if ($jwt["subject"] == $subject) {
                    return $jwt["key"];
                }
            }
        }

        return false;
    }
1041040
public function getOAuthClient($client_id, $client_secret, $redirect_uri)
    {
        $options = [
            'clientId' => $client_id,
            'clientSecret' => $client_secret,
            'redirectUri' => $redirect_uri
        ];
        $OAuthClient = new OAuth($options);

        return $OAuthClient;
    }
1228101
public function checkClientCredentials($client_id, $client_secret = null)
    {
        if ($result = $this->getObjectByType('client_table',$client_id)) {
            return $result['client_secret'] == $client_secret;
        }

        return false;
    }
498490
public static function device(
        Authorization $authorization,
        ClientInterface $client = null,
        SerializerInterface $serializer = null
    ) {
        AnnotationRegistry::registerLoader('class_exists');

        $afterpayClient = $client ?: new Client([ 'base_uri' => $authorization->getEndpoint() ]);
        $afterpaySerializer = $serializer ?: SerializerFactory::getSerializer();

        return new Service\InStore\Device($authorization, $afterpayClient, $afterpaySerializer);
    }
292759
public Single<Boolean> revokeToken(FullHttpRequest req) throws OAuthException {
        RevokeTokenRequest revokeRequest = new RevokeTokenRequest(req);
        revokeRequest.checkMandatoryParams();
        String clientId = revokeRequest.getClientId();
        // check valid client_id, status does not matter as token of inactive client app could be revoked too
        return isExistingClient(clientId).flatMap(existed -> {
            if (!existed) throw new OAuthException(ResponseBuilder.INVALID_CLIENT_ID, HttpResponseStatus.BAD_REQUEST);
            else {
                String token = revokeRequest.getAccessToken();
                return db.findAccessToken(token)
                        .map(Optional::of)
                        .switchIfEmpty(Single.just(Optional.empty()))
                        .flatMap(accessToken -> {
                            if (accessToken.isPresent()) {
                                if (accessToken.get().tokenExpired()) {
                                    LOG.info(String.format("Access token {%s} has already expired, nothing need to do.", token));
                                    return Single.just(true);
                                }
                                if (clientId.equals(accessToken.get().getClientId())) {
                                    return db.removeAccessToken(accessToken.get().getToken())
                                            .andThen(Single.just(true)
                                                    .doOnSuccess(ignored -> LOG.info(String.format("access token {%s} set status invalid", token))));
                                } else {
                                    LOG.info(String.format("access token {%s} is not obtained for that client {%s}", token, clientId));
                                    return Single.just(false);
                                }
                            } else {
                                LOG.info(String.format("access token {%s} not found", token));
                                return Single.just(false);
                            }
                        })
                        ;
            }
        });
    }
540614
public function getClientKey($client_id, $subject)
    {
        $result = $this->client->getItem(array(
            "TableName"=> $this->config['jwt_table'],
            "Key" => array('client_id'   => array('S' => $client_id), 'subject' => array('S' => $subject))
        ));
        if ($result->count()==0) {
            return false ;
        }
        $token = $this->dynamo2array($result);

        return $token['public_key'];
    }
563407
protected function validateOldRefreshToken(ServerRequestInterface $request, $clientId)
    {
        $encryptedRefreshToken = $this->getRequestParameter('refresh_token', $request);
        if (is_null($encryptedRefreshToken)) {
            throw OAuthServerException::invalidRequest('refresh_token');
        }

        // Validate refresh token
        try {
            $refreshToken = $this->decrypt($encryptedRefreshToken);
        } catch (Exception $e) {
            throw OAuthServerException::invalidRefreshToken('Cannot decrypt the refresh token', $e);
        }

        $refreshTokenData = json_decode($refreshToken, true);
        if ($refreshTokenData['client_id'] !== $clientId) {
            $this->getEmitter()->emit(new RequestEvent(RequestEvent::REFRESH_TOKEN_CLIENT_FAILED, $request));
            throw OAuthServerException::invalidRefreshToken('Token is not linked to client');
        }

        if ($refreshTokenData['expire_time'] < time()) {
            throw OAuthServerException::invalidRefreshToken('Token has expired');
        }

        if ($this->refreshTokenRepository->isRefreshTokenRevoked($refreshTokenData['refresh_token_id']) === true) {
            throw OAuthServerException::invalidRefreshToken('Token has been revoked');
        }

        return $refreshTokenData;
    }
1243907
def authorize(self, client_id, audience=None, state=None, redirect_uri=None,
                  response_type='code', scope='openid'):
        
        params = {
            'client_id': client_id,
            'audience': audience,
            'response_type': response_type,
            'scope': scope,
            'state': state,
            'redirect_uri': redirect_uri
        }

        return self.get(
            'https://{}/authorize'.format(self.domain),
            params=params)
1320262
def revoke_token(access_token):
    
    response = requests.post(
        get_revoke_token_url(),
        data={
            'token': access_token,
            'client_id': settings.API_CLIENT_ID,
            'client_secret': settings.API_CLIENT_SECRET,
        },
        timeout=15
    )
    return response.status_code == 200