Skip to content

Commit 2746a9f

Browse files
committed
Documentation
Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent 616cb81 commit 2746a9f

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

docs/Documentation/StreamSystemUsage.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,39 @@ private static async Task CreateTls()
6262
await streamSystem.Close().ConfigureAwait(false); // <2>
6363
}
6464
// end::create-tls[]
65+
66+
67+
// tag::create-tls-external-auth[]
68+
private static async Task CreateTlsExternal()
69+
{
70+
var ssl = new SslOption() // <1>
71+
{
72+
Enabled = true,
73+
ServerName = "server_name",
74+
CertPath = "certs/client/keycert.p12",
75+
CertPassphrase = null, // in case there is no password
76+
CertificateValidationCallback = (sender, certificate, chain, errors) => true,
77+
};
78+
79+
var config = new StreamSystemConfig()
80+
{
81+
UserName = "user_does_not_exist",
82+
Password = "password_does_not_exist",
83+
Ssl = ssl,
84+
Endpoints = new List<EndPoint>(new List<EndPoint>()
85+
{
86+
new DnsEndPoint("server_name", 5551)
87+
}),
88+
89+
AuthMechanism = AuthMechanism.External, // <2>
90+
};
91+
92+
var streamSystem = await StreamSystem.Create(config).ConfigureAwait(false);
93+
94+
await streamSystem.Close().ConfigureAwait(false);
95+
96+
}
97+
// end::create-tls-external-auth[]
6598

6699

67100
// tag::create-tls-trust[]

docs/asciidoc/api.adoc

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,19 @@ include::{test-examples}/StreamSystemUsage.cs[tag=create-tls]
6666
--------
6767

6868
<1> Enable TLS
69-
<2> Load certificate authority (CA) certificate from PEM file
69+
<2> Load certificates from PEM files
70+
71+
.Creating an StreamSystem that uses TLS and external authentication
72+
[source,c#,indent=0]
73+
--------
74+
include::{test-examples}/StreamSystemUsage.cs[tag=create-tls-external-auth]
75+
--------
76+
77+
<1> Enable TLS and configure the certificates
78+
<2> Set the external authentication mechanism
79+
80+
Note: you need the `rabbitmq_auth_mechanism_ssl` plugin enabled on the server side to use external authentication.
81+
`AuthMechanism.External` can be used from RabbitMQ server 3.11.19 and RabbitMQ 3.12.1 onwards.
7082

7183
.Creating a TLS environment that trusts all server certificates for development
7284
[source,c#,indent=0]
@@ -76,6 +88,9 @@ include::{test-examples}/StreamSystemUsage.cs[tag=create-tls-trust]
7688

7789
<1> Trust all server certificates
7890

91+
92+
93+
7994
===== Configuring the Stream System
8095

8196
The following table sums up the main settings to create an `StreamSystem` using the `StreamSystemConfig`:

0 commit comments

Comments
 (0)