diff --git a/src/SharpPulsar.Test/OAuthTest.cs b/src/SharpPulsar.Test/OAuthTest.cs index 1212336b1..ab5b3dc8a 100644 --- a/src/SharpPulsar.Test/OAuthTest.cs +++ b/src/SharpPulsar.Test/OAuthTest.cs @@ -28,8 +28,8 @@ public class OAuthTest : IAsyncLifetime public OAuthTest(ITestOutputHelper output) { var fileUri = new Uri(GetConfigFilePath()); - var issuerUrl = new Uri("https://auth.streamnative.cloud/"); - var audience = "urn:sn:pulsar:o-r7y4o:sharp"; + var issuerUrl = new Uri("https://churchos.auth0.com/"); + var audience = "https://churchos.auth0.com/api/v2/"; _output = output; var client = new PulsarClientConfigBuilder(); var serviceUrl = "pulsar://localhost:6650"; @@ -42,7 +42,7 @@ public OAuthTest(ITestOutputHelper output) _system = PulsarSystem.GetInstance(actorSystemName:"oauth"); _topic = $"persistent://public/default/oauth-{Guid.NewGuid()}"; } - [Fact(Skip = "OAuth_ProducerInstantiation")] + [Fact] public virtual async Task OAuth_ProducerInstantiation() { var producer = new ProducerConfigBuilder(); @@ -51,7 +51,7 @@ public virtual async Task OAuth_ProducerInstantiation() Assert.NotNull(stringProducerBuilder); await stringProducerBuilder.CloseAsync(); } - [Fact(Skip = "OAuth_ConsumerInstantiation")] + [Fact] public virtual async Task OAuth_ConsumerInstantiation() { var consumer = new ConsumerConfigBuilder(); @@ -61,7 +61,7 @@ public virtual async Task OAuth_ConsumerInstantiation() Assert.NotNull(stringConsumerBuilder); await stringConsumerBuilder.CloseAsync(); } - [Fact(Skip = "OAuth_ReaderInstantiation")] + [Fact] public virtual async void OAuth_ReaderInstantiation() { var reader = new ReaderConfigBuilder(); @@ -72,7 +72,7 @@ public virtual async void OAuth_ReaderInstantiation() await stringReaderBuilder.CloseAsync(); } - [Fact(Skip = "OAuth_ProduceAndConsume")] + [Fact] public async Task OAuth_ProduceAndConsume() { var topic = $"persistent://public/default/oauth-{Guid.NewGuid}"; @@ -112,7 +112,7 @@ await producer.NewMessage().KeyBytes(byteKey) //producer.Close(); await consumer.CloseAsync(); } - [Fact(Skip = "OAuth_ProduceAndConsumeBatch")] + [Fact] public async Task OAuth_ProduceAndConsumeBatch() { diff --git a/src/SharpPulsar.TestContainer/Oauth2Files/o-r7y4o-eabanonu.json b/src/SharpPulsar.TestContainer/Oauth2Files/o-r7y4o-eabanonu.json index 913cb3164..747441995 100644 --- a/src/SharpPulsar.TestContainer/Oauth2Files/o-r7y4o-eabanonu.json +++ b/src/SharpPulsar.TestContainer/Oauth2Files/o-r7y4o-eabanonu.json @@ -1 +1,7 @@ -{"type":"sn_service_account","client_id":"0BKIjB4D8X3H40pkJfn6T0KpLLqmEOzy","client_secret":"3WUI9Ha754C7k3lCO-zvE4KlORvvsAc-7ro9D9i6pUUL8jRsjLXnAe-kBIwGQ4WL","client_email":"eabanonu@o-r7y4o.auth.streamnative.cloud","issuer_url":"https://auth.streamnative.cloud/"} \ No newline at end of file +{ + "type": "client_credentials", + "client_id": "Do5UQ4XX73IYU8DzWIHiSADUI1cB9Upb", + "client_secret": "a3enxPggDZTEODmQIWvaHMiIyyjZfjB6RW1KpEB5vQ7EGlB0y-dn8ePOG_5Tzwfq", + "client_email": "eabanonu@churchos.com", + "issuer_url": "https://churchos.auth0.com" +} \ No newline at end of file diff --git a/src/SharpPulsar/Auth/OAuth2/FlowBase.cs b/src/SharpPulsar/Auth/OAuth2/FlowBase.cs index 1fd46a6b8..a09906778 100644 --- a/src/SharpPulsar/Auth/OAuth2/FlowBase.cs +++ b/src/SharpPulsar/Auth/OAuth2/FlowBase.cs @@ -50,13 +50,13 @@ public virtual void Initialize() try { var resolve = CreateMetadataResolver(); - var result = resolve.Resolve().Result; + var result = resolve.Resolve().GetAwaiter().GetResult(); Metadata = result; } - catch + catch(Exception ex) { //log.error("Unable to retrieve OAuth 2.0 server metadata", E); - throw new PulsarClientException.AuthenticationException("Unable to retrieve OAuth 2.0 server metadata"); + throw new PulsarClientException.AuthenticationException($"Unable to retrieve OAuth 2.0 server metadata: {ex.Message} -- {ex}"); } }