Skip to content

Commit

Permalink
authorize get_bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
KannarFr committed Mar 29, 2022
1 parent f8ccff3 commit 95368e5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ We currently are using this script to put libs on pulsar nodes:
```bash
#!/bin/bash

wget -P "pulsar/lib" "https://repo1.maven.org/maven2/net/i2p/crypto/eddsa/0.3.0/eddsa-0.3.0.jar"
wget -P "pulsar/lib" "https://repo1.maven.org/maven2/io/vavr/vavr/0.10.3/vavr-0.10.3.jar"
wget -P "pulsar/lib" "https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java/3.16.1/protobuf-java-3.16.1.jar"
wget -P "pulsar/lib" "https://repo1.maven.org/maven2/com/clever-cloud/biscuit-java/<VERSION>/biscuit-java-<VERSION>.jar"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.clevercloud.biscuitpulsar.operation;

import java.util.Arrays;
import java.util.stream.Collectors;

public enum BiscuitNamespaceOperation {
CREATE_TOPIC,
GET_TOPIC,
Expand All @@ -11,7 +8,7 @@ public enum BiscuitNamespaceOperation {

//ADD_BUNDLE,
//DELETE_BUNDLE,
//GET_BUNDLE,
GET_BUNDLE,

//GET_PERMISSION,
//GRANT_PERMISSION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public enum BiscuitTopicOperation {
//REVOKE_PERMISSION,

//ADD_BUNDLE_RANGE,
//GET_BUNDLE_RANGE,
GET_BUNDLE_RANGE,
//DELETE_BUNDLE_RANGE,

SUBSCRIBE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class AuthenticationProviderBiscuitTest {

@Test
public void testAuthSecretKeyPair() throws Exception {
KeyPair root = new KeyPair("3A8621F1847F19D6DAEAB5465CE8D3908B91C66FB9AF380D508FCF9253458907");
KeyPair root = new KeyPair("D283C7E436D89C544CC2B20C1028A7ADDC18FCED6386A6130465C17B996CD893");

LOGGER.info("ROOT KEY");
LOGGER.info(root.toHex());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public void testLimitations() throws Exception {
assertFalse(authorizationProvider.allowNamespaceOperation(NamespaceName.get("random-tenant/" + namespace), authedBiscuit, NamespaceOperation.DELETE_TOPIC, null));
assertFalse(authorizationProvider.allowNamespaceOperation(NamespaceName.get(tenant + "/" + namespace), authedBiscuit, NamespaceOperation.ADD_BUNDLE, null));
assertFalse(authorizationProvider.allowNamespaceOperation(NamespaceName.get(tenant + "/" + namespace), authedBiscuit, NamespaceOperation.DELETE_BUNDLE, null));
assertFalse(authorizationProvider.allowNamespaceOperation(NamespaceName.get(tenant + "/" + namespace), authedBiscuit, NamespaceOperation.GET_BUNDLE, null));
assertTrue(authorizationProvider.allowNamespaceOperation(NamespaceName.get(tenant + "/" + namespace), authedBiscuit, NamespaceOperation.GET_BUNDLE, null));
assertTrue(authorizationProvider.allowNamespaceOperation(NamespaceName.get(tenant + "/" + namespace), authedBiscuit, NamespaceOperation.CLEAR_BACKLOG, null));
assertTrue(authorizationProvider.allowNamespaceOperation(NamespaceName.get(tenant + "/" + namespace), authedBiscuit, NamespaceOperation.UNSUBSCRIBE, null));
assertTrue(authorizationProvider.allowNamespacePolicyOperation(NamespaceName.get(tenant + "/" + namespace), PolicyName.ALL, PolicyOperation.READ, authedBiscuit, null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class BiscuitFormatterTest {
@Test
public void testNamespaceOperations() {
assertEquals("[\"create_topic\",\"get_topic\",\"get_topics\",\"delete_topic\",\"clear_backlog\",\"unsubscribe\"]", namespaceOperations);
assertEquals("[\"create_topic\",\"get_topic\",\"get_topics\",\"delete_topic\",\"get_bundle\",\"clear_backlog\",\"unsubscribe\"]", namespaceOperations);
}

@Test
Expand All @@ -18,6 +18,6 @@ public void testPoliciesOperations() {

@Test
public void testTopicOperations() {
assertEquals("[\"lookup\",\"produce\",\"consume\",\"compact\",\"expire_messages\",\"offload\",\"peek_messages\",\"reset_cursor\",\"skip\",\"terminate\",\"subscribe\",\"get_subscriptions\",\"unsubscribe\",\"get_stats\",\"get_metadata\",\"get_backlog_size\",\"set_replicated_subscription_status\"]", topicOperations);
assertEquals("[\"lookup\",\"produce\",\"consume\",\"compact\",\"expire_messages\",\"offload\",\"peek_messages\",\"reset_cursor\",\"skip\",\"terminate\",\"get_bundle_range\",\"subscribe\",\"get_subscriptions\",\"unsubscribe\",\"get_stats\",\"get_metadata\",\"get_backlog_size\",\"set_replicated_subscription_status\"]", topicOperations);
}
}

0 comments on commit 95368e5

Please sign in to comment.