Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CamundaCloudTokenProvider to work with SM #625

Merged
merged 21 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d5541c0
refactor(CamundaCloudTokenProvider): moved access token into misc nam…
LennartKleymann Nov 20, 2023
46714f3
refactor(CamundaCloudTokenProvider): created a base client for token …
LennartKleymann Nov 20, 2023
c754cc3
feat(OAuth2TokenProvider): added a new token provider for OAuth2
LennartKleymann Nov 20, 2023
64561ef
feat(OAuth2TokenProviderBuilder): added token provider builder for OA…
LennartKleymann Nov 20, 2023
fceb5dd
refactor(CamundaCloudTokenProviderTest): added import for moved acces…
LennartKleymann Nov 20, 2023
ecc236d
test(OAuth2TokenProvider): added unit test for OAuth2 token provider
LennartKleymann Nov 20, 2023
34e7701
refactor(ZeebeIntegrationTestHelper): added ability to start integrat…
LennartKleymann Nov 20, 2023
5882968
test(OAuth2TokenProvider): added integration tests for OAuth2TokenPro…
LennartKleymann Nov 20, 2023
7a6c6ac
feat: introduce AccessTokenCache
ChrisKujawa Dec 15, 2023
5bc88ee
refactor: introduce new IAccessTokenCache
ChrisKujawa Dec 15, 2023
cb608bb
fix: downgrade to .net 7.0
ChrisKujawa Dec 15, 2023
b811845
test: add additional tests for cache
ChrisKujawa Dec 15, 2023
26316ae
refactor: use new Cache in token provider
ChrisKujawa Dec 15, 2023
b27a3a1
test: remove duplicate tests
ChrisKujawa Dec 15, 2023
906c4d8
refactor: move to right namespace
ChrisKujawa Dec 15, 2023
e7474ca
refactor: migrate to token provider to form-url-encoded
ChrisKujawa Dec 15, 2023
78ae3e2
refactor: remove unused classes
ChrisKujawa Dec 15, 2023
8620d5c
test: adjust IT to use old token provider
ChrisKujawa Dec 15, 2023
b8e9508
fix: set logging correctly
ChrisKujawa Dec 15, 2023
d44b524
refactor: remove unused class
ChrisKujawa Dec 15, 2023
f595c1e
test: fix ports of identity and others
ChrisKujawa Dec 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Client.IntegrationTests/Client.IntegrationTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
<None Update="Resources\dinnerDecisions.dmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\Broker\chain.cert.pem">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\Broker\private.key.pem">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\server.crt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
Expand Down
48 changes: 48 additions & 0 deletions Client.IntegrationTests/OAuthIntegrationTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System.Threading.Tasks;
using Grpc.Core;
using NUnit.Framework;

namespace Client.IntegrationTests;

