dependabot[bot] on nuget
Bump Microsoft.AspNetCore.Mvc.C… (compare)
dependabot[bot] on nuget
Bump Microsoft.AspNetCore.Http … (compare)
dependabot[bot] on npm_and_yarn
Bump shell-quote from 1.7.2 to … (compare)
dependabot[bot] on nuget
Bump Newtonsoft.Json from 9.0.1… (compare)
s.PostConfigure<JwtBearerOptions>(JwtBearerDefaults.AuthenticationScheme, options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
IssuerSigningKey = FakeJwtGenerator.SecurityKey,
ValidIssuer = FakeJwtGenerator.Issuer,
ValidAudience = FakeJwtGenerator.Audience
};
});
My Startup.cs
contains
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.Authority = Configuration["Auth0:Domain"];
options.Audience = Configuration["Auth0:Audience"];
})
PostConfigure
runs after the bearer options were set, thereby wiping out the configuration and validating the token with the fake signing key instead of reaching out and getting the JWKs from Auth0.
// This will deactivate the callout to the OIDC server
options.ConfigurationManager =
new StaticConfigurationManager<OpenIdConnectConfiguration>(new OpenIdConnectConfiguration
{
});
ReadAsText()
is just rewinding the Response body and pulling the string out. Are you completely sure there’s actually bytes written to the response body?
Hi! I have the same issue with Alba v5 returning an empty result when using Scenario
.
var response = await Host.Scenario(x =>
{
x.Get.Url("/static/countries");
x.StatusCodeShouldBeOk();
x.ContentShouldContain("Mexico");
});
var output = response.ReadAsJson<List<CountryResponse>>(); // null
var output2 = await Host.GetAsJson<List<CountryResponse>>("/static/countries"); // ok
Note, ContentShouldContain
works as expected