إنشاء سياسة 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
}سياسات MAIP
إنشاء سياسة MAIP
إنشاء سياسة جديدة لفرض الوكيل مع قواعد شرطية للتحكم في الوصول في وقت التشغيل
POST
/
v1
/
maip
/
policies
إنشاء سياسة 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
}إنشاء سياسة MAIP
POST /v1/maip/policies
ينشئ سياسة إنفاذ وكيل MAIP جديدة للمستأجر المصادق عليه. تحدد السياسات قواعد وقت التشغيل التي يتم تقييمها عندما تطلب الوكلاء الوصول إلى الموارد المحددة النطاق عبر نقطة نهاية Evaluate Policy.
تختلف سياسات MAIP عن إصدار RBAC
السياسات. تحكم سياسات MAIP **الآلة
سلوك الوكيل في وقت التشغيل بناءً على درجات الثقة، وعمق التفويض، والنطاقات،
ونوع الوكيل. تحكم سياسات التحكم في الوصول المستند إلى الدور (RBAC) إصدار بيانات الاعتماد ووصول المستخدم البشري
الوصول.
المصادقة
يتطلب رأسX-API-Key أو رمز Bearer JWT. نطاق المستأجر عبر ملف تعريف الارتباط أو مطالبة JWT.
الاستجابة
يعرض كائن السياسة الذي تم إنشاؤه مع الحقول التي تم إنشاؤها بواسطة الخادم (id، tenant_id، status، الطوابع الزمنية).
مثال
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()
الجسم
application/json
الاستجابة
تم إنشاء السياسة

