Altinn / Altinn/app-lib-dotnet

`AuthorizationClient.GetUserRoles` doesn't handle 404 response (no roles)

Open
#1,103 0 comments 0 reactions 1 assignee Claimed by @martinothamar View on GitHub
kind/bug
Dominant language
C#
Stars
8
Forks
27
Avg merge
1h 21m
Merged PRs (30d)
7

Description

### Description of the bug

`AuthorizationClient.GetUserRoles` doesn't handle 404 responses : https://github.com/Altinn/app-lib-dotnet/blob/fdf12b5353397c19da3630062232504ccce2f8bd/src/Altinn.App.Core/Infrastructure/Clients/Authorization/AuthorizationClient.cs#L201

But localtest and authorization API will return 404 when no roles are found:
Localtest: https://github.com/Altinn/app-localtest/blob/72bc0f21bf9d4ebdd1d2d3b33c3a314fe58ff5cb/src/Controllers/Authorization/RolesController.cs#L49C55-L54
Authorization: https://github.com/Altinn/altinn-authorization/blob/1472402f3268755a9691b07ef541ca9a3bc50e81/src/Authorization/Controllers/RolesController.cs#L52-L55

### Steps To Reproduce

1. Use for example localtest and login with a user that has no roles.
2. In an app, use `IAuthenticationContext` and call `LoadDetails` which will try to fetch roles

### Additional Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.