Bỏ qua, đến nội dung

@digiforce-nc/plugin-idp-oauth ​

Plugin OAuth Identity Provider — biến ứng dụng Digiforce thành OAuth 2.0 provider, cho phép ứng dụng bên thứ ba đăng nhập qua Digiforce.

Plugin này làm gì? ​

Thông thường, Digiforce kết nối đến IdP bên ngoài (Google, GitHub...) để đăng nhập. Plugin này làm ngược lại: biến Digiforce thành IdP, cấp phát access token cho ứng dụng third-party theo chuẩn OAuth 2.0 (Authorization Code, Client Credentials).

Cơ chế hoạt động ​

Tính năng chính ​

#Tính năngMô tả
1Authorization CodeFlow chuẩn cho web app
2Client CredentialsFlow cho server-to-server
3Consent screenHiển thị quyền app yêu cầu để user đồng ý
4Token managementAccess token, refresh token, revoke
5ScopesGiới hạn quyền truy cập (profile, email, read, write)
6Client registryQuản lý OAuth client (client_id, client_secret)

API endpoints ​

EndpointMô tả
GET /oauth/authorizeAuthorization endpoint
POST /oauth/tokenToken endpoint (exchange code, refresh)
POST /oauth/revokeThu hồi token
GET /oauth/userinfoThông tin user (OpenID Connect)
oauthClients CRUDQuản lý OAuth client

Database ​

BảngMô tả
oauthClientsĐăng ký client (id, secret, redirect_uri, scopes)
oauthAuthorizationCodesAuthorization codes (code, clientId, userId, expiresAt)
oauthAccessTokensAccess tokens (token, clientId, userId, scopes)
oauthRefreshTokensRefresh tokens

Thành phần client ​

Thành phầnMô tả
OAuthClientListDanh sách OAuth clients đã đăng ký
OAuthClientFormForm tạo/sửa OAuth client
ConsentScreenGiao diện đồng ý ủy quyền cho user
TokenManagerQuản lý và thu hồi token

Dependencies ​

PackageVai trò
@digiforce-nc/serverServer framework
@digiforce-nc/databaseDatabase ORM
@digiforce-nc/clientClient UI framework
@digiforce-nc/authAuth framework

Mục lục chi tiết ​