Skip to content

Commit

Permalink
[fix] OAuth Test
Browse files Browse the repository at this point in the history
  • Loading branch information
eaba committed Jan 25, 2024
1 parent fc19570 commit ebea0fa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/SharpPulsar.Test/OAuthTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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<string>();
Expand All @@ -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<string>();
Expand All @@ -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<string>();
Expand All @@ -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}";
Expand Down Expand Up @@ -112,7 +112,7 @@ await producer.NewMessage().KeyBytes(byteKey)
//producer.Close();
await consumer.CloseAsync();
}
[Fact(Skip = "OAuth_ProduceAndConsumeBatch")]
[Fact]
public async Task OAuth_ProduceAndConsumeBatch()
{

Expand Down
Original file line number Diff line number Diff line change
@@ -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/"}
{
"type": "client_credentials",
"client_id": "Do5UQ4XX73IYU8DzWIHiSADUI1cB9Upb",
"client_secret": "a3enxPggDZTEODmQIWvaHMiIyyjZfjB6RW1KpEB5vQ7EGlB0y-dn8ePOG_5Tzwfq",
"client_email": "eabanonu@churchos.com",
"issuer_url": "https://churchos.auth0.com"
}
6 changes: 3 additions & 3 deletions src/SharpPulsar/Auth/OAuth2/FlowBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
}
}

Expand Down

0 comments on commit ebea0fa

Please sign in to comment.