π SPACE Role-based Access Control
SPACE enforces role-based access control (RBAC) to determine which API operations each service can perform.
The users declared in SPACE are not end-users of your SaaS.
Instead, they represent the components that will interact with SPACE.
Each apiKey
maps to a SPACE user, and that user is assigned a role.
This model is particularly powerful in microservice architectures:
- π οΈ For example, your Authentication microservice could have the
MANAGER
role, allowing it to create and manage contracts. - ποΈ While other microservices that only need to check if a feature is available for a user can be assigned the
EVALUATOR
role. This ensures they cannot create or modify contracts.
This separation improves security and clarity in large-scale deployments.
π₯ Available Rolesβ
SPACE defines three roles:
- EVALUATOR β Can only evaluate features and retrieve allowed services.
An evaluator cannot log into the SPACE UI.
- MANAGER β Can manage contracts and pricings, in addition to evaluator permissions.
- ADMIN β Full access, including user management and deletion.
π Authenticationβ
Every request to SPACE API (except POST /users/authenticate
) must include an x-api-key
header with the corresponding userβs API key.
π Example of an authenticated request:
POST /api/v1/features
Host: example.org:5403
Accept: application/json
Content-Type: application/json
x-api-key: <your_api_key>
To obtain an API key, you first authenticate with your SPACE username and password:
POST /api/v1/user/authenticate
Host: example.org:5403
Accept: application/json
Content-Type: application/json
{
"username": "<your_username>",
"password": "<your_password>"
}
Example response:
{
"username": "<your_username>",
"apiKey": "<your_api_key>",
"role": "EVALUATOR"
}
π API Operations by Roleβ
Below is a detailed matrix showing which endpoints each role can access.
π€ Users endpointsβ
Endpoint\Role | Unauthenticated user | EVALUATOR | MANAGER | ADMIN |
---|---|---|---|---|
POST /users/authenticate | β | β | β | β |
GET /users | β | β | β | β |
POST /users | β | β | β (1) | β (2) |
GET /users/{username} | β | β | β | β |
PUT /users/{username} | β | β | β | β |
DELETE /users/{username} | β | β | β | β |
PUT /users/{username}/api-key | β | β | β | β |
GET /users/{username}/role | β | β | β | β |
MANAGER
can create users with roles:EVALUATOR
andMANAGER
.ADMIN
can create users with roles:EVALUATOR
,MANAGER
, andADMIN
.
π οΈ Services endpointsβ
Endpoint\Role | Unauthenticated user | EVALUATOR | MANAGER | ADMIN |
---|---|---|---|---|
GET /services | β | β | β | β |
POST /services | β | β | β | β |
DELETE /services | β | β | β | β |
GET /services/{serviceName} | β | β | β | β |
PUT /services/{serviceName} | β | β | β | β |
DELETE /services/{serviceName} | β | β | β | β |
GET /services/{serviceName}/pricings | β | β | β | β |
POST /services/{serviceName}/pricings | β | β | β | β |
GET /services/{serviceName}/pricings/{pricingVersion} | β | β | β | β |
PUT /services/{serviceName}/pricings/{pricingVersion} | β | β | β | β |
DELETE /services/{serviceName}/pricings/{pricingVersion} | β | β | β | β |
π Contracts endpointsβ
Endpoint\Role | Unauthenticated user | EVALUATOR | MANAGER | ADMIN |
---|---|---|---|---|
GET /contracts | β | β | β | β |
POST /contracts | β | β | β | β |
DELETE /contracts | β | β | β | β |
GET /contracts/{userId} | β | β | β | β |
PUT /contracts/{userId} | β | β | β | β |
DELETE /contracts/{userId} | β | β | β | β |
PUT /contracts/{userId}/usageLevels | β | β | β | β |
PUT /contracts/{userId}/userContract | β | β | β | β |
PUT /contracts/{userId}/billingPeriod | β | β | β | β |
ποΈ Features endpointsβ
Endpoint\Role | Unauthenticated user | EVALUATOR | MANAGER | ADMIN |
---|---|---|---|---|
GET /features | β | β | β | β |
POST /features/{userId} | β | β | β | β |
POST /features/{userId}/pricing-token | β | β | β | β |
POST /features/{userId}/{featureId} | β | β | β | β |
π Analytics endpointsβ
Endpoint\Role | Unauthenticated user | EVALUATOR | MANAGER | ADMIN |
---|---|---|---|---|
GET /analytics/api-calls | β | β | β | β |
GET /analytics/evaluations | β | β | β | β |