-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added DelegationCheck support for AppInstanceDelegation
#840 - New DelegationCheck API endpoint added to AppInstanceDelegationController - New service implementation for DelegationCheck in AppInstanceDelegationService - Rewrite of existing internal delegation check logic in delegation service - Added simple integration test - Added Bruno automated test requests
- Loading branch information
Jon Kjetil Øye
committed
Oct 11, 2024
1 parent
fcfe4bb
commit 95b4c89
Showing
60 changed files
with
848 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
namespace Altinn.AccessManagement.Core.Enums; | ||
|
||
/// <summary> | ||
/// Enum for different types of rights queries in Altinn Authorization | ||
/// </summary> | ||
public enum RightsQueryType | ||
{ | ||
/// <summary> | ||
/// Default | ||
/// </summary> | ||
NotSet = 0, | ||
|
||
/// <summary> | ||
/// Rights query where the recipient is a user | ||
/// </summary> | ||
User = 1, | ||
|
||
/// <summary> | ||
/// Rights query where the recipient is an Altinn app | ||
/// </summary> | ||
AltinnApp = 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/Altinn.AccessManagement.Core/Models/ResourceDelegationCheckRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using Altinn.AccessManagement.Core.Models.ResourceRegistry; | ||
|
||
namespace Altinn.AccessManagement.Core.Models; | ||
|
||
/// <summary> | ||
/// Request model for a list of all delegable rights for a specific resource. | ||
/// </summary> | ||
public class ResourceDelegationCheckRequest | ||
{ | ||
/// <summary> | ||
/// Gets or sets the urn for identifying the resource of the rights to be checked | ||
/// </summary> | ||
[Required] | ||
public ResourceIdUrn ResourceId { get; set; } | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Altinn.AccessManagement.Core/Models/ResourceDelegationCheckResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Altinn.AccessManagement.Core.Models.Register; | ||
|
||
namespace Altinn.AccessManagement.Core.Models; | ||
|
||
/// <summary> | ||
/// Response model for the result of a delegation status check, for which rights a user is able to delegate between two parties. | ||
/// </summary> | ||
public class ResourceDelegationCheckResponse | ||
{ | ||
/// <summary> | ||
/// Gets or sets the urn identifying the party the rights can be delegated from | ||
/// </summary> | ||
public required PartyUrn From { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a list of right delegation status models | ||
/// </summary> | ||
public List<ResourceRightDelegationCheckResult> ResourceRightDelegationCheckResults { get; set; } | ||
} |
44 changes: 44 additions & 0 deletions
44
src/Altinn.AccessManagement.Core/Models/ResourceRightDelegationCheckResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Text.Json.Serialization; | ||
using Altinn.AccessManagement.Core.Enums; | ||
using Altinn.AccessManagement.Core.Models.Rights; | ||
using Altinn.Urn; | ||
|
||
namespace Altinn.AccessManagement.Core.Models; | ||
|
||
/// <summary> | ||
/// Response model describing the delegation status for a given single right, whether the authenticated user is able to delegate the right or not on behalf of the from part. | ||
/// </summary> | ||
public class ResourceRightDelegationCheckResult | ||
{ | ||
/// <summary> | ||
/// Gets or sets the right key | ||
/// </summary> | ||
[Required] | ||
public string RightKey { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the list of resource matches which uniquely identifies the resource this right applies to. | ||
/// </summary> | ||
[Required] | ||
public List<KeyValueUrn> Resource { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the set of Attribute Id and Attribute Value for a specific action, to identify the action this right applies to | ||
/// </summary> | ||
[Required] | ||
public ActionUrn Action { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether the right is delegable or not | ||
/// </summary> | ||
[Required] | ||
[JsonConverter(typeof(JsonStringEnumConverter))] | ||
public DelegableStatus Status { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets a list of details describing why or why not the right is valid in the current user and reportee party context | ||
/// </summary> | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] | ||
public List<Detail> Details { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.