Skip to main content
Version: 2.0.1

πŸ” SPACE Role-based Access Control

SPACE enforces role-based access control (RBAC) to determine which API operations each service can perform.

Important distinction

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.
Important

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\RoleUnauthenticated userEVALUATORMANAGERADMIN
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βŒβŒβœ…βœ…
  1. MANAGER can create users with roles: EVALUATOR and MANAGER.
  2. ADMIN can create users with roles: EVALUATOR, MANAGER, and ADMIN.

πŸ› οΈ Services endpoints​

Endpoint\RoleUnauthenticated userEVALUATORMANAGERADMIN
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\RoleUnauthenticated userEVALUATORMANAGERADMIN
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\RoleUnauthenticated userEVALUATORMANAGERADMIN
GET /featuresβŒβœ…βœ…βœ…
POST /features/{userId}βŒβœ…βœ…βœ…
POST /features/{userId}/pricing-tokenβŒβœ…βœ…βœ…
POST /features/{userId}/{featureId}βŒβœ…βœ…βœ…

πŸ“ˆ Analytics endpoints​

Endpoint\RoleUnauthenticated userEVALUATORMANAGERADMIN
GET /analytics/api-callsβŒβŒβœ…βœ…
GET /analytics/evaluationsβŒβŒβœ…βœ