Nâng CaoJava iconJava

OAuth 2.1 + Spring Authorization Server hoạt động như thế nào trong kiến trúc microservices?

Kiến trúc: một Authorization Server trung tâm (dùng Spring Authorization Server) đóng vai identity provider — phát JWT.

Nhiều Resource Server (microservices) validate token cục bộ (không cần network call đến auth server mỗi request).

Flow:

  1. Client lấy token từ /oauth2/token với client credentials hoặc authorization code.
  2. Client gửi request với header Authorization: Bearer <JWT>.
  3. Resource Server verify JWT signature, kiểm tra claims (issuer, expiration, scope)

OAuth 2.1 loại bỏ các grant type nguy hiểm của 2.0: không còn Implicit Grant, Password Grant (credential phishing).

PKCE bắt buộc với Authorization Code.

Spring Security 6: @EnableMethodSecurity thay thế @EnableGlobalMethodSecurity, lambda DSL thay XML.

Xem toàn bộ Java cùng filter theo level & chủ đề con.

Mở danh sách Java