Interface IAuthorizationServiceClient
- Namespace
- FoundationaLLM.Common.Interfaces
- Assembly
- FoundationaLLM.Common.dll
Defines methods exposed by the Authorization service.
public interface IAuthorizationServiceClient
- Extension Methods
Methods
CreateRoleAssignment(string, RoleAssignmentCreateRequest, UnifiedUserIdentity)
Creates a new role assignment.
Task<RoleAssignmentOperationResult> CreateRoleAssignment(string instanceId, RoleAssignmentCreateRequest roleAssignmentRequest, UnifiedUserIdentity userIdentity)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
roleAssignmentRequestRoleAssignmentCreateRequestThe RoleAssignmentCreateRequest containing the details of the role assignment to be created.
userIdentityUnifiedUserIdentityThe user identity.
Returns
- Task<RoleAssignmentOperationResult>
A RoleAssignmentOperationResult containing information about the result of the operation.
DeleteRoleAssignment(string, string, UnifiedUserIdentity)
Deletes a role assignment.
Task<RoleAssignmentOperationResult> DeleteRoleAssignment(string instanceId, string roleAssignment, UnifiedUserIdentity userIdentity)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
roleAssignmentstringThe role assignment object identifier.
userIdentityUnifiedUserIdentityThe user identity.
Returns
- Task<RoleAssignmentOperationResult>
A RoleAssignmentOperationResult containing information about the result of the operation.
DeleteSecretKey(string, string, string)
Deletes a specified secret key.
Task DeleteSecretKey(string instanceId, string contextId, string secretKeyId)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
contextIdstringThe identifier of the context containing the secret key to delete.
secretKeyIdstringThe unique identifier of the secret key being deleted.
Returns
GetRoleAssignments(string, RoleAssignmentQueryParameters, UnifiedUserIdentity)
Returns a list of role assignments.
Task<List<RoleAssignment>> GetRoleAssignments(string instanceId, RoleAssignmentQueryParameters queryParameters, UnifiedUserIdentity userIdentity)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
queryParametersRoleAssignmentQueryParametersThe RoleAssignmentQueryParameters providing the inputs for filtering the role assignments.
userIdentityUnifiedUserIdentityThe user identity.
Returns
- Task<List<RoleAssignment>>
The list of all role assignments for the specified instance.
GetSecretKeys(string, string)
Gets a list of SecretKey items that are associated with the specified instance and context.
Task<List<SecretKey>> GetSecretKeys(string instanceId, string contextId)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
contextIdstringThe identifier of the context for which the secret keys are retrieved.
Returns
Remarks
Each consumer of secret keys should have a unique context identifier. For example, FoundationaLLM resource providers could use the resource object identifier as the context identifier.
ProcessAuthorizationRequest(string, string, string?, List<string>, bool, bool, bool, UnifiedUserIdentity)
Processes an action authorization request.
Task<ActionAuthorizationResult> ProcessAuthorizationRequest(string instanceId, string action, string? roleName, List<string> resourcePaths, bool expandResourceTypePaths, bool includeRoles, bool includeActions, UnifiedUserIdentity userIdentity)
Parameters
instanceIdstringThe FoundationaLLM instance id.
actionstringThe action identifier.
roleNamestringAn optional role name to check for assignment.
resourcePathsList<string>The resource paths.
expandResourceTypePathsboolA value indicating whether to expand resource type paths that are not authorized.
includeRolesboolA value indicating whether to include roles in the response.
includeActionsboolA value indicating whether to include authorizable actions in the response.
userIdentityUnifiedUserIdentityThe user identity.
Returns
- Task<ActionAuthorizationResult>
An ActionAuthorizationResult containing the result of the processing.
Remarks
If the action specified by action is not authorized for a resource type path,
and expandResourceTypePaths is set to true, the response will include
any authorized resource paths matching the resource type path.
If includeRoles is set to true, for each authrorized resource path,
the response will include the roles assigned directly or indirectly to the resource path.
If action is set to true, for each authorized resource path,
the response will include the autorizable actions assigned directly or indirectly to the resource path.
UpsertSecretKey(string, SecretKey)
Creates a new or updates an existing SecretKey item.
Task<string?> UpsertSecretKey(string instanceId, SecretKey secretKey)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
secretKeySecretKeyThe SecretKey item containing the properties of the secret key being created or updated.
Returns
- Task<string>
If the secret bey is being created, it returns the secret value of the key. Otherwise, returns
null.
ValidateSecretKey(string, string, string)
Validates a secret key value.
Task<SecretKeyValidationResult> ValidateSecretKey(string instanceId, string contextId, string secretKeyValue)
Parameters
instanceIdstringThe FoundationaLLM instance identifier.
contextIdstringThe identifier of the context containing the secret key to validate.
secretKeyValuestringThe secret value of the key.
Returns
- Task<SecretKeyValidationResult>
A SecretKeyValidationResult item with the results of the validation.
Remarks
Each valid secret key has an associated virtual identity that is returned in the VirtualIdentity property. It is the responsibility of the caller to use the virtual identity to authorize the request.