跳轉到主要內容

型別別名:AuthorizationServerMetadata

type AuthorizationServerMetadata = {
  authorization_endpoint: string;
  code_challenge_methods_supported?: string[];
  grant_types_supported?: string[];
  introspection_endpoint?: string;
  introspection_endpoint_auth_methods_supported?: string[];
  introspection_endpoint_auth_signing_alg_values_supported?: string[];
  issuer: string;
  jwks_uri?: string;
  op_policy_uri?: string;
  op_tos_uri?: string;
  registration_endpoint?: string;
  response_modes_supported?: string[];
  response_types_supported: string[];
  revocation_endpoint?: string;
  revocation_endpoint_auth_methods_supported?: string[];
  revocation_endpoint_auth_signing_alg_values_supported?: string[];
  scope_supported?: string[];
  service_documentation?: string;
  token_endpoint: string;
  token_endpoint_auth_methods_supported?: string[];
  token_endpoint_auth_signing_alg_values_supported?: string[];
  ui_locales_supported?: string[];
  userinfo_endpoint?: string;
};

OAuth 2.0 授權伺服器中繼資料(Authorization Server Metadata)的結構,依據 RFC 8414 定義。

型別宣告

authorization_endpoint

authorization_endpoint: string;

授權伺服器的授權端點(authorization endpoint)URL [RFC6749]。 除非不支援任何使用授權端點的授權類型(grant types),否則此欄位為必填。

參見

https://rfc-editor.org/rfc/rfc6749#section-3.1

code_challenge_methods_supported?

optional code_challenge_methods_supported: string[];

JSON 陣列,包含此授權伺服器支援的 PKCE(Proof Key for Code Exchange)[RFC7636] code challenge 方法列表。

grant_types_supported?

optional grant_types_supported: string[];

JSON 陣列,包含此授權伺服器支援的 OAuth 2.0 授權類型(grant type)值。陣列值與「OAuth 2.0 動態用戶端註冊協議」[RFC7591] 中 grant_types 參數所用值相同。 若省略,預設值為 ["authorization_code", "implicit"]

introspection_endpoint?

optional introspection_endpoint: string;

授權伺服器的 OAuth 2.0 introspection 端點 URL [RFC7662]。

introspection_endpoint_auth_methods_supported?

optional introspection_endpoint_auth_methods_supported: string[];

introspection_endpoint_auth_signing_alg_values_supported?

optional introspection_endpoint_auth_signing_alg_values_supported: string[];

issuer

issuer: string;

授權伺服器的簽發者(Issuer)識別符,為一個使用 https 協定且無查詢或片段組件的 URL。

jwks_uri?

optional jwks_uri: string;

授權伺服器的 JWK Set [JWK] 文件 URL。該文件包含用戶端用來驗證授權伺服器簽章的簽名金鑰。此 URL 必須使用 https 協定。

op_policy_uri?

optional op_policy_uri: string;

op_tos_uri?

optional op_tos_uri: string;

registration_endpoint?

optional registration_endpoint: string;

授權伺服器的 OAuth 2.0 動態用戶端註冊端點 URL [RFC7591]。

response_modes_supported?

optional response_modes_supported: string[];

JSON 陣列,包含此授權伺服器支援的 OAuth 2.0 response_mode 值,詳見「OAuth 2.0 多重回應型態編碼實踐」 [OAuth.Responses]。

若省略,預設為 ["query", "fragment"]。回應模式值 "form_post" 亦定義於「OAuth 2.0 表單回傳回應模式」 [OAuth.FormPost]。

response_types_supported

response_types_supported: string[];

JSON 陣列,包含此授權伺服器支援的 OAuth 2.0 response_type 值。陣列值與「OAuth 2.0 動態用戶端註冊協議」[RFC7591] 中 response_types 參數所用值相同。

revocation_endpoint?

optional revocation_endpoint: string;

授權伺服器的 OAuth 2.0 撤銷端點(revocation endpoint)URL [RFC7009]。

revocation_endpoint_auth_methods_supported?

optional revocation_endpoint_auth_methods_supported: string[];

revocation_endpoint_auth_signing_alg_values_supported?

optional revocation_endpoint_auth_signing_alg_values_supported: string[];

scope_supported?

optional scope_supported: string[];

service_documentation?

optional service_documentation: string;

token_endpoint

token_endpoint: string;

授權伺服器的權杖端點(token endpoint)URL [RFC6749]。 除非僅支援 implicit 授權類型,否則此欄位為必填。

參見

https://rfc-editor.org/rfc/rfc6749#section-3.2

token_endpoint_auth_methods_supported?

optional token_endpoint_auth_methods_supported: string[];

token_endpoint_auth_signing_alg_values_supported?

optional token_endpoint_auth_signing_alg_values_supported: string[];

ui_locales_supported?

optional ui_locales_supported: string[];

userinfo_endpoint?

optional userinfo_endpoint: string;

OpenID Connect userinfo 端點 的 URL。 此端點用於取得已驗證使用者的相關資訊。

參見

https://datatracker.ietf.org/doc/html/rfc8414