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. |
jwt |
| Type |
string |
No |
The authentication method. Valid values:
|
JWT |
| Issuer |
string |
No |
This parameter is valid if Type is set to JWT or OIDC:
|
testing@secure.istio.io |
| Jwks |
string |
No |
The JWT public key in JSON format. |
{"keys":[{"e":"AQAB","kid":"DHFbpoIUqrY8t2zpA2qXfCmr5VO5ZEr4RzHU_-envvQ","kty":"RSA","n":"xAE7eB6qugXyCAG3yhh7pkDkT65pHymX-P7KfIupjf59vsdo91bSP9C8H07pSAGQO1MV_xFj9VswgsCg4R6otmg5PV2He95lZdHtOcU5DXIg_pbhLdKXbi66GlVeK6ABZOUW3WYtnNHD-91gVuoeJT_DwtGGcp4ignkgXfkiEm4sw-4sfb4qdt5oLbyVpmW6x9cfa7vs2WTfURiCrBoUqgBo_-4WTiULmmHSGZHOjzwa8WtrtOQGsAFjIbno85jp6MnGGGZPYZbDAa_b3y5u-YpW7ypZrvD8BgtKVjgtQgZhLAGezMt0ua3DRrWnKqTZ0BJ_EyxOGuHJrLsn00fnMQ"}]} |
| TokenPosition |
string |
No |
The type of the JWT token:
The token parameter information to be verified. By default, the token is prefixed with Bearer in the Authorization header, for example: Authorization: Bearer token. |
HEADER |
| TokenName |
string |
No |
The position where the JWT token is stored. The token parameter information to be verified. By default, the token is prefixed with Bearer in the Authorization header, for example: |
Authorization |
| TokenNamePrefix |
string |
No |
The prefix of the JWT token. The token parameter information to be verified. By default, the token is prefixed with Bearer in the Authorization header, for example: |
Bearer |
| TokenPass |
boolean |
No |
Specifies whether to pass through the token. |
true |
| IsWhite |
boolean |
No |
Specifies whether to use a whitelist. Valid values:
|
true |
| Status |
boolean |
No |
The parameter is not publicly available and does not need to be passed. By default, the parameter is disabled after the authentication is created. |
true |
| RedirectUrl |
string |
No |
The URL for redirection after authentication is successful. This parameter is valid if Type is set to OIDC or IDaaS. The redirect URL must be the same as the redirect URL that you configured in OIDC or IDaaS. |
https://test-.com/oauth2/callback |
| ClientId |
string |
No |
The ID of the application in the service registration information. This parameter is valid if Type is set to OIDC or IDaaS. |
23460e2fdd9bf9ad106**** |
| ClientSecret |
string |
No |
The application secret in the service registration information. This parameter is valid if Type is set to OIDC or IDaaS. |
123**** |
| CookieDomain |
string |
No |
The domain name of the cookie. After the authentication is successful, the cookie is sent to the specified domain name to maintain the logon status. For example: If you set |
test.com |
| ScopesList |
array |
No |
The OIDC scopes. The related parameter is valid if Type is set to OIDC. |
|
|
string |
No |
The information about the OIDC scope. |
Separate multiple values with semicolons (;). |
|
| LoginUrl |
string |
No |
The URL that is used to log on to the IDaaS instance. This parameter is valid if Type is set to IDaaS. |
*** |
| Sub |
string |
No |
The subject of JWT claims. You must make sure that the value of this parameter is the same as the sub value in the payload of JWT claims. This parameter is valid if Type is set to JWT. If this parameter is not specified or is left empty, it is set to be the same as the Issuer parameter by default |
testing@secure.istio.io |
| ExternalAuthZJSON |
object |
No |
The custom authentication information. |
|
| ServiceId |
integer |
No |
The ID of the authentication service. |
1 |
| PrefixPath |
string |
No |
The path of the authentication API provided by the authentication service. The path supports the prefix match method. |
/auth |
| TokenKey |
string |
No |
The header in which the token is in the request message. Common header types include Authorization and Cookie. |
Authorization |
| AllowRequestHeaders |
array |
No |
The header that can be carried in an authentication request. |
|
|
string |
No |
The name of the allowed request header. |
x-req |
|
| AllowUpstreamHeaders |
array |
No |
The header that can be retained in an authentication response. |
|
|
string |
No |
The name of the allowed response header. |
x-resp |
|
| Timeout |
integer |
No |
The timeout period of the authentication service. Unit: seconds. |
100 |
| IsRestrict |
boolean |
No |
Indicates whether the strict authentication mode is used. Valid values:
|
true |
| WithRequestBody |
boolean |
No |
Specifies whether to allow bodies in requests. |
true |
| BodyMaxBytes |
integer |
No |
The maximum number of bytes in a body. |
4000000 |
| WithRematchRoute |
boolean |
No |
||
| GatewayUniqueId |
string |
No |
The unique ID of the gateway. |
gw-492af9b04bb4474cae9d645be850e3d7 |
| AuthResourceMode |
integer |
No |
The authentication resource mode. Valid values:
|
1 |
| AuthResourceConfig |
string |
No |
YAML configuration in complex mode. |
|
| AuthResourceList |
array |
No |
The authorization rules. The relationship among multiple rule conditions is OR, and the relationship among multiple match items in a rule condition is AND. |
|
|
array |
No |
The data structure. |
||
| DomainId |
integer |
No |
The ID of the domain name in the rule. |
1 |
| Path |
string |
No |
The match path in the rule. |
/test |
| MatchType |
string |
No |
The method that is used to match requests based on paths. Valid values:
|
EQUAL |
| IgnoreCase |
boolean |
No |
Specifies whether to enable case sensitivity for request paths. This parameter is valid when Type is set to ExternalAuthZ. In other scenarios, request paths are case-sensitive by default.
|
true |
| AuthResourceHeaderList |
array |
No |
The request headers in the rule. The related parameters are valid when Type is set to ExternalAuthZ. |
|
|
object |
No |
|||
| HeaderKey |
string |
No |
The name of the request header. |
x-req |
| HeaderMethod |
string |
No |
The matching condition. Valid values:
|
EQUAL |
| HeaderValue |
string |
No |
The value of the request header. |
123 |
| AcceptLanguage |
string |
No |
The language in which the returned results are displayed. Valid values: zh and en. zh indicates Chinese, which is the default value. en indicates English. |
zh |
Response elements
|
Parameter |
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 message. |
You are not authorized to perform this operation. |
| Code |
integer |
The response code. The status code 200 indicates that the request was successful. |
200 |
| Success |
boolean |
Indicates whether the call was successful. Valid values:
|
true |
| Data |
integer |
The ID of the created authentication rule. |
3 |
Examples
Success response
JSON format
{
"RequestId": "4279C00F-A5E1-53C6-A43B-751C1C524D0B",
"HttpStatusCode": 200,
"Message": "You are not authorized to perform this operation.",
"Code": 200,
"Success": true,
"Data": 3
}
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.