The Visibility Control API is a Helper service within OpenCAPIF that allows API Providers and administrators to define fine-grained rules that determine whether specific APIs can be discovered and consumed by API Invokers.
Based on this, the discovery process returns only the APIs that the Invoker is authorized to access. This approach restricts visibility from the very beginning, ensuring the Invoker cannot even see unauthorized AEFs during discovery.
*Note: The first version of this API was merged with the staging branch (Release 4). The complete changes and evolution have been developed for **Release 5**.*
## Testing & Documentation References
***Robot Tests Location:**
`/capif/tests/features/Helper/Visibility Control Api/visibility_control.robot`
***Test Plan Documentation:**
Available at `doc/testing/testplan/visibility_control` in the `develop` branch on GitLab.
---
## Core Operations
### 1. Rules Management (API Provider)
**User Story:**
As an API Provider, I want to define access control rules for my APIs, so that I can decide which API Invokers are allowed or denied to access.
**Acceptance Criteria:**
* The Provider can create, update, list, and delete access rules[cite: 1].
* Each rule includes filters (`providerSelector`, `invokerExceptions`), an `enabled` field, and a validity period (`startsAt`, `endsAt`)[cite: 1].
* The field `default_access` defines the default behavior (`ALLOW` or `DENY`)[cite: 1].
* The Helper validates Provider identity, the rule structure, time, and consistency overall.
* Only enabled and time-valid rules are enforced by the CCF.
Helper-->>Helper: 4. Time validity (e.g. startsAt < endsAt)
alt Rule invalid
Helper-->>Provider: 400 Bad Request (validation errors)
else Rule valid
Helper->>DB: 5. Store rule in RulesDB
DB-->>Helper: ruleId + timestamps
Helper-->>Provider: 201 Created (ruleId + metadata)
end
```
---
### 2. Access Decision (API Invoker)
**User Story:**
As an API Invoker, I want to discover APIs published by Providers, but I will discover only those that I am authorized to see according to the Provider/Admin’s rules.
**Acceptance Criteria & Decision Workflow:**
When sending a Service API Discovery Request, the CCF executes the following process:
1.**Identity & Discovery Initiation:**
* Verifies the identity of the Invoker.
* Lists all published APIs.
**(Note: This first part is the current Discovery Process).*
| `/rules` | `GET` | Retrieves a list of all defined visibility rules. | **200 OK**: JSON object containing an array of rules (`items`) and optional `nextPageToken`. |
| `/rules` | `POST` | Creates a new visibility rule (server generates `ruleId`). | **201 Created**: Returns created `Rule` object.<br>**400 Bad Request**: Invalid input/structure. |
| `/rules/{ruleId}` | `GET` | Retrieves details of a specific rule by ID. | **200 OK**: `Rule` object details.<br>**404 Not Found**: Rule does not exist. |
| `/rules/{ruleId}` | `PATCH` | Partially updates fields in an existing rule. | **200 OK**: Updated `Rule` object.<br>**400 Bad Request**: Invalid payload.<br>**404 Not Found**: Rule not found. |
| `/rules/{ruleId}` | `DELETE` | Removes a specific rule by ID. | **204 No Content**: Successfully deleted.<br>**404 Not Found**: Rule not found. |
| `/decision/invokers/{apiInvokerId}/discoverable-apis` | `GET` / `POST` | Evaluates and returns filtered discoverable APIs for the given invoker. | **200 OK**: `DiscoveredAPIs` list matching active rules.<br>**400 Bad Request**: Invalid parameters.<br>**404 Not Found**: Invoker not found. |