Creates a gateway authentication rule.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
mse:AddGatewayAuth |
create |
*Gateway
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Name |
string |
No |
The authentication name. |
test |
| Type |
string |
No |
The authentication method. Valid values:
|
JWT |
| Issuer |
string |
No |
This parameter applies when
|
https://example.com/auth |
| Jwks |
string |
No |
The JWT public key in JSON Web Key Set (JWKS) format. |
{"keys":[{"e":"AQAB","kid":"DHFbpoIUqrY8t2zpA2qXfCmr5VO5ZEr4RzHU_-envvQ","kty":"RSA","n":"xAE7eB6qugXyCAG3yhh7pkDkT65pHymX-P7KfIupjf59vsdo91bSP9C8H07pSAGQO1MV_xFj9VswgsCg4R6otmg5PV2He95lZdHtOcU5DXIg_pbhLdKXbi66GlVeK6ABZOUW3WYtnNHD-91gVuoeJT_DwtGGcp4ignkgXfkiEm4sw-4sfb4qdt5oLbyVpmW6x9cfa7vs2WTfURiCrBoUqgBo_-4WTiULmmHSGZHOjzwa8WtrtOQGsAFjIbno85jp6MnGGGZPYZbDAa_b3y5u-YpW7ypZrvD8BgtKVjgtQgZhLAGezMt0ua3DRrWnKqTZ0BJ_EyxOGuHJrLsn00fnMQ"}]} |
| TokenPosition |
string |
No |
Specifies the location of the JWT. Valid value:
By default, the token is read from the |
HEADER |
| TokenName |
string |
No |
The name of the request header that contains the JWT. The default value is |
Authorization |
| TokenNamePrefix |
string |
No |
The prefix for the token value in the header. The default value is |
Bearer |
| TokenPass |
boolean |
No |
Specifies whether to pass the token to the backend service after successful authentication. |
true |
| IsWhite |
boolean |
No |
Specifies the authorization mode.
|
true |
| Status |
boolean |
No |
This parameter is for internal use and should not be configured. Upon creation, an authentication rule is disabled by default. |
false |
| RedirectUrl |
string |
No |
The URL to which the user is redirected after successful authentication. This parameter is required when |
https://test-.com/oauth2/callback |
| ClientId |
string |
No |
The client ID of the application registered with the identity provider. This parameter is required when |
23460e2fdd9bf9ad106**** |
| ClientSecret |
string |
No |
The client secret of the application registered with the identity provider. This parameter is required when |
123**** |
| CookieDomain |
string |
No |
The cookie domain. After successful authentication, the gateway sends a cookie to this domain to keep the user signed in. For example, if you set |
test.com |
| ScopesList |
array |
No |
The OIDC scopes. This parameter is required when |
|
|
string |
No |
An OIDC scope. |
openid |
|
| LoginUrl |
string |
No |
The URL of the user logon page for the IDaaS instance. This parameter is required when |
https://daxxxxcn.aliyunidaas.com/ |
| Sub |
string |
No |
The subject ( |
testing@secure.istio.io |
| ExternalAuthZJSON |
object |
No |
The settings for the custom authentication service. |
|
| ServiceId |
integer |
No |
The ID of the authentication service. |
1343 |
| PrefixPath |
string |
No |
The path of the authentication API provided by the authentication service. The path is matched by prefix. |
/auth |
| TokenKey |
string |
No |
The request header that contains the token, such as |
Authorization |
| AllowRequestHeaders |
array |
No |
The request headers to pass to the custom authentication service. |
|
|
string |
No |
The name of an allowed request header. |
x-req |
|
| AllowUpstreamHeaders |
array |
No |
The response headers from the custom authentication service to pass to the backend service. |
|
|
string |
No |
The name of an allowed response header. |
x-resp |
|
| Timeout |
integer |
No |
The timeout for the custom authentication service, in seconds. |
10 |
| IsRestrict |
boolean |
No |
Specifies the behavior when the custom authentication service is unavailable:
|
true |
| WithRequestBody |
boolean |
No |
Specifies whether to include the request body in the request sent to the custom authentication service. |
true |
| BodyMaxBytes |
integer |
No |
The maximum size of the request body that can be sent to the custom authentication service, in bytes. |
4000000 |
| WithRematchRoute |
boolean |
No |
Specifies whether to rematch the route after the authentication is complete. |
|
| GatewayUniqueId |
string |
No |
The unique ID of the gateway. |
gw-*****9b04bb4474cae9d645be850e3d7 |
| AuthResourceMode |
integer |
No |
The mode for configuring authorization resources. Valid values:
|
1 |
| AuthResourceConfig |
string |
No |
The YAML configuration for the advanced mode. |
|
| AuthResourceList |
array<object> |
No |
The list of authorization rules. Multiple rules are evaluated with a logical OR. Within a single rule, multiple match conditions are evaluated with a logical AND. |
|
|
array<object> |
No |
The settings for an authorization rule. |
||
| DomainId |
integer |
No |
The ID of the domain name to which the rule applies. |
1765 |
| Path |
string |
No |
The request path to match. |
/test |
| MatchType |
string |
No |
The match type for the path. Valid values:
|
EQUAL |
| IgnoreCase |
boolean |
No |
Specifies whether path matching is case-sensitive. This parameter is applicable only to custom authentication rules. For other authentication methods, path matching is case-sensitive by default.
|
true |
| AuthResourceHeaderList |
array<object> |
No |
A list of request header conditions to match. This parameter is applicable only to custom authentication rules. |
|
|
object |
No |
|||
| HeaderKey |
string |
No |
The name of the request header. |
x-req |
| HeaderMethod |
string |
No |
The match condition. Valid values:
|
EQUAL |
| HeaderValue |
string |
No |
The value of the request header. |
123 |
| AcceptLanguage |
string |
No |
The language of the response. Valid values: |
zh |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The data structure. |
||
| RequestId |
string |
The request ID. |
4279C00F-A5E1-53C6-A43B-751C1C524D0B |
| HttpStatusCode |
integer |
The HTTP status code. |
200 |
| Message |
string |
The response message. |
OK |
| Code |
integer |
The response code. A value of |
200 |
| Success |
boolean |
Indicates whether the request succeeded. Valid values:
|
true |
| Data |
integer |
The ID of the created authentication rule. |
333 |
Examples
Success response
JSON format
{
"RequestId": "4279C00F-A5E1-53C6-A43B-751C1C524D0B",
"HttpStatusCode": 200,
"Message": "OK",
"Code": 200,
"Success": true,
"Data": 333
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | IllegalRequest | Invalid request:%s | Invalid request: %s |
| 400 | InvalidParameter | Parameter error:%s | Request parameter error: %s |
| 500 | InternalError | Console error. Try again later:%s | Console error. Try again later: %s |
| 403 | NoPermission | You are not authorized to perform this operation:%s | You do not have the permission to use this interface:%s |
| 404 | NotFound | Not found:%s | The resource does not exist:%s |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.