IReferencesProvider<TIdMemberReference>

Namespace: ASPSecurityKit.Authorization
Assembly: ASPSecurityKit.dll

Summary

Provides an interface to get related references to perform data authorization on entityIds. Used by IEntityIdAuthorizer. To learn more visit https://ASPSecurityKit.net/docs/how-to-perform-activity-based-data-aware-authorization/#obtaining-related-references

Generic Types
Name Description
TIdMemberReference The concrete type that implements IIdMemberReference model.

Methods

NewIdMemberReference(memberName,value,parentName)

Summary

Creates a new instance of TIdMemberReference type.

Returns

An instance of new TIdMemberReference created.

Parameters
Name Type Description
memberName System.String The entityId member name.
value System.Object The entityId member value.
parentName System.String Optional. The name of the parent container object for this member. If provided, can be used for prefixing member name that has only ‘Id’ to locate the right related references provider.
Exceptions
Type Description
System.ArgumentNullException When value is null or memberName is null/empty/whitespace.

AddSelfAsReference(idMember)

Summary

Adds the entityId to its related references collection (References). Typically called when there’s no references loader defined (IsDefinedFor) for the given entityId and direct data authorization of the entityId is thus attempted.

Returns

true if the entityId value was added successfully to its related references collection; otherwise, false.

Parameters
Name Type Description
idMember `0 The entityId member.
Exceptions
Type Description
System.ArgumentNullException When idMember is null.

IsDefinedFor(idMember)

Summary

Gets a value indicating whether any references loader has been defined for the given entityId member (the MemberName).

Returns

true if any references loader has been defined for the given entityId member; otherwise, false.

Parameters
Name Type Description
idMember `0 The entityId member.
Exceptions
Type Description
System.ArgumentNullException When idMember is null.

IsSyncDefinedFor(idMember)

Summary

Gets a value indicating whether a synchronous references loader has been defined for the given entityId member (the MemberName).

Returns

true if a synchronous references loader has been defined for the given entityId member; otherwise, false.

Parameters
Name Type Description
idMember `0 The entityId member.
Exceptions
Type Description
System.ArgumentNullException When idMember is null.

IsAsyncDefinedFor(idMember)

Summary

Gets a value indicating whether an async references loader has been defined for the given entityId member (the MemberName).

Returns

true if an async references loader has been defined for the given entityId member; otherwise, false.

Parameters
Name Type Description
idMember `0 The entityId member.
Exceptions
Type Description
System.ArgumentNullException When idMember is null.

GetReferences(idMember)

Summary

Gets the entityIds along with related references for the given entityId member. Multiple items are returned typically when the given entityId member has a collection value and each item of the collection needs to be authorized separately; otherwise, only one item is returned.

Returns

A HashSet`1 with TIdMemberReference as the generic argument, comprising entityIds (with their related references) each of which needs to be authorized.

Parameters
Name Type Description
idMember `0 The entityId member.
Exceptions
Type Description
System.ArgumentNullException When idMember is null.
System.InvalidOperationException When no references loader is registered for the given entityId member.

GetReferencesAsync(idMember)

Summary

Gets the entityIds along with related references for the given entityId member. Multiple items are returned typically when the given entityId member has a collection value and each item of the collection needs to be authorized separately; otherwise, only one item is returned.

Returns

A HashSet`1 with TIdMemberReference as the generic argument, comprising entityIds (with their related references) each of which needs to be authorized.

Parameters
Name Type Description
idMember `0 The entityId member.
Exceptions
Type Description
System.ArgumentNullException When idMember is null.
System.InvalidOperationException When no references loader is registered for the given entityId member.

GetReferencesAsync(idMember,cancellationToken)

Summary

Gets the entityIds along with related references for the given entityId member. Multiple items are returned typically when the given entityId member has a collection value and each item of the collection needs to be authorized separately; otherwise, only one item is returned.

Returns

A HashSet`1 with TIdMemberReference as the generic argument, comprising entityIds (with their related references) each of which needs to be authorized.

Parameters
Name Type Description
idMember `0 The entityId member.
cancellationToken System.Threading.CancellationToken The cancellation token.
Exceptions
Type Description
System.ArgumentNullException When idMember is null.
System.InvalidOperationException When no references loader is registered for the given entityId member.