Créer une politique MAIP
curl --request POST \
--url https://api.truthlocks.com/v1/maip/policies \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>'})
};
fetch('https://api.truthlocks.com/v1/maip/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/maip/policies"
payload = { "name": "<string>" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/maip/policies"
payload := strings.NewReader("{\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"category": "scope",
"status": "active",
"priority": 123,
"rules": [
{
"conditions": [
{
"field": "trust_score",
"op": "eq",
"value": "<unknown>"
}
],
"effect": "allow",
"requires_approval": true
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Politiques MAIP
Créer une politique MAIP
Créer une nouvelle politique d’application d’agent avec des règles conditionnelles pour le contrôle d’accès à l’exécution
POST
/
v1
/
maip
/
policies
Créer une politique MAIP
curl --request POST \
--url https://api.truthlocks.com/v1/maip/policies \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>"
}
'const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>'})
};
fetch('https://api.truthlocks.com/v1/maip/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.truthlocks.com/v1/maip/policies"
payload = { "name": "<string>" }
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.truthlocks.com/v1/maip/policies"
payload := strings.NewReader("{\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"tenant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"category": "scope",
"status": "active",
"priority": 123,
"rules": [
{
"conditions": [
{
"field": "trust_score",
"op": "eq",
"value": "<unknown>"
}
],
"effect": "allow",
"requires_approval": true
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Créer une politique MAIP
POST /v1/maip/policies
Crée une nouvelle politique d’application d’agent MAIP pour le locataire authentifié. Les politiques définissent des règles d’exécution qui sont évaluées lorsque les agents demandent l’accès à des ressources délimitées via le point de terminaison Évaluer la politique.
Les politiques MAIP sont différentes des politiques d’émission RBAC
politiques. Les politiques MAIP régissent les machines
comportement de l’agent à l’exécution basé sur les scores de confiance, la profondeur de délégation, les portées,
et le type d’agent. Les politiques RBAC régissent l’émission des identifiants et l’utilisateur humain
accès.
Authentification
Nécessite l’en-têteX-API-Key ou un jeton JWT Bearer. Portée au locataire via un cookie ou une revendication JWT.
Réponse
Renvoie l’objet de politique créé avec les champs générés par le serveur (id, tenant_id, status, horodatages).
Exemple
curl -X POST https://api.truthlocks.com/v1/maip/policies \
-H "X-API-Key: tl_live_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Block Low-Trust Write Operations",
"description": "Deny data:write scope access for agents with trust score below 0.5",
"category": "trust",
"priority": 10,
"rules": [
{
"conditions": [
{"field": "trust_score", "op": "lt", "value": 0.5},
{"field": "scope", "op": "eq", "value": "data:write"}
],
"effect": "deny",
"requires_approval": false
}
]
}'
const response = await fetch("https://api.truthlocks.com/v1/maip/policies", {
method: "POST",
headers: {
"X-API-Key": "tl_live_...",
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "Block Low-Trust Write Operations",
description:
"Deny data:write scope access for agents with trust score below 0.5",
category: "trust",
priority: 10,
rules: [
{
conditions: [
{ field: "trust_score", op: "lt", value: 0.5 },
{ field: "scope", op: "eq", value: "data:write" },
],
effect: "deny",
requires_approval: false,
},
],
}),
});
const policy = await response.json();
import requests
response = requests.post(
"https://api.truthlocks.com/v1/maip/policies",
headers={
"X-API-Key": "tl_live_...",
"Content-Type": "application/json",
},
json={
"name": "Block Low-Trust Write Operations",
"description": "Deny data:write scope access for agents with trust score below 0.5",
"category": "trust",
"priority": 10,
"rules": [
{
"conditions": [
{"field": "trust_score", "op": "lt", "value": 0.5},
{"field": "scope", "op": "eq", "value": "data:write"},
],
"effect": "deny",
"requires_approval": False,
}
],
},
)
policy = response.json()
Corps
application/json
Réponse
Politique créée

