Skip to content

Commit 6b86ff4

Browse files
authored
feat: basic support Apache APISIX 2.11 (#2233)
1 parent af06e08 commit 6b86ff4

File tree

20 files changed

+2592
-1142
lines changed

20 files changed

+2592
-1142
lines changed

api/conf/schema.json

Lines changed: 2331 additions & 1014 deletions
Large diffs are not rendered by default.

api/internal/handler/schema/plugin_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestPlugin(t *testing.T) {
6060
}
6161
}
6262
// plugin type
63-
assert.ElementsMatch(t, []string{"basic-auth", "jwt-auth", "hmac-auth", "key-auth", "wolf-rbac"}, authPlugins)
63+
assert.ElementsMatch(t, []string{"basic-auth", "jwt-auth", "hmac-auth", "key-auth", "wolf-rbac", "ldap-auth"}, authPlugins)
6464
// consumer schema
6565
assert.Equal(t, `{"properties":{"password":{"type":"string"},"username":{"type":"string"}},"required":["password","username"],"title":"work with consumer object","type":"object"}`, basicAuthConsumerSchema)
6666
}

web/cypress/fixtures/plugin-dataset.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@
596596
"data": { "count": 2, "time_window": 60, "rejected_code": 503, "key": "remote_addr" }
597597
},
598598
{
599-
"shouldValid": false,
599+
"shouldValid": true,
600600
"data": {
601601
"count": 2,
602602
"time_window": 60,

web/cypress/integration/consumer/create-upstream-with-limit-req-form.spec.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ context('Create and Delete Consumer', () => {
3030
burst: '#burst',
3131
key: '#key',
3232
nodelay: '#nodelay',
33-
remote_addr: '[title=remote_addr]',
3433
monacoViewZones: '.view-zones',
3534
};
3635

@@ -40,6 +39,7 @@ context('Create and Delete Consumer', () => {
4039
createConsumerSuccess: 'Create Consumer Successfully',
4140
deleteConsumerSuccess: 'Delete Consumer Successfully',
4241
time: 2,
42+
key: 'remote_addr',
4343
};
4444

4545
beforeEach(() => {
@@ -87,8 +87,7 @@ context('Create and Delete Consumer', () => {
8787

8888
cy.get(selector.rate).type(data.time);
8989
cy.get(selector.burst).type(data.time);
90-
cy.get(selector.key).click();
91-
cy.get(selector.remote_addr).click();
90+
cy.get(selector.key).type(data.key);
9291
cy.get(selector.nodelay).click();
9392
cy.get(selector.drawer).within(() => {
9493
cy.contains('Submit').click({

web/cypress/integration/consumer/create-with-limit-conn-form.spec.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ context('Create and delete consumer with limit-conn plugin form', () => {
3333
only_use_default_delay: '#only_use_default_delay',
3434
key: '#key',
3535
rejected_code: '#rejected_code',
36-
title: '[title="remote_addr"]',
3736
monacoViewZones: '.view-zones',
3837
};
3938

@@ -91,11 +90,7 @@ context('Create and delete consumer with limit-conn plugin form', () => {
9190
cy.get(selector.burst).type(data.burst);
9291
cy.get(selector.default_conn_delay).type(data.default_conn_delay);
9392
cy.get(selector.only_use_default_delay).click();
94-
cy.get(selector.key).click();
95-
cy.get(selector.selectDropdown).should('be.visible');
96-
cy.get(selector.title).click({
97-
timeout: 5000,
98-
});
93+
cy.get(selector.key).type(data.key);
9994
cy.get(selector.disabledSwitcher).click();
10095
cy.get(selector.drawer).within(() => {
10196
cy.contains('Submit').click({

web/cypress/integration/consumer/create_and_delete_consumer.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ context('Create and Delete Consumer', () => {
6060
cy.contains('Next').click();
6161
cy.get(selector.notification).should(
6262
'contain',
63-
'Please enable at least one of the following authentication plugin: basic-auth, hmac-auth, jwt-auth, key-auth, wolf-rbac',
63+
'Please enable at least one of the following authentication plugin: basic-auth, hmac-auth, jwt-auth, key-auth, ldap-auth, wolf-rbac',
6464
);
6565
cy.get(selector.notificationCloseIcon).click().should('not.exist');
6666

web/cypress/integration/route/create-route-with-limit-req-form.spec.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ context('Create and delete route with limit-req form', () => {
3434
rate: '#rate',
3535
burst: '#burst',
3636
key: '#key',
37-
remote_addr: '[title=remote_addr]',
3837
};
3938

4039
const data = {
4140
deleteRouteSuccess: 'Delete Route Successfully',
4241
submitSuccess: 'Submit Successfully',
4342
port: '80',
4443
weight: 1,
44+
key: 'remote_addr',
4545
};
4646

4747
beforeEach(() => {
@@ -91,8 +91,7 @@ context('Create and delete route with limit-req form', () => {
9191
// config limit-req form
9292
cy.get(selector.rate).type(1);
9393
cy.get(selector.burst).type(0);
94-
cy.get(selector.key).click();
95-
cy.get(selector.remote_addr).click();
94+
cy.get(selector.key).type(data.key);
9695
cy.get(selector.drawer).within(() => {
9796
cy.contains('Submit').click({
9897
force: true,

web/cypress/integration/route/create-route-with-proxy-rewrite-plugin.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ context('create route with proxy-rewrite plugin', () => {
3535
uriRewriteReg: '#proxyRewrite_regex_uri_0',
3636
uriRewriteTemp: '#proxyRewrite_regex_uri_1',
3737
newHost: '#proxyRewrite_host',
38+
methodRewriteSelect: '[data-cy=proxyRewrite-method]',
39+
methodRewriteSelectOption: '.ant-select-item-option',
3840
buttonCreateNewRewriteHeader: '[data-cy=create-new-rewrite-header]',
3941
rewriteHeaderKey1: '#proxyRewrite_kvHeaders_0_key',
4042
rewriteHeaderValue1: '#proxyRewrite_kvHeaders_0_value',
@@ -93,6 +95,10 @@ context('create route with proxy-rewrite plugin', () => {
9395
cy.get(selector.keepHost).click();
9496
cy.get(selector.newHost).should('not.exist');
9597

98+
// method rewrite
99+
cy.get(selector.methodRewriteSelect).click();
100+
cy.get(selector.methodRewriteSelectOption).contains('POST').click();
101+
96102
// new header key value input after createNewRewriteHeader button clicked
97103
cy.get(selector.buttonCreateNewRewriteHeader).click();
98104
cy.get(selector.rewriteHeaderKey1).should('be.visible').type(data.rewriteHeaderKey1);
@@ -130,6 +136,8 @@ context('create route with proxy-rewrite plugin', () => {
130136

131137
cy.get(selector.newHost).should('not.exist');
132138

139+
cy.get(selector.methodRewriteSelect).contains('POST').should('exist');
140+
133141
cy.get(selector.rewriteHeaderKey1).should('have.value', data.rewriteHeaderKey1);
134142
cy.get(selector.rewriteHeaderValue1).should('have.value', data.rewriteHeaderValue1);
135143
cy.get(selector.rewriteHeaderKey2).should('have.value', data.rewriteHeaderKey2);

web/src/components/Plugin/UI/limit-conn.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ const LimitConn: React.FC<Props> = ({ form, schema }) => {
8383
<Switch defaultChecked={onlyUseDefaultDelay} />
8484
</Form.Item>
8585
<Form.Item
86-
label="key"
87-
required
88-
name="key"
89-
tooltip={formatMessage({ id: 'component.pluginForm.limit-conn.key.tooltip' })}
86+
label="key_type"
87+
name="key_type"
88+
tooltip={formatMessage({ id: 'component.pluginForm.limit-conn.key_type.tooltip' })}
89+
initialValue={properties.key_type.default}
9090
>
9191
<Select>
92-
{properties.key.enum.map((item: string) => {
92+
{properties.key_type.enum.map((item: string) => {
9393
return (
9494
<Select.Option value={item} key={item}>
9595
{item}
@@ -98,6 +98,14 @@ const LimitConn: React.FC<Props> = ({ form, schema }) => {
9898
})}
9999
</Select>
100100
</Form.Item>
101+
<Form.Item
102+
label="key"
103+
name="key"
104+
required
105+
tooltip={formatMessage({ id: 'component.pluginForm.limit-conn.key.tooltip' })}
106+
>
107+
<Input min={1} />
108+
</Form.Item>
101109
<Form.Item
102110
label="rejected_code"
103111
name="rejected_code"

0 commit comments

Comments
 (0)