Skip to content

Commit 4d7c800

Browse files
committed
hotfix: audience verify response parsing
1 parent 5630d2d commit 4d7c800

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

VirtualFinland.UserAPI/src/VirtualFinland.UsersAPI/Helpers/Services/DataspaceAudienceSecurityService.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ public async Task VerifyAudience(string audience)
3434
using var response = await _httpClient.GetAsync(verifyUrl);
3535
response.EnsureSuccessStatusCode();
3636

37-
var responseData = await JsonSerializer.DeserializeAsync<AudienceVerifyResponse>(await response.Content.ReadAsStreamAsync()) ??
37+
var responseData = await JsonSerializer.DeserializeAsync<AudienceVerifyResponse>(await response.Content.ReadAsStreamAsync(), new JsonSerializerOptions()
38+
{
39+
PropertyNameCaseInsensitive = true
40+
}) ??
3841
throw new NotAuthorizedException("Could not verify audience");
3942

40-
if (!_config.AllowedGroups.Contains(responseData.Group)) throw new NotAuthorizedException("Audience group is not allowed");
43+
if (!_config.AllowedGroups.Contains(responseData.Group))
44+
{
45+
throw new NotAuthorizedException("Audience group is not allowed");
46+
}
4147

4248
// Cache audience for 24 hours
4349
await _cacheRepository.Set(audience, responseData, TimeSpan.FromHours(24));

0 commit comments

Comments
 (0)