Class CapabilityGrantOperations
java.lang.Object
co.ankatech.ankasecure.keymanagement.CapabilityGrantOperations
The tenant's explicit capability grants: which actor may use which key for which operation, in which
exchange context, under which constraints. A basic grant names its keys; a REENCRYPT or RESIGN grant
names ordered key pairs, each authorizing its own direction only. Obtained from
AuthenticatedKeyManagementSdk.capabilityGrants().
ConferralPlanResponse plan = sdk.capabilityGrants().preview(request);
CapabilityGrantResponse grant = sdk.capabilityGrants().create(request);
-
Method Summary
Modifier and TypeMethodDescriptioncreate(CreateCapabilityGrantRequest request) Creates a capability grant (POST /tenants/{t}/capability-grants).effectiveRestrictions(UUID grantId, OffsetDateTime at) Reads the restrictions in force for a grant at an instant (GET /tenants/{t}/capability-grants/{g}/effective-restrictions).Reads one capability grant (GET /tenants/{t}/capability-grants/{g}).list(CapabilityGrantListQuery query) Lists capability grants (GET /tenants/{t}/capability-grants).policyAssignments(UUID grantId) Lists the constraint policy versions a grant has been pinned to, oldest first (GET /tenants/{t}/capability-grants/{g}/policy-assignments).preview(CreateCapabilityGrantRequest request) Previews what a grant would confer, without creating it (POST /tenants/{t}/capability-grants/preview).replacePolicyVersion(UUID grantId, ReplaceCapabilityGrantPolicyVersionRequest request) Re-pins a grant to a constraint policy version (PUT /tenants/{t}/capability-grants/{g}/policy-version), which governs it from the next request on.voidrevoke(UUID grantId, RevokeCapabilityGrantRequest request) Revokes a capability grant (POST /tenants/{t}/capability-grants/{g}/revoke).
-
Method Details
-
list
Lists capability grants (GET /tenants/{t}/capability-grants).- Parameters:
query- the filters and page; must not benull- Returns:
- one page of grants
- Throws:
KeyManagementSdkException- when the call is refused
-
create
Creates a capability grant (POST /tenants/{t}/capability-grants).- Parameters:
request- the grant; must not benull- Returns:
- the created grant
- Throws:
KeyManagementSdkException- when the call is refused
-
preview
Previews what a grant would confer, without creating it (POST /tenants/{t}/capability-grants/preview).- Parameters:
request- the grant to preview; must not benull- Returns:
- the conferral plan
- Throws:
KeyManagementSdkException- when the call is refused
-
get
Reads one capability grant (GET /tenants/{t}/capability-grants/{g}).- Parameters:
grantId- the grant; must not benull- Returns:
- the grant
- Throws:
KeyManagementSdkException- when the call is refused
-
revoke
Revokes a capability grant (POST /tenants/{t}/capability-grants/{g}/revoke). The revocation is terminal.- Parameters:
grantId- the grant; must not benullrequest- the audited reason for the revocation, required; must not benull- Throws:
KeyManagementSdkException- when the call is refused
-
replacePolicyVersion
public CapabilityGrantPolicyAssignment replacePolicyVersion(UUID grantId, ReplaceCapabilityGrantPolicyVersionRequest request) Re-pins a grant to a constraint policy version (PUT /tenants/{t}/capability-grants/{g}/policy-version), which governs it from the next request on. The grant's capabilities, keys, exchange context and owner are unchanged, and the pin is recorded as a new entry of the grant's assignment history.The grant keeps the uses already counted against it, and the new version's
maxUsageapplies to that count. Uses made while no limit was pinned are not counted, so they do not count toward a limit pinned later: re-pinning from an unlimited version starts counting at 0.- Parameters:
grantId- the grant; must not benullrequest- the constraint policy version to pin; must not benull- Returns:
- the new assignment
- Throws:
KeyManagementSdkException- when the call is refused (409 when the grant was used up or revoked, is already pinned to the version, or the version is not one of the tenant's)
-
policyAssignments
Lists the constraint policy versions a grant has been pinned to, oldest first (GET /tenants/{t}/capability-grants/{g}/policy-assignments).- Parameters:
grantId- the grant; must not benull- Returns:
- the grant's assignment history
- Throws:
KeyManagementSdkException- when the call is refused
-
effectiveRestrictions
Reads the restrictions in force for a grant at an instant (GET /tenants/{t}/capability-grants/{g}/effective-restrictions). When no version was pinned at that instant, every version member isnulland the grant was unlimited.- Parameters:
grantId- the grant; must not benullat- the instant, ornullfor now- Returns:
- the constraint policy version in force, with its limits and schedule
- Throws:
KeyManagementSdkException- when the call is refused (404 for an instant before the grant was created)
-