Revokes an approval for a given token.

  This method requires raw datastore access to manipulate approvals directly.

  Args:
    aff4_path: The aff4_path or client id the approval should be created for.
    token: The token that should be revoked.
762624
def ApprovalRevokeRaw(aff4_path, token):
  
  try:
    urn = rdf_client.ClientURN(aff4_path)
  except type_info.TypeValueError:
    urn = rdfvalue.RDFURN(aff4_path)

  approval_urn = aff4.ROOT_URN.Add("ACL").Add(urn.Path()).Add(
      token.username).Add(utils.EncodeReasonString(token.reason))

  super_token = access_control.ACLToken(username="raw-approval-superuser")
  super_token.supervisor = True

  approval_request = aff4.FACTORY.Open(
      approval_urn, mode="rw", token=super_token)
  approval_request.DeleteAttribute(approval_request.Schema.APPROVER)
  approval_request.Close()
403583
def revoke!(cakey=nil, crl=nil, next_update=36000)
      if cakey.nil?
        fail EasyRSA::Revoke::MissingCARootKey,
          'Please provide the root CA cert for the CRL'
      end

    # Get cert details if it's in a file
      unless cakey.is_a? OpenSSL::PKey::RSA
        if cakey.include?('BEGIN RSA PRIVATE KEY')
          cakey = OpenSSL::PKey::RSA.new cakey
        else
          begin
            cakey = OpenSSL::PKey::RSA.new File.read cakey
          rescue OpenSSL::PKey::RSAError => e
            fail EasyRSA::Revoke::InvalidCARootPrivateKey,
              'This is not a valid Private key file.'
          end
        end
      end

    # This is not a private key
      unless cakey.private?
        fail EasyRSA::Revoke::InvalidCARootPrivateKey,
          'This is not a valid Private key file.'
      end

    # Create or load the CRL
      unless crl.nil?
        begin
          @crl = OpenSSL::X509::CRL.new crl
        rescue
          fail EasyRSA::Revoke::InvalidCertificateRevocationList,
            'Invalid CRL provided.'
        end
      else
        @crl = OpenSSL::X509::CRL.new
      end

    # Add the revoked cert
      @crl.add_revoked(@revoked)

    # Needed CRL options
      @crl.last_update = @revoked.time
      @crl.next_update = Time.now + next_update
      @crl.version = 1

    # Update the CRL issuer
      @crl.issuer = EasyRSA::gen_issuer

    # Sign the CRL
      @updated_crl = @crl.sign(cakey, OpenSSL::Digest::SHA256.new)
      @updated_crl
    end
636659
def delete(path)
      uri = URI.join(API_DOMAIN, path + "?access_token=#{token}")

      req = Net::HTTP::Delete.new(uri)
      res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |https|
        https.request(req)
      end
      JSON.parse(res.body)
    end
93974
def revoke_access_token(self, access_token):
        
        payload = {'access_token': access_token,}
        req = requests.post(settings.API_DEAUTHORIZATION_URL, data=payload)
570098
def revoke_token
      r = HTTP.auth('Bearer ' + @access_token).post(API + '/auth/token/revoke')
      raise ApiError.new(r) if r.code != 200
    end
630246
protected function revokeOrDeleteAccessTokens(Token $token, $tokenId)
    {
        $query = Token::where('user_id', $token->user_id)->where('client_id', $token->client_id);

        if ($tokenId) {
            $query->where('id', '<>', $tokenId);
        }

        if (Passport::$pruneRevokedTokens) {
            $query->delete();
        } else {
            $query->update(['revoked' => true]);
        }
    }
894034
def revoke_token(self, token):
        
        resp, resp_body = self.method_delete("tokens/%s" % token, admin=True)
        if resp.status_code in (401, 403):
            raise exc.AuthorizationFailure("You must be an admin to make this "
                    "call.")
        return 200 <= resp.status_code < 300
1231711
def revoke(perm, group_list = [])
      validate_usergroup_list(group_list)
      api.post(['revoke', perm].uri_concat, group_list, 'application/json')
    end
915509
@DELETE
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/revoke_oauth_access/{appName}")
    @Description("Revokes Oauth access of app from argus for a particular user")
    public Response removeAccess(@Context HttpServletRequest req,@PathParam("appName") String appName) {
        String userName=findUserByToken(req);

        if(appName.equalsIgnoreCase(applicationName))
        {
            authService.deleteByUserId(userName);
            return Response.status(Status.OK).build();
        }
        else
        {
            throw new OAuthException(ResponseCodes.ERR_DELETING_APP, HttpResponseStatus.BAD_REQUEST);
        }

    }
1183354
public void revokeAll(IResource droppedResource)
    {

        UntypedResultSet rows;
        try
        {
            // TODO: switch to secondary index on 'resource' once https://issues.apache.org/jira/browse/CASSANDRA-5125 is resolved.
            rows = process(String.format("SELECT username FROM %s.%s WHERE resource = '%s' ALLOW FILTERING",
                                         Auth.AUTH_KS,
                                         PERMISSIONS_CF,
                                         escape(droppedResource.getName())));
        }
        catch (RequestExecutionException e)
        {
            logger.warn("CassandraAuthorizer failed to revoke all permissions on {}: {}", droppedResource, e);
            return;
        }

        for (UntypedResultSet.Row row : rows)
        {
            try
            {
                process(String.format("DELETE FROM %s.%s WHERE username = '%s' AND resource = '%s'",
                                      Auth.AUTH_KS,
                                      PERMISSIONS_CF,
                                      escape(row.getString(USERNAME)),
                                      escape(droppedResource.getName())));
            }
            catch (RequestExecutionException e)
            {
                logger.warn("CassandraAuthorizer failed to revoke all permissions on {}: {}", droppedResource, e);
            }
        }
    }
651517
def token_revoke(token):
    """"""
    db.session.delete(token)
    db.session.commit()
    return redirect(url_for('.index'))
177967
def revoke_admin_privileges(name, **client_args):
    '''
    
    '''
    client = _client(**client_args)
    client.revoke_admin_privileges(name)

    return True
57849
public function revoke()
    {
        $accessToken = $this->tokenRepo->get()['access_token'];
        $url = $this->getLoginURL();
        $url .= '/services/oauth2/revoke';

        $options['headers']['content-type'] = 'application/x-www-form-urlencoded';
        $options['form_params']['token'] = $accessToken;

        return $this->httpClient->post($url, $options);
    }
634287
def delete(self, customer_id, token_id, data={}, **kwargs):
        "
        url = "{}/{}/tokens/{}".format(self.base_url, customer_id, token_id)
        return self.delete_url(url, data, **kwargs)
1339868
async function revoke (nameId, options = {}) {
  const opt = R.merge(this.Ae.defaults, options)

  const nameRevokeTx = await this.nameRevokeTx(R.merge(opt, {
    nameId,
    accountId: await this.address()
  }))

  return this.send(nameRevokeTx, opt)
}
998633
def revoke_access(self):
        
        if self.token is None:
            return True
        #Don't try to revoke if token is invalid anyway, will cause an error response anyway.
        if self.validate():
            data = {}
            data['token'] = self.token['access_token']
            self.request().post(self.revoke_url, data=data, json=None,verify=self.verifySSL)
        return True
1007503
def is_token_revoked(decoded_token):
    
    jti = decoded_token['jti']
    try:
        token = TokenBlacklist.query.filter_by(jti=jti).one()
        return token.revoked
    except NoResultFound:
        return True