-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1042 from bcgov/dev
release - two-tiered-hidden for API Directory
- Loading branch information
Showing
13 changed files
with
460 additions
and
27 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
kind: Namespace | ||
name: two-tier-hidden | ||
displayName: two-tier-hidden Display Name | ||
--- | ||
kind: GatewayService | ||
name: two-tier-service-dev | ||
tags: [ns.two-tier-hidden] | ||
host: httpbin.org | ||
port: 443 | ||
protocol: https | ||
retries: 0 | ||
routes: | ||
- name: two-tier-service-dev | ||
tags: [ns.two-tier-hidden] | ||
hosts: | ||
- two-tier-service.dev.api.gov.bc.ca | ||
methods: | ||
- GET | ||
strip_path: false | ||
https_redirect_status_code: 426 | ||
path_handling: v0 | ||
request_buffering: true | ||
response_buffering: true | ||
plugins: | ||
- name: jwt-keycloak | ||
tags: [ns.two-tier-hidden, aps.two-tiered-hidden] | ||
enabled: true | ||
config: | ||
allowed_iss: | ||
- https://dev.loginproxy.gov.bc.ca/auth/realms/apigw | ||
allowed_aud: ap-two-tier-hidden-default-dev | ||
run_on_preflight: true | ||
iss_key_grace_period: 10 | ||
maximum_expiration: 0 | ||
algorithm: RS256 | ||
claims_to_verify: | ||
- exp | ||
uri_param_names: | ||
- jwt | ||
cookie_names: [] | ||
scope: null | ||
roles: null | ||
realm_roles: null | ||
client_roles: null | ||
anonymous: ce26955a-cf08-4907-9427-12d01c8bd94c | ||
consumer_match: true | ||
consumer_match_claim: azp | ||
consumer_match_claim_custom_id: true | ||
consumer_match_ignore_not_found: false | ||
- name: request-transformer | ||
tags: [ns.two-tier-hidden] | ||
enabled: true | ||
config: | ||
http_method: null | ||
--- | ||
kind: DraftDataset | ||
name: two-tier-service-dataset | ||
title: Two-tier-service | ||
organization: ministry-of-health | ||
organizationUnit: public-health | ||
notes: Some information about the two-tier-service service | ||
tags: [two-tier-service, openapi] | ||
license_title: Access Only | ||
view_audience: Government | ||
security_class: LOW-PUBLIC | ||
record_publish_date: '2021-05-27' | ||
--- | ||
kind: Product | ||
name: Two Tiered Hidden Product | ||
appId: 'LFH78YU956RE' | ||
dataset: two-tier-service-dataset | ||
environments: | ||
- name: dev | ||
active: true | ||
approval: false | ||
flow: kong-api-key-acl | ||
appId: '506CB7CF' | ||
services: [two-tier-service-dev] | ||
|
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,62 @@ | ||
kind: Namespace | ||
name: two-tier-hidden | ||
displayName: two-tier-hidden Display Name | ||
--- | ||
kind: GatewayService | ||
name: two-tier-service-dev | ||
tags: [ns.two-tier-hidden] | ||
host: httpbin.org | ||
port: 443 | ||
protocol: https | ||
retries: 0 | ||
routes: | ||
- name: two-tier-service-dev | ||
tags: [ns.two-tier-hidden] | ||
hosts: | ||
- two-tier-service.dev.api.gov.bc.ca | ||
methods: | ||
- GET | ||
strip_path: false | ||
https_redirect_status_code: 426 | ||
path_handling: v0 | ||
request_buffering: true | ||
response_buffering: true | ||
plugins: | ||
- name: key-auth | ||
tags: [ ns.two-tier-hidden, aps.two-tiered-hidden ] | ||
protocols: [ http, https ] | ||
config: | ||
key_names: ["X-API-KEY"] | ||
run_on_preflight: true | ||
hide_credentials: true | ||
key_in_body: false | ||
anonymous: ce26955a-cf08-4907-9427-12d01c8bd94c | ||
- name: acl | ||
tags: [ ns.two-tier-hidden ] | ||
config: | ||
hide_groups_header: true | ||
allow: [ "406CB7CF" ] | ||
--- | ||
kind: DraftDataset | ||
name: two-tier-service-dataset | ||
title: Two-tier-service | ||
organization: ministry-of-health | ||
organizationUnit: public-health | ||
notes: Some information about the two-tier-service service | ||
tags: [two-tier-service, openapi] | ||
license_title: Access Only | ||
view_audience: Government | ||
security_class: LOW-PUBLIC | ||
record_publish_date: '2021-05-27' | ||
--- | ||
kind: Product | ||
name: Two Tiered Hidden Product | ||
appId: 'LFH78YU956RE' | ||
dataset: two-tier-service-dataset | ||
environments: | ||
- name: dev | ||
active: true | ||
approval: false | ||
flow: kong-api-key-acl | ||
appId: '506CB7CF' | ||
services: [two-tier-service-dev] |
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
134 changes: 134 additions & 0 deletions
134
e2e/cypress/tests/09-update-product-env/09-two-tiered-hidden.cy.ts
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,134 @@ | ||
import ApiDirectoryPage from '../../pageObjects/apiDirectory' | ||
import HomePage from '../../pageObjects/home' | ||
import LoginPage from '../../pageObjects/login' | ||
import Products from '../../pageObjects/products' | ||
|
||
describe('Verify Two Tiered Hidden', () => { | ||
const login = new LoginPage() | ||
const apiDir = new ApiDirectoryPage() | ||
var nameSpace: string | ||
let userSession: any | ||
const home = new HomePage() | ||
const pd = new Products() | ||
|
||
before(() => { | ||
cy.visit('/') | ||
cy.deleteAllCookies() | ||
cy.reload() | ||
}) | ||
|
||
beforeEach(() => { | ||
cy.preserveCookies() | ||
cy.fixture('apiowner').as('apiowner') | ||
cy.fixture('common-testdata').as('common-testdata') | ||
cy.visit(login.path) | ||
}) | ||
|
||
it('authenticates Janis (api owner) to get the user session token', () => { | ||
cy.get('@common-testdata').then(({ twoTieredHidden }: any) => { | ||
cy.getUserSessionTokenValue(twoTieredHidden.namespace, false).then((value) => { | ||
userSession = value | ||
}) | ||
}) | ||
}) | ||
|
||
it('Check gwa config command to set environment', () => { | ||
var cleanedUrl = Cypress.env('BASE_URL').replace(/^http?:\/\//i, '') | ||
cy.executeCliCommand('gwa config set --host ' + cleanedUrl + ' --scheme http').then( | ||
(response) => { | ||
expect(response.stdout).to.contain('Config settings saved') | ||
} | ||
) | ||
}) | ||
|
||
it('Check gwa config command to set token', () => { | ||
cy.executeCliCommand('gwa config set --token ' + userSession).then((response) => { | ||
expect(response.stdout).to.contain('Config settings saved') | ||
}) | ||
}) | ||
|
||
it('create namespace with cli', () => { | ||
cy.get('@common-testdata').then(({ twoTieredHidden }: any) => { | ||
cy.executeCliCommand( | ||
'gwa namespace create --name ' + | ||
twoTieredHidden.namespace + | ||
' --description="Two Tiered Hidden"' | ||
).then((response) => { | ||
expect(response.stdout).to.contain(twoTieredHidden.namespace) | ||
}) | ||
}) | ||
}) | ||
|
||
it('Upload config for key-auth', () => { | ||
cy.executeCliCommand('gwa apply -i ./cypress/fixtures/tthidden-key-auth.yml').then((response) => { | ||
expect(response.stdout).to.contain('Gateway Services published'); | ||
}) | ||
}) | ||
|
||
it('Activates the namespace', () => { | ||
cy.getUserSession().then(() => { | ||
cy.get('@common-testdata').then(({ twoTieredHidden }: any) => { | ||
nameSpace = twoTieredHidden.namespace | ||
home.useNamespace(twoTieredHidden.namespace) | ||
cy.get('@login').then(function (xhr: any) { | ||
userSession = xhr.response.headers['x-auth-request-access-token'] | ||
}) | ||
}) | ||
}) | ||
}) | ||
|
||
it('Verify that product is formatted correctly in public directory', () => { | ||
cy.visit(apiDir.path) | ||
cy.get('@apiowner').then(({ twoTieredHidden }: any) => { | ||
let product = twoTieredHidden.product | ||
apiDir.selectProduct(product.serviceName) | ||
apiDir.checkProductIcon(product.name, 'RiEarthFill') | ||
apiDir.checkTwoTieredHiddenButton() | ||
}) | ||
}) | ||
|
||
it('Verify that product is formatted correctly in your products page', () => { | ||
cy.visit(apiDir.path) | ||
apiDir.navigateToYourProduct() | ||
cy.get('@apiowner').then(({ twoTieredHidden }: any) => { | ||
let product = twoTieredHidden.product | ||
apiDir.selectProduct(product.serviceName) | ||
apiDir.checkProductIcon(product.name, 'RiEarthFill') | ||
apiDir.checkTwoTieredHiddenButton() | ||
}) | ||
}) | ||
|
||
it('Upload config for jwt-keycloak', () => { | ||
cy.executeCliCommand('gwa apply -i ./cypress/fixtures/tthidden-jwt.yml').then((response) => { | ||
expect(response.stdout).to.contain('Gateway Services published'); | ||
}) | ||
}) | ||
|
||
it('Verify that product is formatted correctly in public directory', () => { | ||
cy.visit(apiDir.path) | ||
cy.get('@apiowner').then(({ twoTieredHidden }: any) => { | ||
let product = twoTieredHidden.product | ||
apiDir.selectProduct(product.serviceName) | ||
apiDir.checkProductIcon(product.name, 'RiEarthFill') | ||
apiDir.checkTwoTieredHiddenButton() | ||
}) | ||
}) | ||
|
||
it('Verify that product is formatted correctly in your products page', () => { | ||
cy.visit(apiDir.path) | ||
apiDir.navigateToYourProduct() | ||
cy.get('@apiowner').then(({ twoTieredHidden }: any) => { | ||
let product = twoTieredHidden.product | ||
apiDir.selectProduct(product.serviceName) | ||
apiDir.checkProductIcon(product.name, 'RiEarthFill') | ||
apiDir.checkTwoTieredHiddenButton() | ||
}) | ||
}) | ||
|
||
after(() => { | ||
cy.logout() | ||
cy.clearLocalStorage({ log: true }) | ||
cy.deleteAllCookies() | ||
}) | ||
|
||
}) |
Oops, something went wrong.