diff --git a/server/client/client.feature b/server/client/client.feature index 3e291ed0..9bbe9180 100644 --- a/server/client/client.feature +++ b/server/client/client.feature @@ -28,14 +28,14 @@ Feature: client module When I make a 'get' request to '/index.html' Then the file is returned as with the expected configuration included - Scenario Outline: If assets can be served without authentication, the client module returns the appropriate return code for a request of + Scenario Outline: With no authentication, the client module returns the appropriate return code for a request of Given a server with a 'client' configuration And There are files to serve And authentication type 'none' is required And I run an instance of the Strimzi-UI server When I make a 'get' request to '' Then I get the expected status code '' response - # if the route (not file) is not matched, we redirect to index.html. Hence / and someroute response + # if the route (not file) is not matched, we redirect to /. Hence /someroute response Examples: | Asset | StatusCode | | /index.html | 200 | @@ -45,14 +45,14 @@ Feature: client module | /protected.html | 200 | | / | 200 | - Scenario Outline: If assets can be served with authentication, the client module returns the appropriate return code for a request of + Scenario Outline: With scram authentication, the client module returns the appropriate return code for an unauthenticated request of Given a server with a 'client' configuration And There are files to serve And authentication type 'scram' is required And I run an instance of the Strimzi-UI server When I make a 'get' request to '' Then I get the expected status code '' response - # if the route (not file) is not matched, we redirect to index.html. Hence / and someroute response + # if the route is protected we redirect to login, and if the route isn't matched we redirect to / Examples: | Asset | StatusCode | | /index.html | 302 | @@ -63,18 +63,18 @@ Feature: client module | / | 302 | - Scenario Outline: If assets can be served with authentication, the client module returns the appropriate return code for a request of when I am logged in + Scenario Outline: With scram authentication, the client module returns the appropriate return code for an authenticated request of when I am logged in Given a server with a 'client' configuration And a 'security' module And There are files to serve And authentication type 'scram' is required - And a scram user is valid + And the scram authentication accepts credentials And I run an instance of the Strimzi-UI server And all requests use the same session When I send credentials to endpoint '/auth/login' - When I make a 'get' request to '' + And I make a 'get' request to '' Then I get the expected status code '' response - # if the route (not file) is not matched, we redirect to index.html. Hence / and someroute response + # if the route (not file) is not matched, we redirect to /. Hence /someroute response Examples: | Asset | StatusCode | | /index.html | 200 | diff --git a/server/security/security.feature b/server/security/security.feature index 389ff907..e68c98a4 100644 --- a/server/security/security.feature +++ b/server/security/security.feature @@ -5,18 +5,18 @@ Feature: Security module Scenario: SCRAM - authenticate valid credentials Given a server with a 'security' configuration - # And authentication type 'scram' is required - # And I run an instance of the Strimzi-UI server - # And a scram user is valid - # When I send credentials to endpoint '/auth/login' - # Then I get the expected status code '200' response + And authentication type 'scram' is required + And I run an instance of the Strimzi-UI server + And the scram authentication accepts credentials + When I send credentials to endpoint '/auth/login' + Then I get the expected status code '200' response Scenario: SCRAM - authenticate invalid credentials Given a server with a 'security' configuration And authentication type 'scram' is required And I run an instance of the Strimzi-UI server - And a scram user is invalid + And the scram authentication rejects credentials When I send credentials to endpoint '/auth/login' Then I get the expected status code '401' response @@ -33,7 +33,7 @@ Feature: Security module Given a server with a 'security' configuration And authentication type 'scram' is required And I run an instance of the Strimzi-UI server - And a scram user is valid + And the scram authentication accepts credentials When I make a 'post' request to '/auth/logout' Then I get the expected status code '200' response diff --git a/server/test_common/commonServerSteps.ts b/server/test_common/commonServerSteps.ts index ffe85246..40d228a1 100644 --- a/server/test_common/commonServerSteps.ts +++ b/server/test_common/commonServerSteps.ts @@ -154,7 +154,7 @@ And( }) ); -When( +const httpRequest: [RegExp, CallBack] = [ /^I make a '(.+)' request to '(.+)'$/, stepWhichUpdatesWorld(async (world, method, endpoint) => { const { server } = world; @@ -165,8 +165,11 @@ When( ...world, request: server[method as string](endpoint), }; - }) -); + }), +]; + +When.call(null, ...httpRequest); +And.call(null, ...httpRequest); When( /^I make a '(.+)' gql request to '(.+)'$/, @@ -277,14 +280,14 @@ Then( ); And( - 'a scram user is valid', + 'the scram authentication accepts credentials', stepWithWorld((world) => { const { hostname, contextRoot, port } = world.configuration.proxy; nock(`http://${hostname}:${port}`).post(contextRoot).reply(200, {}); }) ); And( - 'a scram user is invalid', + 'the scram authentication rejects credentials', stepWithWorld((world) => { const { hostname, contextRoot, port } = world.configuration.proxy; nock(`http://${hostname}:${port}`)