[TestFixture]
public class OAuthIntegrationTest
{
private readonly ZeebeIntegrationTestHelper testHelper = ZeebeIntegrationTestHelper.Latest().WithIdentity();

[OneTimeSetUp]
public async Task Setup()
{
await testHelper.SetupIntegrationTest();
}

[OneTimeTearDown]
public async Task Stop()
{
await testHelper.TearDownIntegrationTest();
}

[Test]
public async Task ShouldSendRequestAndNotFailingWithAuthenticatedClient()
{
var authenticatedZeebeClient = testHelper.CreateAuthenticatedZeebeClient();
var topology = await authenticatedZeebeClient.TopologyRequest().Send();
var gatewayVersion = topology.GatewayVersion;
Assert.AreEqual(ZeebeIntegrationTestHelper.LatestVersion, gatewayVersion);

var topologyBrokers = topology.Brokers;
Assert.AreEqual(1, topologyBrokers.Count);

var topologyBroker = topologyBrokers[0];
Assert.AreEqual(0, topologyBroker.NodeId);
}

[Test]
public Task ShouldFailWithUnauthenticatedClient()
{
Assert.ThrowsAsync<RpcException>(code: async () =>
{
await testHelper.CreateZeebeClient().TopologyRequest().Send();
});
return Task.CompletedTask;
}
}
22 changes: 22 additions & 0 deletions Client.IntegrationTests/Resources/Broker/chain.cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDtDCCApygAwIBAgIUPlH7wI1Bq6F7k63ZNtSXR0DgjxwwDQYJKoZIhvcNAQEL
BQAwVTELMAkGA1UEBhMCREUxEDAOBgNVBAgMB0VuZ2xhbmQxEDAOBgNVBAoMB0Nh
bXVuZGExDjAMBgNVBAsMBXplZWJlMRIwEAYDVQQDDAlsb2NhbGhvc3QwIBcNMjAw
NzA2MTA1MTM3WhgPMjEyMDA2MTIxMDUxMzdaMFUxCzAJBgNVBAYTAkRFMRAwDgYD
VQQIDAdFbmdsYW5kMRAwDgYDVQQKDAdDYW11bmRhMQ4wDAYDVQQLDAV6ZWViZTES
MBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
AQEA0ALY6dhCih7lbyOI79N1HTi7vapsw7DISr+btQgZArsPt/xnU2tTvCH7F7mJ
OQiz1T5cUrNqTi9ZSkP6nDoGsFDZkQRZkJc+fF3OjIUnZ62OGyD7LV62tKisojx4
ulNYW+a7oVu+hQtP2ht3Hsi30fgt9P1Nq+0c11BQzNQfFwo74hFQTVCbYHQf3uU7
W08o0rYCCRIN+rJXUdsD1pm5snFmg7o3nQSUGFYpDHezoZZzL/d4a3YiPAG//YBH
qT/GerhHwa5fK5PFPryns+oq+4PgaF8JB3qVQC6rJWhnmT32n0cQ4OxNTjX5+8JC
jKH3rGkPDSXf3zJaAbU0GWNzEQIDAQABo3oweDAdBgNVHQ4EFgQUgtu9rM/iDT8J
6FvuokdJ3E6gRc4wHwYDVR0jBBgwFoAUgtu9rM/iDT8J6FvuokdJ3E6gRc4wDwYD
VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwFQYDVR0RBA4wDIcEfwAAAYcE
AAAAADANBgkqhkiG9w0BAQsFAAOCAQEAkinfKsHPfDEoOsJ2ic4Bc8ynCV/Fm4GS
huTOxnHiB5KqxN12s8MBd2zTpZNx2H4Pj32W9OUUWluyLvofueTYsarvUHY4TxkT
z04aFFcK5D0lPGLy7eBPSsWmiovCTvjWixxgOiRxYo+t6/ttNvXsZ0PnAZypSbfb
vAb7DeP3SXDEP+QnpIw0PpO3IaoYgilPSrfQV1n4fgFSOVa6545cUpJHINj264qF
Si8d8c1YokLcJFHepUQzTRKOgCgds+e3496iJGhQbhIDw24dMVmefYOqDepTYVlw
KxaCNRcTKljnM9QazGG8scqJaPjGDteDYBzh63+XbdPhjzWK8/yFIA==
-----END CERTIFICATE-----
28 changes: 28 additions & 0 deletions Client.IntegrationTests/Resources/Broker/private.key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDQAtjp2EKKHuVv
I4jv03UdOLu9qmzDsMhKv5u1CBkCuw+3/GdTa1O8IfsXuYk5CLPVPlxSs2pOL1lK
Q/qcOgawUNmRBFmQlz58Xc6MhSdnrY4bIPstXra0qKyiPHi6U1hb5ruhW76FC0/a
G3ceyLfR+C30/U2r7RzXUFDM1B8XCjviEVBNUJtgdB/e5TtbTyjStgIJEg36sldR
2wPWmbmycWaDujedBJQYVikMd7OhlnMv93hrdiI8Ab/9gEepP8Z6uEfBrl8rk8U+
vKez6ir7g+BoXwkHepVALqslaGeZPfafRxDg7E1ONfn7wkKMofesaQ8NJd/fMloB
tTQZY3MRAgMBAAECggEAFnSoPB53mHebZzMb3mAinYP5aJFUao/UH5Wt1o5IPO46
1S7vbKcChCXa+IW0Fa8l0tiHmPn7ePNNnWHXVTRCcphX1Hr2vFBHk5+A49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k+eFc2T9IgPkYXYBSRluafunqEgvclUnuCwUrfwEAN07bHfSuGD
bNGJygSW2596II+xg/TRPhnF
-----END PRIVATE KEY-----
20 changes: 20 additions & 0 deletions Client.IntegrationTests/Resources/server.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-----BEGIN CERTIFICATE-----
MIIDSzCCAjMCFBDDfC44PsguTshkcc2CVESnk/UyMA0GCSqGSIb3DQEBCwUAMGIx
CzAJBgNVBAYTAkRFMRAwDgYDVQQIDAdHZXJtYW55MQ8wDQYDVQQHDAZCZXJsaW4x
ETAPBgNVBAoMCFplZWJlLmlvMQ4wDAYDVQQLDAVaZWViZTENMAsGA1UEAwwEemVs
bDAeFw0xOTA5MDUwNjE5MjFaFw0yOTA5MDIwNjE5MjFaMGIxCzAJBgNVBAYTAkRF
MRAwDgYDVQQIDAdHZXJtYW55MQ8wDQYDVQQHDAZCZXJsaW4xETAPBgNVBAoMCFpl
ZWJlLmlvMQ4wDAYDVQQLDAVaZWViZTENMAsGA1UEAwwEemVsbDCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAMncS2Y4ddY/7PNu2kW0DYdSvLcv5ONIec0V
E0+Dgls7ElVZJxqOwbIDB8Q4sOT335xpY4rtFK6lUrh541fCkVdtajI+Bv1pzFU+
9LxMPU5GD/uFScVFA2MJy9ps5L6naFYPF3ZkE3s3gb6APTFc5ou5xZTOZ5To0s/Z
ay1RQ92inxjAyvArL9IZSryB6Xq4qyBLUm8wZYZaQ+arLQ8pBADapWkgMY8tKIlA
b185hbb2nY1ns/zws+dsHA5NIk6p7yZ+D3/SXKL/0fDBcPKmgJ+3hkgBpajMtpuw
rLoWyppQfDFGCODiV/Pd1KUrIpbrZorIlkpd3s11fUooqkrtSwMCAwEAATANBgkq
hkiG9w0BAQsFAAOCAQEAmk8VLv7nzOGCvU0gwJI/Sa6JkGdiQ7Jz0cfQGWkqfN6D
Yhw/pFlFelgrD5kGLG8jAGNT4kWiaqGtoFpU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