diff --git a/http-ballerina-tests/tests/auth_client_auth_handler_test.bal b/http-ballerina-tests/tests/auth_client_auth_handler_test.bal index ffcb143421..504df8ee51 100644 --- a/http-ballerina-tests/tests/auth_client_auth_handler_test.bal +++ b/http-ballerina-tests/tests/auth_client_auth_handler_test.bal @@ -134,7 +134,7 @@ isolated function testClientSelfSignedJwtAuthHandler() { @test:Config {} isolated function testClientOAuth2Handler() { http:OAuth2ClientCredentialsGrantConfig config1 = { - tokenUrl: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/token", + tokenUrl: "https://localhost:" + stsPort.toString() + "/oauth2/token", clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L5w4gz52uriT8ksZ3nUVjKvrfQMrU4uvZohTftxStwNEW4cfStBEGRxRL68", clientSecret: "9205371918321623741", scopes: ["token-scope1", "token-scope2"], @@ -149,7 +149,7 @@ isolated function testClientOAuth2Handler() { }; http:OAuth2PasswordGrantConfig config2 = { - tokenUrl: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/token", + tokenUrl: "https://localhost:" + stsPort.toString() + "/oauth2/token", username: "johndoe", password: "A3ddj3w", clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L5w4gz52uriT8ksZ3nUVjKvrfQMrU4uvZohTftxStwNEW4cfStBEGRxRL68", @@ -166,7 +166,7 @@ isolated function testClientOAuth2Handler() { }; http:OAuth2RefreshTokenGrantConfig config3 = { - refreshUrl: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/token", + refreshUrl: "https://localhost:" + stsPort.toString() + "/oauth2/token", refreshToken: "XlfBs91yquexJqDaKEMzVg==", clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L5w4gz52uriT8ksZ3nUVjKvrfQMrU4uvZohTftxStwNEW4cfStBEGRxRL68", clientSecret: "9205371918321623741", diff --git a/http-ballerina-tests/tests/auth_listener_auth_handler_test.bal b/http-ballerina-tests/tests/auth_listener_auth_handler_test.bal index 34865b7c1c..edb1d3d914 100644 --- a/http-ballerina-tests/tests/auth_listener_auth_handler_test.bal +++ b/http-ballerina-tests/tests/auth_listener_auth_handler_test.bal @@ -277,7 +277,7 @@ isolated function testListenerJwtAuthHandlerAuthnFailure() { @test:Config {} function testListenerOAuth2HandlerAuthSuccess() { http:OAuth2IntrospectionConfig config = { - url: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/introspect", + url: "https://localhost:" + stsPort.toString() + "/oauth2/introspect", tokenTypeHint: "access_token", scopeKey: "scp", clientConfig: { @@ -311,7 +311,7 @@ function testListenerOAuth2HandlerAuthSuccess() { @test:Config {} function testListenerOAuth2HandlerAuthzFailure() { http:OAuth2IntrospectionConfig config = { - url: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/introspect", + url: "https://localhost:" + stsPort.toString() + "/oauth2/introspect", tokenTypeHint: "access_token", scopeKey: "scp", clientConfig: { @@ -336,7 +336,7 @@ function testListenerOAuth2HandlerAuthzFailure() { @test:Config {} function testListenerOAuth2HandlerAuthnFailure() { http:OAuth2IntrospectionConfig config = { - url: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/introspect", + url: "https://localhost:" + stsPort.toString() + "/oauth2/introspect", tokenTypeHint: "access_token", scopeKey: "scp", clientConfig: { diff --git a/http-ballerina-tests/tests/auth_listener_declarative_design_test.bal b/http-ballerina-tests/tests/auth_listener_declarative_design_test.bal index b1bdd781ba..8fde62b966 100644 --- a/http-ballerina-tests/tests/auth_listener_declarative_design_test.bal +++ b/http-ballerina-tests/tests/auth_listener_declarative_design_test.bal @@ -19,14 +19,14 @@ import ballerina/http; import ballerina/test; -listener http:Listener authListener = new(securedListenerPort, - secureSocket = { +listener http:Listener authListener = new(securedListenerPort, { + secureSocket: { key: { path: KEYSTORE_PATH, password: "ballerina" } } -); +}); // Unsecured service - Unsecured resource with different combination of resource signature parameters @@ -156,7 +156,7 @@ function testJwtAuthServiceAuthnFailure() { auth: [ { oauth2IntrospectionConfig: { - url: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/introspect", + url: "https://localhost:" + stsPort.toString() + "/oauth2/introspect", tokenTypeHint: "access_token", scopeKey: "scp", clientConfig: { @@ -240,7 +240,7 @@ service /foo on authListener { auth: [ { oauth2IntrospectionConfig: { - url: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/introspect", + url: "https://localhost:" + stsPort.toString() + "/oauth2/introspect", tokenTypeHint: "access_token", scopeKey: "scp", clientConfig: { @@ -318,7 +318,7 @@ function testOAuth2ResourceAuthnFailure() { auth: [ { oauth2IntrospectionConfig: { - url: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/introspect", + url: "https://localhost:" + stsPort.toString() + "/oauth2/introspect", tokenTypeHint: "access_token", scopeKey: "scp", clientConfig: { @@ -386,7 +386,7 @@ function testServiceResourceAuthnFailure() { auth: [ { oauth2IntrospectionConfig: { - url: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/introspect", + url: "https://localhost:" + stsPort.toString() + "/oauth2/introspect", tokenTypeHint: "access_token", scopeKey: "scp", clientConfig: { @@ -455,7 +455,7 @@ service /bar on authListener { auth: [ { oauth2IntrospectionConfig: { - url: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/introspect", + url: "https://localhost:" + stsPort.toString() + "/oauth2/introspect", tokenTypeHint: "access_token", scopeKey: "scp", clientConfig: { diff --git a/http-ballerina-tests/tests/auth_test_commons.bal b/http-ballerina-tests/tests/auth_test_commons.bal index 9ec34bb1a2..c61067aef2 100644 --- a/http-ballerina-tests/tests/auth_test_commons.bal +++ b/http-ballerina-tests/tests/auth_test_commons.bal @@ -175,7 +175,7 @@ isolated function sendJwtRequest(string path) returns http:Response|http:ClientE isolated function sendOAuth2TokenRequest(string path) returns http:Response|http:ClientError { http:Client clientEP = checkpanic new("https://localhost:" + securedListenerPort.toString(), { auth: { - tokenUrl: "https://localhost:" + oauth2StsPort.toString() + "/oauth2/token", + tokenUrl: "https://localhost:" + stsPort.toString() + "/oauth2/token", clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L5w4gz52uriT8ksZ3nUVjKvrfQMrU4uvZohTftxStwNEW4cfStBEGRxRL68", clientSecret: "9205371918321623741", clientConfig: { @@ -222,7 +222,7 @@ isolated function assertUnauthorized(http:Response|http:ClientError response) { } // The mock authorization server, based with https://hub.docker.com/repository/docker/ldclakmal/ballerina-sts -listener http:Listener sts = new(oauth2StsPort, { +listener http:Listener sts = new(stsPort, { secureSocket: { key: { path: KEYSTORE_PATH, diff --git a/http-ballerina-tests/tests/http2_mutual_ssl_test.bal b/http-ballerina-tests/tests/http2_mutual_ssl_test.bal index f4b0079f9b..7cb1d052b0 100644 --- a/http-ballerina-tests/tests/http2_mutual_ssl_test.bal +++ b/http-ballerina-tests/tests/http2_mutual_ssl_test.bal @@ -77,7 +77,7 @@ service /http2Service on http2Listener { } http:ClientConfiguration http2MutualSslClientConf = { - secureSocket:{ + secureSocket: { key:{ path: "tests/certsandkeys/ballerinaKeystore.p12", password: "ballerina" diff --git a/http-ballerina-tests/tests/http2_mutual_ssl_with_certs_test.bal b/http-ballerina-tests/tests/http2_mutual_ssl_with_certs_test.bal index e3d801135b..2e66ae2d95 100644 --- a/http-ballerina-tests/tests/http2_mutual_ssl_with_certs_test.bal +++ b/http-ballerina-tests/tests/http2_mutual_ssl_with_certs_test.bal @@ -68,7 +68,7 @@ service /mutualSslService on mutualSslistener { } http:ClientConfiguration certsClientConf = { - secureSocket:{ + secureSocket: { cert: "tests/certsandkeys/public.crt", key: { keyFile: "tests/certsandkeys/private.key", diff --git a/http-ballerina-tests/tests/listener_init_test.bal b/http-ballerina-tests/tests/listener_init_test.bal index a38c2a059c..b1fcfa7eff 100644 --- a/http-ballerina-tests/tests/listener_init_test.bal +++ b/http-ballerina-tests/tests/listener_init_test.bal @@ -88,17 +88,17 @@ public function testEmptyKeyFile() { @test:Config {} public function testEmptyTrusStoreFile() { http:Listener|http:Error testListener = new(9249, { - secureSocket: { - key: { - certFile: "tests/certsandkeys/public.crt", - keyFile: "tests/certsandkeys/private.key" - }, - mutualSsl: { - verifyClient: http:REQUIRE, - cert: "" - } - } - }); + secureSocket: { + key: { + certFile: "tests/certsandkeys/public.crt", + keyFile: "tests/certsandkeys/private.key" + }, + mutualSsl: { + verifyClient: http:REQUIRE, + cert: "" + } + } + }); if (testListener is http:Listener) { test:assertFail(msg = "Found unexpected output: Expected an empty cert file error" ); } else { @@ -109,20 +109,20 @@ public function testEmptyTrusStoreFile() { @test:Config {} public function testEmptyTrusStorePassword() { http:Listener|http:Error testListener = new(9249, { - secureSocket: { - key: { - certFile: "tests/certsandkeys/public.crt", - keyFile: "tests/certsandkeys/private.key" - }, - mutualSsl: { - verifyClient: http:REQUIRE, - cert: { - path: "tests/certsandkeys/ballerinaTruststore.p12", - password: "" - } - } - } - }); + secureSocket: { + key: { + certFile: "tests/certsandkeys/public.crt", + keyFile: "tests/certsandkeys/private.key" + }, + mutualSsl: { + verifyClient: http:REQUIRE, + cert: { + path: "tests/certsandkeys/ballerinaTruststore.p12", + password: "" + } + } + } + }); if (testListener is http:Listener) { test:assertFail(msg = "Found unexpected output: Expected an empty password error" ); } else { @@ -133,21 +133,21 @@ public function testEmptyTrusStorePassword() { @test:Config {} public function testEmptyTrustStore() { http:Listener|http:Error testListener = new(9249, { - host: "", - secureSocket: { - key: { - certFile: "tests/certsandkeys/public.crt", - keyFile: "tests/certsandkeys/private.key" - }, - mutualSsl: { - verifyClient: http:REQUIRE, - cert: { - path: "", - password: "ballerina" - } - } - } - }); + host: "", + secureSocket: { + key: { + certFile: "tests/certsandkeys/public.crt", + keyFile: "tests/certsandkeys/private.key" + }, + mutualSsl: { + verifyClient: http:REQUIRE, + cert: { + path: "", + password: "ballerina" + } + } + } + }); if (testListener is http:Listener) { test:assertFail(msg = "Found unexpected output: Expected an empty truststore error" ); } else { diff --git a/http-ballerina-tests/tests/ssl_mutual_ssl_with_certs.bal b/http-ballerina-tests/tests/ssl_mutual_ssl_with_certs.bal index b7605031df..ec2ad72c24 100644 --- a/http-ballerina-tests/tests/ssl_mutual_ssl_with_certs.bal +++ b/http-ballerina-tests/tests/ssl_mutual_ssl_with_certs.bal @@ -67,7 +67,7 @@ service /mutualSSLService on mutualSSLListener { } http:ClientConfiguration mutualSslCertClientConf = { - secureSocket:{ + secureSocket: { cert: "tests/certsandkeys/public.crt", key: { keyFile: "tests/certsandkeys/private.key", diff --git a/http-ballerina-tests/tests/test_service_ports.bal b/http-ballerina-tests/tests/test_service_ports.bal index a96dc52f8d..aa306171ed 100644 --- a/http-ballerina-tests/tests/test_service_ports.bal +++ b/http-ballerina-tests/tests/test_service_ports.bal @@ -121,5 +121,5 @@ const int http2RetryFunctionTestPort1 = 9606; const int http2RetryFunctionTestPort2 = 9607; //Security -const int oauth2StsPort = 9401; -const int securedListenerPort = 9402; +const int securedListenerPort = 9400; +const int stsPort = 9445;