雲效開放能力作為 OAuth 2.0 授權伺服器對外提供授權服務。第三方應用通過授權碼 + PKCE 流程,在獲得使用者授權後代表該使用者訪問雲效開放能力,無需接觸使用者登入憑據;簽發的存取權杖擁有與授權使用者等同的資源存取權限。
支援的能力
| 能力 | 支援情況 |
| 授權模式 | 授權碼模式(authorization_code),支援 refresh_token 重新整理 |
| 用戶端類型 | 公用用戶端;token_endpoint_auth_method 僅支援 none,不簽發 client_secret |
| PKCE | 強制啟用,code_challenge_method 僅支援 S256 |
| 動態用戶端註冊(DCR) | 支援;用戶端自動擷取 client_id,無需預先申請 |
| 中繼資料發現 | 支援授權伺服器中繼資料與受保護資源中繼資料發現 |
| 令牌形態 | opaque 令牌(非 JWT);存取權杖以 oat- 開頭,重新整理權杖以 ort- 開頭 |
| 令牌有效期間 | 存取權杖 24 小時;重新整理權杖 90 天 |
不支援的能力
| 不支援項 | 說明 |
用戶端憑證模式(client_credentials) | 不支援無使用者參與的機器對機器授權 |
Cipher 模式(password) | 不支援 |
簡化模式(implicit) | 不支援 |
plain PKCE | 不支援,僅接受 S256 |
機密用戶端 / client_secret | 不簽發、不校正 |
| 令牌內省端點、令牌吊銷端點 | 未對外暴露 |
| 通過 scope 限權 | 不支援;令牌許可權與授權使用者等同,scope 僅作中繼資料存放區 |
網站
中心站與 Region 站分別提供授權能力,兩站相互獨立,client_id 與令牌不跨站通用。
| 網站 | 服務地址 |
| 中心站 | https://openapi-rdc.aliyuncs.com |
| Region 站 | 執行個體訪問網域名稱(通過控制台執行個體設定頁面擷取) |
端點說明
各端點地址應通過中繼資料發現介面擷取,避免寫入程式碼——授權端點與令牌端點可能位於不同網域名稱。
端點總覽
| 端點 | 路徑 | 方法 | 鑒權 | 用途 |
| 授權伺服器中繼資料 | /.well-known/oauth-authorization-server | GET | 匿名 | 發現各端點地址 |
| 受保護資源中繼資料 | /.well-known/oauth-protected-resource | GET | 匿名 | 反查授權伺服器 |
| 動態用戶端註冊 | /v1/oauth2/register | POST | 匿名 | 註冊用戶端,擷取 client_id |
| 授權端點 | /v1/oauth2/authorize | GET / POST | 使用者登入 | 使用者確認授權,下發授權碼 |
| 令牌端點 | /v1/oauth2/token | POST | 公用用戶端(匿名) | 授權碼換令牌 / 重新整理權杖 |
授權伺服器中繼資料
/.well-known/oauth-authorization-server 返回以下欄位:
| 欄位 | 值 |
issuer | 授權伺服器標識(隨網站不同而不同) |
authorization_endpoint | 授權端點地址(可能與令牌端點不同域) |
token_endpoint | 令牌端點地址 |
registration_endpoint | 動態註冊端點地址 |
response_types_supported | ["code"] |
grant_types_supported | ["authorization_code", "refresh_token"] |
code_challenge_methods_supported | ["S256"] |
token_endpoint_auth_methods_supported | ["none"] |
說明
中繼資料不含 scopes_supported、jwks_uri、introspection_endpoint、revocation_endpoint,響應帶 Cache-Control: public, max-age=3600。
受保護資源中繼資料
/.well-known/oauth-protected-resource 返回以下欄位:
| 欄位 | 說明 |
resource | 受保護資源標識 |
authorization_servers | 該資源對應的授權伺服器地址清單 |