-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add visibility restrictions (for Publisher visibility) * Introduced backward compatibility (for Subscriber visibility) * Review comments fixed --------- Co-authored-by: gustaaf jongbloed <[email protected]>
- Loading branch information
Showing
10 changed files
with
478 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/__tests__/e2e/invalid-publisher-visibility-invalid-roles/serverless.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
service: serverless-wso2-apim | ||
provider: | ||
name: aws | ||
stackName: ${env:STACK_NAME} | ||
deploymentBucket: | ||
name: ${env:TEST_ID_NORMALIZED} | ||
plugins: | ||
- serverless-localstack | ||
- serverless-deployment-bucket | ||
- "../../../../src" | ||
|
||
#⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ Modify the configuration below to suit your test case. | ||
#⬇⬇⬇ START HERE ⬇⬇⬇⬇ Help: https://github.com/ramgrandhi/serverless-wso2-apim#configuration-reference | ||
#⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ For a full list of env vars that you can use, refer `src/__tests__/e2e/e2e.test.js` | ||
custom: | ||
wso2apim: | ||
enabled: true | ||
host: ${env:WSO2_HOST} | ||
port: ${env:WSO2_PORT} | ||
user: ${env:WSO2_USER} | ||
pass: ${env:WSO2_PASS} | ||
gatewayEnv: ${env:WSO2_ENV} | ||
apidefs: | ||
- name: ${env:TEST_ID}-1 | ||
description: ${env:TEST_ID}-1 | ||
rootContext: /${env:TEST_ID}-1 | ||
version: "1" | ||
subscriberVisibility: "RESTRICTED" | ||
subscriberVisibilityRoles: | ||
- "admin" | ||
publisherVisibility: "RESTRICTED" | ||
publisherVisibilityRoles: "admin" | ||
backend: | ||
http: | ||
baseUrl: "https://baseUrl" | ||
maxTps: 10 | ||
tags: | ||
- ${env:TEST_ID}-1 | ||
swaggerSpec: | ||
swagger: "2.0" | ||
pathsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: | ||
/*: | ||
post: | ||
responses: | ||
"201": | ||
description: Created | ||
x-auth-type: "None" | ||
|
||
# Optionally, add your other AWS provider-specific resources below. | ||
# Make sure there is at least one resource listed below, otherwise stack deployment would fail. | ||
resources: | ||
Resources: | ||
Topic: | ||
Type: AWS::SNS::Topic |
51 changes: 51 additions & 0 deletions
51
src/__tests__/e2e/invalid-publisher-visibility-missing-roles/serverless.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
service: serverless-wso2-apim | ||
provider: | ||
name: aws | ||
stackName: ${env:STACK_NAME} | ||
deploymentBucket: | ||
name: ${env:TEST_ID_NORMALIZED} | ||
plugins: | ||
- serverless-localstack | ||
- serverless-deployment-bucket | ||
- "../../../../src" | ||
|
||
#⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ Modify the configuration below to suit your test case. | ||
#⬇⬇⬇ START HERE ⬇⬇⬇⬇ Help: https://github.com/ramgrandhi/serverless-wso2-apim#configuration-reference | ||
#⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ For a full list of env vars that you can use, refer `src/__tests__/e2e/e2e.test.js` | ||
custom: | ||
wso2apim: | ||
enabled: true | ||
host: ${env:WSO2_HOST} | ||
port: ${env:WSO2_PORT} | ||
user: ${env:WSO2_USER} | ||
pass: ${env:WSO2_PASS} | ||
gatewayEnv: ${env:WSO2_ENV} | ||
apidefs: | ||
- name: ${env:TEST_ID}-1 | ||
description: ${env:TEST_ID}-1 | ||
rootContext: /${env:TEST_ID}-1 | ||
version: "1" | ||
subscriberVisibility: "PRIVATE" | ||
publisherVisibility: "RESTRICTED" | ||
backend: | ||
http: | ||
baseUrl: "https://baseUrl" | ||
maxTps: 10 | ||
tags: | ||
- ${env:TEST_ID}-1 | ||
swaggerSpec: | ||
swagger: "2.0" | ||
pathsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: | ||
/*: | ||
post: | ||
responses: | ||
"201": | ||
description: Created | ||
x-auth-type: "None" | ||
|
||
# Optionally, add your other AWS provider-specific resources below. | ||
# Make sure there is at least one resource listed below, otherwise stack deployment would fail. | ||
resources: | ||
Resources: | ||
Topic: | ||
Type: AWS::SNS::Topic |
53 changes: 53 additions & 0 deletions
53
src/__tests__/e2e/invalid-subscriber-visibility-invalid-roles/serverless.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
service: serverless-wso2-apim | ||
provider: | ||
name: aws | ||
stackName: ${env:STACK_NAME} | ||
deploymentBucket: | ||
name: ${env:TEST_ID_NORMALIZED} | ||
plugins: | ||
- serverless-localstack | ||
- serverless-deployment-bucket | ||
- "../../../../src" | ||
|
||
#⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ Modify the configuration below to suit your test case. | ||
#⬇⬇⬇ START HERE ⬇⬇⬇⬇ Help: https://github.com/ramgrandhi/serverless-wso2-apim#configuration-reference | ||
#⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ For a full list of env vars that you can use, refer `src/__tests__/e2e/e2e.test.js` | ||
custom: | ||
wso2apim: | ||
enabled: true | ||
host: ${env:WSO2_HOST} | ||
port: ${env:WSO2_PORT} | ||
user: ${env:WSO2_USER} | ||
pass: ${env:WSO2_PASS} | ||
gatewayEnv: ${env:WSO2_ENV} | ||
apidefs: | ||
- name: ${env:TEST_ID}-1 | ||
description: ${env:TEST_ID}-1 | ||
rootContext: /${env:TEST_ID}-1 | ||
version: "1" | ||
subscriberVisibility: "RESTRICTED" | ||
subscriberVisibilityRoles: | ||
- "admin" | ||
- "non-existing-role" | ||
backend: | ||
http: | ||
baseUrl: "https://baseUrl" | ||
maxTps: 10 | ||
tags: | ||
- ${env:TEST_ID}-1 | ||
swaggerSpec: | ||
swagger: "2.0" | ||
pathsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: | ||
/*: | ||
post: | ||
responses: | ||
"201": | ||
description: Created | ||
x-auth-type: "None" | ||
|
||
# Optionally, add your other AWS provider-specific resources below. | ||
# Make sure there is at least one resource listed below, otherwise stack deployment would fail. | ||
resources: | ||
Resources: | ||
Topic: | ||
Type: AWS::SNS::Topic |
50 changes: 50 additions & 0 deletions
50
src/__tests__/e2e/invalid-subscriber-visibility-missing-roles/serverless.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
service: serverless-wso2-apim | ||
provider: | ||
name: aws | ||
stackName: ${env:STACK_NAME} | ||
deploymentBucket: | ||
name: ${env:TEST_ID_NORMALIZED} | ||
plugins: | ||
- serverless-localstack | ||
- serverless-deployment-bucket | ||
- "../../../../src" | ||
|
||
#⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ Modify the configuration below to suit your test case. | ||
#⬇⬇⬇ START HERE ⬇⬇⬇⬇ Help: https://github.com/ramgrandhi/serverless-wso2-apim#configuration-reference | ||
#⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ For a full list of env vars that you can use, refer `src/__tests__/e2e/e2e.test.js` | ||
custom: | ||
wso2apim: | ||
enabled: true | ||
host: ${env:WSO2_HOST} | ||
port: ${env:WSO2_PORT} | ||
user: ${env:WSO2_USER} | ||
pass: ${env:WSO2_PASS} | ||
gatewayEnv: ${env:WSO2_ENV} | ||
apidefs: | ||
- name: ${env:TEST_ID}-1 | ||
description: ${env:TEST_ID}-1 | ||
rootContext: /${env:TEST_ID}-1 | ||
version: "1" | ||
subscriberVisibility: "RESTRICTED" | ||
backend: | ||
http: | ||
baseUrl: "https://baseUrl" | ||
maxTps: 10 | ||
tags: | ||
- ${env:TEST_ID}-1 | ||
swaggerSpec: | ||
swagger: "2.0" | ||
pathsxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: | ||
/*: | ||
post: | ||
responses: | ||
"201": | ||
description: Created | ||
x-auth-type: "None" | ||
|
||
# Optionally, add your other AWS provider-specific resources below. | ||
# Make sure there is at least one resource listed below, otherwise stack deployment would fail. | ||
resources: | ||
Resources: | ||
Topic: | ||
Type: AWS::SNS::Topic |
120 changes: 120 additions & 0 deletions
120
src/__tests__/e2e/valid-visibility-restricted/serverless.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
service: serverless-wso2-apim | ||
provider: | ||
name: aws | ||
stackName: ${env:STACK_NAME} | ||
deploymentBucket: | ||
name: ${env:TEST_ID_NORMALIZED} | ||
plugins: | ||
- serverless-localstack | ||
- serverless-deployment-bucket | ||
- "../../../../src" | ||
|
||
#⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ Modify the configuration below to suit your test case. | ||
#⬇⬇⬇ START HERE ⬇⬇⬇⬇ Help: https://github.com/ramgrandhi/serverless-wso2-apim#configuration-reference | ||
#⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇⬇ For a full list of env vars that you can use, refer `src/__tests__/e2e/e2e.test.js` | ||
custom: | ||
wso2apim: | ||
enabled: true | ||
host: ${env:WSO2_HOST} | ||
port: ${env:WSO2_PORT} | ||
user: ${env:WSO2_USER} | ||
pass: ${env:WSO2_PASS} | ||
gatewayEnv: ${env:WSO2_ENV} | ||
apidefs: | ||
- name: ${env:TEST_ID}-1 | ||
description: ${env:TEST_ID}-1 | ||
rootContext: /${env:TEST_ID}-1 | ||
version: "v1" | ||
subscriberVisibility: "RESTRICTED" | ||
subscriberVisibilityRoles: | ||
- "admin" | ||
backend: | ||
http: | ||
baseUrl: "https://baseUrl" | ||
maxTps: 10 | ||
tags: | ||
- ${env:TEST_ID}-1 | ||
swaggerSpec: | ||
swagger: "2.0" | ||
info: | ||
title: ${env:TEST_ID}-1 | ||
version: "v1" | ||
contact: | ||
name: ${env:TEST_ID}-1 | ||
email: ${env:TEST_ID}-1 | ||
paths: | ||
/*: | ||
post: | ||
responses: | ||
"201": | ||
description: Created | ||
x-auth-type: "None" | ||
- name: ${env:TEST_ID}-2 | ||
description: ${env:TEST_ID}-2 | ||
rootContext: /${env:TEST_ID}-2 | ||
version: "1" | ||
subscriberVisibility: "RESTRICTED" | ||
subscriberVisibilityRoles: | ||
- "admin" | ||
- "Internal/subscriber" | ||
publisherVisibility: "RESTRICTED" | ||
publisherVisibilityRoles: | ||
- "admin" | ||
backend: | ||
http: | ||
baseUrl: "https://baseUrl" | ||
maxTps: 10 | ||
tags: | ||
- ${env:TEST_ID}-2 | ||
swaggerSpec: | ||
openapi: 3.0.0 | ||
info: | ||
title: ${env:TEST_ID}-2 | ||
version: "1" | ||
contact: | ||
name: ${env:TEST_ID}-2 | ||
email: ${env:TEST_ID}-2 | ||
paths: | ||
/*: | ||
post: | ||
responses: | ||
"201": | ||
description: Created | ||
x-auth-type: "None" | ||
- name: ${env:TEST_ID}-3 | ||
description: ${env:TEST_ID}-3 | ||
rootContext: /${env:TEST_ID}-3 | ||
version: "1" | ||
visibility: "PRIVATE" | ||
publisherVisibility: "RESTRICTED" | ||
publisherVisibilityRoles: | ||
- "admin" | ||
- "Internal/publisher" | ||
backend: | ||
http: | ||
baseUrl: "https://baseUrl" | ||
maxTps: 10 | ||
tags: | ||
- ${env:TEST_ID}-3 | ||
swaggerSpec: | ||
openapi: 3.0.0 | ||
info: | ||
title: ${env:TEST_ID}-3 | ||
version: "1" | ||
contact: | ||
name: ${env:TEST_ID}-3 | ||
email: ${env:TEST_ID}-3 | ||
paths: | ||
/*: | ||
post: | ||
responses: | ||
"201": | ||
description: Created | ||
x-auth-type: "None" | ||
|
||
# Optionally, add your other AWS provider-specific resources below. | ||
# Make sure there is at least one resource listed below, otherwise stack deployment would fail. | ||
resources: | ||
Resources: | ||
Topic: | ||
Type: AWS::SNS::Topic |
Oops, something went wrong.