التحقق من الرموز بشكل صحيح
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
list every check a server must make on a token.
الموضوعات المخطط لها
- Verify the signature with the expected key and the expected algorithm; never trust the token's own
alg, and rejectalg: none. - Check
issequals your issuer andaudincludes your API. - Check
exp(andnbfif used), allowing only a tiny clock skew. - Use a well-tested library (Spring's resource server uses Nimbus); never hand-write validation.
- Keep signing keys secret (shared secret) or the private key private (asymmetric).
تفاصيل المخطط المبدئي
عرض عملي
a checklist: signature, algorithm, issuer, audience, expiry, then roles.
اختبر فهمك
Why reject alg: none?
أظهر الإجابة
It means "unsigned", so anyone could forge a token.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.