File tree 1 file changed +36
-0
lines changed
1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -33,3 +33,39 @@ proximo from go
33
33
34
34
[ protobuf definitions] ( proto/ )
35
35
36
+ ## Access Control
37
+
38
+ Access Control is supported using an optional config file, using the ` PROXIMO_ACL_CONFIG ` .
39
+
40
+ In this example, all clients can access the topics that start with ` products ` but only a client called
41
+ ` product-writer ` has permission to to write to these topics.
42
+
43
+ ``` yaml
44
+ default :
45
+ roles : ["read-products"]
46
+ roles :
47
+ - id : " read-products"
48
+ consume : ["products.*"]
49
+ - id : " write-products"
50
+ publish : ["products.*"]
51
+ clients :
52
+ - id : " product-writer"
53
+ secret : " $2y$10$2AzC3Z8L18cP.crFi.ZDsuFdbwrYu16Lnh8y7U1wMO3QPanYuwJIm" # pass is bcrypted hash of "password"
54
+ roles : ["write-products"]
55
+ ` ` `
56
+
57
+ Add the token to the context, example:
58
+
59
+ ` ` ` golang
60
+ sink, _ := proximo.NewAsyncMessageSink(proximo.AsyncMessageSinkConfig{
61
+ Broker : " localhost:6868" ,
62
+ Topic : " products" ,
63
+ Insecure : true,
64
+ })
65
+
66
+ token := base64.StdEncoding.EncodeToString(fmt.Sprintf("%s:%s", "product-writer", "password"))
67
+ md := metadata.Pairs("Authorization", fmt.Sprintf("Bearer %s", token))
68
+ reqCtx := metadata.NewOutgoingContext(ctx, md)
69
+
70
+ sink.PublishMessage(reqCtx, &Message{Data : []byte("hello world")})
71
+ ` ` `
You can’t perform that action at this time.
0 commit comments