全部產品
Search
文件中心

Microservices Engine:GetGatewayAuthDetail - 擷取網關鑒權詳情

更新時間:Apr 21, 2026

擷取網關鑒權詳情。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

mse:GetGatewayAuthDetail

get

*Gateway

acs:mse:{#regionId}:{#accountId}:instance/{#GatewayUniqueId}

請求參數

名稱

類型

必填

描述

樣本值

Id

integer

鑒權 ID

1100

GatewayId

integer

網關 ID(和網關唯一 ID 二選一)

2274

GatewayUniqueId

string

網關唯一 ID(和網關 ID 二選一,網關唯一 ID 不為空白時優先使用網關唯一 ID 查詢)

gw-6f0dbd108a0249d2b675b3ef50b*****

AcceptLanguage

string

返回結果顯示的語言。取值:

  • zh(預設值):中文

  • en:英文

zh

返回參數

名稱

類型

描述

樣本值

object

Schema of Response

RequestId

string

請求 ID

9C96CDF8-9E6C-XXXX-XXXX-8F87A10117E6

HttpStatusCode

integer

HTTP 狀態代碼。

200

Message

string

資訊。

OK

Code

integer

用於和 Success 同步,當 Success 為 true 時,Code 為 200

200

Success

boolean

請求是否成功

true

Data

object

鑒權詳情

Id

integer

鑒權 ID

1100

Name

string

鑒權名稱

test

GatewayUniqueId

string

鑒權所屬網關的唯一 ID

gw-6f0dbd108a0249d2b675b3ef50b*****

GatewayId

integer

鑒權所屬網關的 ID

2274

Type

string

鑒權類型:

  • JWT

  • OIDC

  • IDaaS

  • ExternalAuthZ(自建的鑒權服務)

JWT

Issuer

string

鑒權類型為 JWT/OIDC 時使用:

  • JWT:表示 JWT claims 的 iss(issuer),即簽發人。

  • OIDC:表示 OIDC claims 的 iss(issuer),即簽發人

https://example.com/auth

Jwks

string

JWT 公開金鑰,JSON 格式

{\n \"keys\":[\n {\n \"kty\": \"RSA\",\n \"e\": \"AQAB\",\n \"use\": \"sig\",\n \"kid\": \"1rGufmH1YN8rqM9ZOLgo7eEST3AnL89Y-m-XGFioLoA\",\n \"alg\": \"RS256\",\n \"n\": \"rM2GIc0YTMqwNCwXnjKbW5QndkCEZgyLu3uQUnyZF7HvMTekiTvQg_39mg3dV1eaYYkYfZBogyroJBqAQXhk6VVCxlBjFVp2xstJPVWngMOOlcafwN_BKdN-EQ06O_Uu__e7gNKI3DunkNk0cNaFETE7d4meRYyTlgEzYgsrW05_ufR0BKoddL3E5JsCpUxRjH9ICbodBx0U74W6Dcci-R2EA1DBrEcboE6n90uoJs6UJNriAK_71nAsYonihU5aQFFnyPTkJHfRwHK6JlME6rn-b-rpLSpdyc6U1nOFZP2DEpz8U5FrYoLYSZIU-MQGxDhCnGc_rxl2IyP9B2qcCQ\"\n }\n ]\n}\n

IsWhite

boolean

授權黑白名單模式:

  • true:白名單模式(名單中的 hosts + paths 不需要校正即可訪問,其餘都需要校正)

  • false:黑名單模式(名單中的 hosts + paths 需要校正,其餘可直接存取)

true

GmtCreate

string

鑒權建立的 GMT 時間

2024-02-19T02:41:03.000+0000

GmtModified

string

鑒權修改的 GMT 時間

2024-02-19T02:41:03.000+0000

TokenPosition

string

JWT Token 類型:

  • HEADER:通過 Header 傳輸

HEADER

TokenName

string

JWT Token 儲存的位置

Authorization

TokenNamePrefix

string

JWT Token 的首碼

Bearer

TokenPass

boolean

是否透傳 Token

true

Status

boolean

鑒權是否開啟

false

RedirectUrl

string

授權成功後的重新導向地址(OIDC/IDaaS 使用,需要與 OIDC/IDaaS 中配置的重新導向地址保持一致。)

https://yourdomain/path

ClientId

string

服務註冊的應用 ID(OIDC/IDaaS 使用)。

example-app

ClientSecret

string

服務註冊的應用 Secret(OIDC/IDaaS 使用)。

xxxxx

CookieDomain

string

Cookie 的網域名稱,認證通過後會將 Cookie 發送到指定的網域名稱,保持登入狀態(OIDC/IDaaS 使用)。

hello.com

ScopesList

string

OIDC 範圍(OIDC 使用)。

["openid","email"]

LoginUrl

string

IDaaS 執行個體使用者登入頁地址(IDaaS 使用)。

https://daxxxxcn.aliyunidaas.com/

Sub

string

鑒權類型為 JWT 時使用;JWT claims 的 sub(subject),即主體。

https://example.com/auth

ExternalAuthZ

object

自訂鑒權資訊

ServiceId

integer

鑒權服務 ID

15300

PrefixPath

string

鑒權 API 的 Path

/auth

TokenKey

string

Token 位置,表示 Token 位於請求報文中哪個 Header 中,常見的有 Authorization 和 Cookie

Authorization

AllowRequestHeaders

array

允許的要求標頭部

string

允許的要求標頭名稱。

x-req

AllowUpstreamHeaders

array

允許的回應標頭部

string

允許的回應標頭名稱。

x-resp

Timeout

integer

鑒權服務的逾時時間,單位:秒

10

IsRestrict

boolean

自訂鑒權模式:

  • true:strict 模式,當鑒權服務不可用時(鑒權服務建立串連失敗或者返回 5xx 請求),網關拒絕用戶端請求

  • false:寬鬆模式,當鑒權服務不可用時(鑒權服務建立串連失敗或者返回 5xx 請求),網關放過用戶端請求

true

Service

object

鑒權服務資訊

Name

string

鑒權服務名稱

httpbin-auth-service

SourceType

string

鑒權服務來源類型

K8s

GroupName

string

鑒權服務所屬的分組

test

Namespace

string

鑒權服務命名空間

default

WithRequestBody

boolean

是否允許攜帶 Body

true

BodyMaxBytes

integer

Body 的最大位元組數

4000000

WithRematchRoute

boolean

是否在鑒權完成後重新匹配路由。

ResourceList

array<object>

鑒權的授權規則列表,多個規則條件之間是“或”關係,規則條件內的多個匹配項之間是“與”關係。

array<object>

鑒權的授權規則。

Id

integer

授權規則 ID

1303

AuthId

integer

規則所歸屬鑒權的 ID

2274

DomainId

integer

規則內網域名稱的 ID

1765

DomainName

string

規則內的網域名稱

example.com

Path

string

規則的匹配路徑

/test

IsWhite

boolean

授權黑白名單模式:

  • true:白名單模式(名單中的 hosts + paths 不需要校正即可訪問,其餘都需要校正)

  • false:黑名單模式(名單中的 hosts + paths 需要校正,其餘可直接存取)

true

GatewayId

integer

規則所屬網關的 ID

2274

GatewayUniqueId

string

規則所屬網關的唯一 ID

gw-6f0dbd108a0249d2b675b3ef50b*****

GmtCreate

string

授權規則的建立 GMT 時間

2024-02-19T03:32:38.000+0000

GmtModified

string

授權規則的修改 GMT 時間

2024-02-19T03:32:38.000+0000

MatchType

string

請求 Path 的匹配類型:

  • EQUAL:精確匹配

  • PRE:首碼匹配

  • ERGULAR:正則匹配

EQUAL

IgnoreCase

boolean

路徑是否開啟大小寫敏感

  • true:開啟大小寫敏感

  • false:關閉大小寫敏感

true

AuthResourceHeaderList

array<object>

規則的要求標頭(當前僅供自訂鑒權使用)

object

HeaderKey

string

要求標頭名稱

x-req

HeaderMethod

string

匹配條件:

  • EQUAL:等於

  • NOT_EQUAL:不等於

  • EXIST:存在

  • NOT_EXIST:不存在

  • INCLUDE:包含

  • EXCLUDE:不包含

  • PREFIX:首碼

  • SUFFIX:尾碼

  • REGREX:正則

EQUAL

HeaderValue

string

要求標頭的值

123

AuthResourceMode

integer

授權資源模式:

  • 0:簡單模式

  • 1:複雜模式

0

AuthResourceConfig

string

複雜模式的 YAML 配置

permissions: - not_rule: or_rules: rules: - and_rules: rules: - url_path: path: ignore_case: false prefix: /version - and_rules: rules: - url_path: path: ignore_case: false prefix: /header

樣本

正常返回樣本

JSON格式

{
  "RequestId": "9C96CDF8-9E6C-XXXX-XXXX-8F87A10117E6",
  "HttpStatusCode": 200,
  "Message": "OK",
  "Code": 200,
  "Success": true,
  "Data": {
    "Id": 1100,
    "Name": "test",
    "GatewayUniqueId": "gw-6f0dbd108a0249d2b675b3ef50b*****",
    "GatewayId": 2274,
    "Type": "JWT",
    "Issuer": "https://example.com/auth",
    "Jwks": "{\\n  \\\"keys\\\":[\\n    {\\n      \\\"kty\\\": \\\"RSA\\\",\\n      \\\"e\\\": \\\"AQAB\\\",\\n      \\\"use\\\": \\\"sig\\\",\\n      \\\"kid\\\": \\\"1rGufmH1YN8rqM9ZOLgo7eEST3AnL89Y-m-XGFioLoA\\\",\\n      \\\"alg\\\": \\\"RS256\\\",\\n      \\\"n\\\": \\\"rM2GIc0YTMqwNCwXnjKbW5QndkCEZgyLu3uQUnyZF7HvMTekiTvQg_39mg3dV1eaYYkYfZBogyroJBqAQXhk6VVCxlBjFVp2xstJPVWngMOOlcafwN_BKdN-EQ06O_Uu__e7gNKI3DunkNk0cNaFETE7d4meRYyTlgEzYgsrW05_ufR0BKoddL3E5JsCpUxRjH9ICbodBx0U74W6Dcci-R2EA1DBrEcboE6n90uoJs6UJNriAK_71nAsYonihU5aQFFnyPTkJHfRwHK6JlME6rn-b-rpLSpdyc6U1nOFZP2DEpz8U5FrYoLYSZIU-MQGxDhCnGc_rxl2IyP9B2qcCQ\\\"\\n    }\\n  ]\\n}\\n",
    "IsWhite": true,
    "GmtCreate": "2024-02-19T02:41:03.000+0000",
    "GmtModified": "2024-02-19T02:41:03.000+0000",
    "TokenPosition": "HEADER",
    "TokenName": "Authorization",
    "TokenNamePrefix": "Bearer ",
    "TokenPass": true,
    "Status": false,
    "RedirectUrl": "https://yourdomain/path",
    "ClientId": "example-app",
    "ClientSecret": "xxxxx",
    "CookieDomain": "hello.com",
    "ScopesList": "[\"openid\",\"email\"]",
    "LoginUrl": "https://daxxxxcn.aliyunidaas.com/",
    "Sub": "https://example.com/auth",
    "ExternalAuthZ": {
      "ServiceId": 15300,
      "PrefixPath": "/auth",
      "TokenKey": "Authorization",
      "AllowRequestHeaders": [
        "x-req"
      ],
      "AllowUpstreamHeaders": [
        "x-resp"
      ],
      "Timeout": 10,
      "IsRestrict": true,
      "Service": {
        "Name": " httpbin-auth-service",
        "SourceType": "K8s",
        "GroupName": "test",
        "Namespace": "default"
      },
      "WithRequestBody": true,
      "BodyMaxBytes": 4000000,
      "WithRematchRoute": true
    },
    "ResourceList": [
      {
        "Id": 1303,
        "AuthId": 2274,
        "DomainId": 1765,
        "DomainName": "example.com",
        "Path": "/test",
        "IsWhite": true,
        "GatewayId": 2274,
        "GatewayUniqueId": "gw-6f0dbd108a0249d2b675b3ef50b*****",
        "GmtCreate": "2024-02-19T03:32:38.000+0000",
        "GmtModified": "2024-02-19T03:32:38.000+0000",
        "MatchType": "EQUAL",
        "IgnoreCase": true,
        "AuthResourceHeaderList": [
          {
            "HeaderKey": "x-req",
            "HeaderMethod": "EQUAL",
            "HeaderValue": "123"
          }
        ]
      }
    ],
    "AuthResourceMode": 0,
    "AuthResourceConfig": "permissions:\n  - not_rule:\n      or_rules:\n        rules:\n        - and_rules:\n            rules:\n            - url_path:\n                path:\n                  ignore_case: false\n                  prefix: /version\n        - and_rules:\n            rules:\n            - url_path:\n                path:\n                  ignore_case: false\n                  prefix: /header"
  }
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 IllegalRequest Invalid request:%s 非法請求: %s
400 InvalidParameter Parameter error:%s 請求參數錯誤:%s
500 InternalError Console error. Try again later:%s 控制台錯誤.稍後重試:%s
403 NoPermission You are not authorized to perform this operation:%s 沒有許可權使用此介面:%s
404 NotFound Not found:%s 資源不存在:%s

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情