Skip to content

Commit 6d1f29b

Browse files
authored
Merge pull request #83 from microsoft/update-translations
🌐 Update translations via Co-op Translator
2 parents cc2a054 + 3ccbdae commit 6d1f29b

File tree

180 files changed

+121915
-99980
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+121915
-99980
lines changed

translations/ar/05-AdvancedTopics/README.md

Lines changed: 2568 additions & 2559 deletions
Large diffs are not rendered by default.
Lines changed: 128 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,128 @@
1-
<!--
2-
CO_OP_TRANSLATOR_METADATA:
3-
{
4-
"original_hash": "bcd07a55d0e5baece8d0a1a0310fdfe6",
5-
"translation_date": "2025-05-17T15:38:52+00:00",
6-
"source_file": "05-AdvancedTopics/mcp-oauth2-demo/README.md",
7-
"language_code": "ar"
8-
}
9-
-->
10-
# MCP OAuth2 Demo
11-
12-
هذا المشروع هو **تطبيق Spring Boot بسيط** يعمل كـ:
13-
14-
* **خادم تفويض Spring** (يصدر رموز JWT عبر تدفق `client_credentials`)، و
15-
* **خادم موارد** (يحمي نقطة النهاية الخاصة به `/hello`).
16-
17-
يعكس الإعداد الموضح في [مقالة مدونة Spring (2 أبريل 2025)](https://spring.io/blog/2025/04/02/mcp-server-oauth2).
18-
19-
---
20-
21-
## البدء السريع (محلي)
22-
23-
```bash
24-
# build & run
25-
./mvnw spring-boot:run
26-
27-
# obtain a token
28-
curl -u mcp-client:secret -d grant_type=client_credentials \
29-
http://localhost:8081/oauth2/token | jq -r .access_token > token.txt
30-
31-
# call the protected endpoint
32-
curl -H "Authorization: Bearer $(cat token.txt)" http://localhost:8081/hello
33-
```
34-
35-
---
36-
37-
## اختبار تكوين OAuth2
38-
39-
يمكنك اختبار تكوين أمان OAuth2 بالخطوات التالية:
40-
41-
### 1. تحقق من تشغيل الخادم وتأمينه
42-
43-
```bash
44-
# This should return 401 Unauthorized, confirming OAuth2 security is active
45-
curl -v http://localhost:8081/
46-
```
47-
48-
### 2. الحصول على رمز وصول باستخدام بيانات اعتماد العميل
49-
50-
```bash
51-
# Get and extract the full token response
52-
curl -v -X POST http://localhost:8081/oauth2/token \
53-
-H "Content-Type: application/x-www-form-urlencoded" \
54-
-H "Authorization: Basic bWNwLWNsaWVudDpzZWNyZXQ=" \
55-
-d "grant_type=client_credentials&scope=mcp.access"
56-
57-
# Or to extract just the token (requires jq)
58-
curl -s -X POST http://localhost:8081/oauth2/token \
59-
-H "Content-Type: application/x-www-form-urlencoded" \
60-
-H "Authorization: Basic bWNwLWNsaWVudDpzZWNyZXQ=" \
61-
-d "grant_type=client_credentials&scope=mcp.access" | jq -r .access_token > token.txt
62-
```
63-
64-
ملاحظة: يحتوي رأس المصادقة الأساسية (`bWNwLWNsaWVudDpzZWNyZXQ=`) is the Base64 encoding of `mcp-client:secret`.
65-
66-
### 3. الوصول إلى نقطة النهاية المحمية باستخدام الرمز
67-
68-
```bash
69-
# Using the saved token
70-
curl -H "Authorization: Bearer $(cat token.txt)" http://localhost:8081/hello
71-
72-
# Or directly with the token value
73-
curl -H "Authorization: Bearer eyJra...token_value...xyz" http://localhost:8081/hello
74-
```
75-
76-
يؤكد الرد الناجح مع "مرحبًا من MCP OAuth2 Demo!" أن تكوين OAuth2 يعمل بشكل صحيح.
77-
78-
---
79-
80-
## بناء الحاوية
81-
82-
```bash
83-
docker build -t mcp-oauth2-demo .
84-
docker run -p 8081:8081 mcp-oauth2-demo
85-
```
86-
87-
---
88-
89-
## النشر إلى **تطبيقات حاويات Azure**
90-
91-
```bash
92-
az containerapp up -n mcp-oauth2 \
93-
-g demo-rg -l westeurope \
94-
--image <your-registry>/mcp-oauth2-demo:latest \
95-
--ingress external --target-port 8081
96-
```
97-
98-
يصبح FQDN للتوجيه هو **الجهة المصدرة** (`https://<fqdn>`).
99-
Azure provides a trusted TLS certificate automatically for `*.azurecontainerapps.io`.
100-
101-
---
102-
103-
## ربط في **إدارة واجهة برمجة تطبيقات Azure**
104-
105-
أضف هذه السياسة الواردة إلى واجهة برمجة التطبيقات الخاصة بك:
106-
107-
```xml
108-
<inbound>
109-
<validate-jwt header-name="Authorization">
110-
<openid-config url="https://<fqdn>/.well-known/openid-configuration"/>
111-
<audiences>
112-
<audience>mcp-client</audience>
113-
</audiences>
114-
</validate-jwt>
115-
<base/>
116-
</inbound>
117-
```
118-
119-
ستقوم APIM بجلب JWKS والتحقق من كل طلب.
120-
121-
**إخلاء المسؤولية**:
122-
تم ترجمة هذه الوثيقة باستخدام خدمة الترجمة بالذكاء الاصطناعي [Co-op Translator](https://github.com/Azure/co-op-translator). بينما نسعى لتحقيق الدقة، يُرجى العلم أن الترجمات الآلية قد تحتوي على أخطاء أو عدم دقة. يجب اعتبار الوثيقة الأصلية بلغتها الأصلية المصدر الرسمي. بالنسبة للمعلومات الحيوية، يُوصى بالترجمة البشرية الاحترافية. نحن غير مسؤولين عن أي سوء فهم أو تفسيرات خاطئة تنشأ عن استخدام هذه الترجمة.
1+
<!--
2+
CO_OP_TRANSLATOR_METADATA:
3+
{
4+
"original_hash": "9dc0d1fc8ddcd9426558f0d200894951",
5+
"translation_date": "2025-06-02T11:56:36+00:00",
6+
"source_file": "05-AdvancedTopics/mcp-oauth2-demo/README.md",
7+
"language_code": "ar"
8+
}
9+
-->
10+
# MCP OAuth2 Demo
11+
12+
هذا المشروع هو **تطبيق Spring Boot بسيط** يعمل كـ:
13+
14+
* **خادم تفويض Spring** (يصدر رموز وصول JWT عبر تدفق `client_credentials`)، و
15+
* **خادم موارد** (يحمي نقطة النهاية الخاصة به `/hello`).
16+
17+
يعكس الإعداد المعروض في [مقالة مدونة Spring (2 أبريل 2025)](https://spring.io/blog/2025/04/02/mcp-server-oauth2).
18+
19+
---
20+
21+
## بدء سريع (محلي)
22+
23+
```bash
24+
# build & run
25+
./mvnw spring-boot:run
26+
27+
# obtain a token
28+
curl -u mcp-client:secret -d grant_type=client_credentials \
29+
http://localhost:8081/oauth2/token | jq -r .access_token > token.txt
30+
31+
# call the protected endpoint
32+
curl -H "Authorization: Bearer $(cat token.txt)" http://localhost:8081/hello
33+
```
34+
35+
---
36+
37+
## اختبار تكوين OAuth2
38+
39+
يمكنك اختبار إعداد أمان OAuth2 باتباع الخطوات التالية:
40+
41+
### 1. تحقق من تشغيل الخادم وتأمينه
42+
43+
```bash
44+
# This should return 401 Unauthorized, confirming OAuth2 security is active
45+
curl -v http://localhost:8081/
46+
```
47+
48+
### 2. احصل على رمز وصول باستخدام بيانات اعتماد العميل
49+
50+
```bash
51+
# Get and extract the full token response
52+
curl -v -X POST http://localhost:8081/oauth2/token \
53+
-H "Content-Type: application/x-www-form-urlencoded" \
54+
-H "Authorization: Basic bWNwLWNsaWVudDpzZWNyZXQ=" \
55+
-d "grant_type=client_credentials&scope=mcp.access"
56+
57+
# Or to extract just the token (requires jq)
58+
curl -s -X POST http://localhost:8081/oauth2/token \
59+
-H "Content-Type: application/x-www-form-urlencoded" \
60+
-H "Authorization: Basic bWNwLWNsaWVudDpzZWNyZXQ=" \
61+
-d "grant_type=client_credentials&scope=mcp.access" | jq -r .access_token > token.txt
62+
```
63+
64+
ملاحظة: رأس المصادقة الأساسية (`bWNwLWNsaWVudDpzZWNyZXQ=`) is the Base64 encoding of `mcp-client:secret`.
65+
66+
### 3. الوصول إلى نقطة النهاية المحمية باستخدام الرمز
67+
68+
```bash
69+
# Using the saved token
70+
curl -H "Authorization: Bearer $(cat token.txt)" http://localhost:8081/hello
71+
72+
# Or directly with the token value
73+
curl -H "Authorization: Bearer eyJra...token_value...xyz" http://localhost:8081/hello
74+
```
75+
76+
الاستجابة الناجحة مع "Hello from MCP OAuth2 Demo!" تؤكد أن تكوين OAuth2 يعمل بشكل صحيح.
77+
78+
---
79+
80+
## بناء الحاوية
81+
82+
```bash
83+
docker build -t mcp-oauth2-demo .
84+
docker run -p 8081:8081 mcp-oauth2-demo
85+
```
86+
87+
---
88+
89+
## النشر إلى **Azure Container Apps**
90+
91+
```bash
92+
az containerapp up -n mcp-oauth2 \
93+
-g demo-rg -l westeurope \
94+
--image <your-registry>/mcp-oauth2-demo:latest \
95+
--ingress external --target-port 8081
96+
```
97+
98+
يصبح اسم المجال الكامل (FQDN) الخاص بالدخول هو **المُصدر** (`https://<fqdn>`).
99+
Azure provides a trusted TLS certificate automatically for `*.azurecontainerapps.io`.
100+
101+
---
102+
103+
## الربط مع **Azure API Management**
104+
105+
أضف سياسة الإدخال هذه إلى واجهة برمجة التطبيقات الخاصة بك:
106+
107+
```xml
108+
<inbound>
109+
<validate-jwt header-name="Authorization">
110+
<openid-config url="https://<fqdn>/.well-known/openid-configuration"/>
111+
<audiences>
112+
<audience>mcp-client</audience>
113+
</audiences>
114+
</validate-jwt>
115+
<base/>
116+
</inbound>
117+
```
118+
119+
سيقوم APIM بجلب JWKS والتحقق من صحة كل طلب.
120+
121+
---
122+
123+
## ماذا بعد
124+
125+
- [5.2 Web Search MCP Sample](../web-search-mcp/README.md)
126+
127+
**تنويه**:
128+
تمت ترجمة هذا المستند باستخدام خدمة الترجمة الآلية [Co-op Translator](https://github.com/Azure/co-op-translator). بينما نسعى للدقة، يرجى العلم أن الترجمات الآلية قد تحتوي على أخطاء أو عدم دقة. يجب اعتبار المستند الأصلي بلغته الأصلية المصدر الموثوق به. للمعلومات الهامة، يُنصح بالاستعانة بترجمة بشرية محترفة. نحن غير مسؤولين عن أي سوء فهم أو تفسير ناتج عن استخدام هذه الترجمة.

0 commit comments

Comments
 (0)