diff --git a/examples/secured-client-with-basic-auth/secured_client_with_basic_auth.bal b/examples/secured-client-with-basic-auth/secured_client_with_basic_auth.bal index 0a59b18a74c5..aeb4f8b1b266 100644 --- a/examples/secured-client-with-basic-auth/secured_client_with_basic_auth.bal +++ b/examples/secured-client-with-basic-auth/secured_client_with_basic_auth.bal @@ -8,7 +8,7 @@ import ballerina/log; http:Client httpEndpoint = new("https://localhost:9090", config = { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "tom", password: "1234" } diff --git a/examples/secured-client-with-jwt-auth/secured_client_with_jwt_auth.bal b/examples/secured-client-with-jwt-auth/secured_client_with_jwt_auth.bal index bfdb2143c183..4395edef8b21 100644 --- a/examples/secured-client-with-jwt-auth/secured_client_with_jwt_auth.bal +++ b/examples/secured-client-with-jwt-auth/secured_client_with_jwt_auth.bal @@ -40,7 +40,7 @@ public function main() { // Create a JWT authentication provider with the relevant configurations. http:AuthProvider jwtAuthProvider = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "ballerina", audience: ["ballerina.io"], certificateAlias: "ballerina", diff --git a/examples/secured-client-with-oauth2/secured_client_with_oauth2.bal b/examples/secured-client-with-oauth2/secured_client_with_oauth2.bal index 37002d9d4a46..3c1495c5b2d4 100644 --- a/examples/secured-client-with-oauth2/secured_client_with_oauth2.bal +++ b/examples/secured-client-with-oauth2/secured_client_with_oauth2.bal @@ -8,7 +8,7 @@ import ballerina/log; http:Client httpEndpoint = new("https://www.googleapis.com/tasks/v1", config = { auth: { scheme: http:OAUTH2, - oAuth2AuthConfig: { + config: { accessToken: "ya29.GlufBimE7JZdiB_FpFtZn7p1WMtloVeMlqiYXDGF97068VvJCyK8rEFqBBkxT10E0qudipwxTjJTkU4we0hbOcHKjNTXz6JTEZYoRVn7F3-0O_bL9g71Rwek7TFI", clientId: "833478926540-va43h2lhdhfc06i9eivlmaehl3o5uk1i.apps.googleusercontent.com", clientSecret: "4ZsV4gwSuIoRdy6TKUXTanlw", diff --git a/examples/secured-service-with-basic-auth/tests/secured_service_with_basic_auth_test.bal b/examples/secured-service-with-basic-auth/tests/secured_service_with_basic_auth_test.bal index a6ad2da6a9e3..22370939dabe 100644 --- a/examples/secured-service-with-basic-auth/tests/secured_service_with_basic_auth_test.bal +++ b/examples/secured-service-with-basic-auth/tests/secured_service_with_basic_auth_test.bal @@ -23,7 +23,7 @@ function testAuthSuccess() { http:Client httpEndpoint = new("https://localhost:9090", config = { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "tom", password: "password1" } @@ -44,7 +44,7 @@ function testAuthnFailure() { http:Client httpEndpoint = new("https://localhost:9090", config = { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "tom", password: "password" } @@ -65,7 +65,7 @@ function testAuthzFailure() { http:Client httpEndpoint = new("https://localhost:9090", config = { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "dick", password: "password2" } diff --git a/examples/secured-service-with-jwt/secured_service_with_jwt.bal b/examples/secured-service-with-jwt/secured_service_with_jwt.bal index 0269b25edcea..8d56319f722a 100644 --- a/examples/secured-service-with-jwt/secured_service_with_jwt.bal +++ b/examples/secured-service-with-jwt/secured_service_with_jwt.bal @@ -4,7 +4,7 @@ import ballerina/http; // parameters. http:AuthProvider jwtAuthProvider = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer:"ballerina", audience: ["ballerina.io"], certificateAlias: "ballerina", diff --git a/language-server/modules/langserver-core/src/test/resources/completion/function/actionInvocationSuggestion1.json b/language-server/modules/langserver-core/src/test/resources/completion/function/actionInvocationSuggestion1.json index 295f4e913adc..3e7316175e53 100644 --- a/language-server/modules/langserver-core/src/test/resources/completion/function/actionInvocationSuggestion1.json +++ b/language-server/modules/langserver-core/src/test/resources/completion/function/actionInvocationSuggestion1.json @@ -1,6 +1,6 @@ { "position": { - "line": 13, + "line": 15, "character": 16 }, "source": "function/source/actionInvocationSuggestion1.bal", diff --git a/language-server/modules/langserver-core/src/test/resources/completion/function/actionInvocationSuggestion2.json b/language-server/modules/langserver-core/src/test/resources/completion/function/actionInvocationSuggestion2.json index 4db84858257a..8a15627a42d1 100644 --- a/language-server/modules/langserver-core/src/test/resources/completion/function/actionInvocationSuggestion2.json +++ b/language-server/modules/langserver-core/src/test/resources/completion/function/actionInvocationSuggestion2.json @@ -1,6 +1,6 @@ { "position": { - "line": 13, + "line": 15, "character": 20 }, "source": "function/source/actionInvocationSuggestion2.bal", diff --git a/language-server/modules/langserver-core/src/test/resources/completion/function/errorLiftingSuggestions1.json b/language-server/modules/langserver-core/src/test/resources/completion/function/errorLiftingSuggestions1.json index 4c5daf6a4954..a1b21b6dbb51 100644 --- a/language-server/modules/langserver-core/src/test/resources/completion/function/errorLiftingSuggestions1.json +++ b/language-server/modules/langserver-core/src/test/resources/completion/function/errorLiftingSuggestions1.json @@ -1,6 +1,6 @@ { "position": { - "line": 16, + "line": 18, "character": 27 }, "source": "function/source/errorLiftingSuggestions1.bal", diff --git a/language-server/modules/langserver-core/src/test/resources/completion/function/source/actionInvocationSuggestion1.bal b/language-server/modules/langserver-core/src/test/resources/completion/function/source/actionInvocationSuggestion1.bal index 4baf25dc6cda..de7fff653fde 100644 --- a/language-server/modules/langserver-core/src/test/resources/completion/function/source/actionInvocationSuggestion1.bal +++ b/language-server/modules/langserver-core/src/test/resources/completion/function/source/actionInvocationSuggestion1.bal @@ -4,7 +4,7 @@ http:ClientEndpointConfig conf = { url: "https://postman-echo.com/basic-auth", auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "postman", password: "password" } diff --git a/language-server/modules/langserver-core/src/test/resources/completion/function/source/actionInvocationSuggestion2.bal b/language-server/modules/langserver-core/src/test/resources/completion/function/source/actionInvocationSuggestion2.bal index 5e7ad93d8855..3d8a415d3307 100644 --- a/language-server/modules/langserver-core/src/test/resources/completion/function/source/actionInvocationSuggestion2.bal +++ b/language-server/modules/langserver-core/src/test/resources/completion/function/source/actionInvocationSuggestion2.bal @@ -4,10 +4,10 @@ http:ClientEndpointConfig conf = { url: "https://postman-echo.com/basic-auth", auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "postman", password: "password" - } + } } }; diff --git a/language-server/modules/langserver-core/src/test/resources/completion/function/source/errorLiftingSuggestions1.bal b/language-server/modules/langserver-core/src/test/resources/completion/function/source/errorLiftingSuggestions1.bal index 84100dc68ad4..ecad7b511fb3 100644 --- a/language-server/modules/langserver-core/src/test/resources/completion/function/source/errorLiftingSuggestions1.bal +++ b/language-server/modules/langserver-core/src/test/resources/completion/function/source/errorLiftingSuggestions1.bal @@ -5,7 +5,7 @@ http:ClientEndpointConfig conf = { url: "https://postman-echo.com/basic-auth", auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "postman", password: "password" } diff --git a/stdlib/http/src/main/ballerina/http/client_endpoint.bal b/stdlib/http/src/main/ballerina/http/client_endpoint.bal index 3788040f3091..3f3478fc685d 100644 --- a/stdlib/http/src/main/ballerina/http/client_endpoint.bal +++ b/stdlib/http/src/main/ballerina/http/client_endpoint.bal @@ -322,15 +322,10 @@ public type ProxyConfig record { # AuthConfig record can be used to configure the authentication mechanism used by the HTTP endpoint. # # + scheme - Authentication scheme -# + basicAuthConfig - Configuration for BasicAuth scheme -# + oAuth2AuthConfig - Configuration for OAuth2 scheme -# + jwtAuthConfig - Configuration for JWT scheme. If inbound authentication is JWT, sends the same JWT with client -# invocation, unless reissuing is configured using InferredJwtIssuerConfig. +# + config - Configuration related to the selected authenticator. public type AuthConfig record { OutboundAuthScheme scheme; - BasicAuthConfig basicAuthConfig?; - OAuth2AuthConfig oAuth2AuthConfig?; - JwtAuthConfig jwtAuthConfig?; + BasicAuthConfig|OAuth2AuthConfig|JwtAuthConfig config?; !...; }; @@ -339,8 +334,8 @@ public type AuthConfig record { # + username - Username for Basic authentication # + password - Password for Basic authentication public type BasicAuthConfig record { - string username = ""; - string password = ""; + string username; + string password; !...; }; @@ -374,7 +369,8 @@ public type OAuth2AuthConfig record { # # + inferredJwtIssuerConfig - JWT issuer configuration used to issue JWT with specific configuration public type JwtAuthConfig record { - auth:InferredJwtIssuerConfig inferredJwtIssuerConfig?; + auth:InferredJwtIssuerConfig inferredJwtIssuerConfig; + !...; }; function initialize(string serviceUrl, ClientEndpointConfig config) returns Client|error { diff --git a/stdlib/http/src/main/ballerina/http/http_secure_client.bal b/stdlib/http/src/main/ballerina/http/http_secure_client.bal index de0e02622480..375916337ca6 100644 --- a/stdlib/http/src/main/ballerina/http/http_secure_client.bal +++ b/stdlib/http/src/main/ballerina/http/http_secure_client.bal @@ -302,38 +302,37 @@ public function createHttpSecureClient(string url, ClientEndpointConfig config) function generateSecureRequest(Request req, ClientEndpointConfig config) returns ()|error { var auth = config.auth; if (auth is AuthConfig) { + var authConfig = auth["config"]; if (auth.scheme == BASIC_AUTH) { - var basicAuthConfig = auth["basicAuthConfig"]; - if (basicAuthConfig is ()) { - error e = error("Basic auth config not provided"); - panic e; - } else { - string username = basicAuthConfig.username; - string password = basicAuthConfig.password; + if (authConfig is BasicAuthConfig) { + string username = authConfig.username; + string password = authConfig.password; string str = username + ":" + password; string token = encoding:encodeBase64(str.toByteArray("UTF-8")); req.setHeader(AUTH_HEADER, AUTH_SCHEME_BASIC + WHITE_SPACE + token); + } else { + error e = error("Basic auth config not provided"); + panic e; } } else if (auth.scheme == OAUTH2) { - var oAuth2AuthConfig = auth["oAuth2AuthConfig"]; - if (oAuth2AuthConfig is ()) { - error e = error("OAuth2 config not provided"); - panic e; - } else { - string accessToken = oAuth2AuthConfig.accessToken; + if (authConfig is OAuth2AuthConfig) { + string accessToken = authConfig.accessToken; if (accessToken == EMPTY_STRING) { return updateRequestAndConfig(req, config); } else { req.setHeader(AUTH_HEADER, AUTH_SCHEME_BEARER + WHITE_SPACE + accessToken); } + } else { + error e = error("OAuth2 config not provided"); + panic e; } } else if (auth.scheme == JWT_AUTH) { - var jwtAuthConfig = auth["jwtAuthConfig"]; string authToken = EMPTY_STRING; - if (jwtAuthConfig is ()) { - authToken = runtime:getInvocationContext().authenticationContext.authToken; - } else { - var jwtIssuerConfig = jwtAuthConfig["inferredJwtIssuerConfig"]; + if (authConfig is OAuth2AuthConfig || authConfig is BasicAuthConfig) { + error e = error("JWT auth config not provided"); + panic e; + } else if (authConfig is JwtAuthConfig) { + var jwtIssuerConfig = authConfig["inferredJwtIssuerConfig"]; if (jwtIssuerConfig is ()) { authToken = runtime:getInvocationContext().authenticationContext.authToken; } else { @@ -360,6 +359,8 @@ function generateSecureRequest(Request req, ClientEndpointConfig config) returns return token; } } + } else { + authToken = runtime:getInvocationContext().authenticationContext.authToken; } if (authToken == EMPTY_STRING) { error err = error(HTTP_ERROR_CODE, { message: "JWT was not used during inbound authentication. @@ -383,7 +384,7 @@ function generateSecureRequest(Request req, ClientEndpointConfig config) returns function updateRequestAndConfig(Request req, ClientEndpointConfig config) returns ()|error { string accessToken = check getAccessTokenFromRefreshToken(config); req.setHeader(AUTH_HEADER, AUTH_SCHEME_BEARER + WHITE_SPACE + accessToken); - OAuth2AuthConfig? authConfig = config.auth.oAuth2AuthConfig; + var authConfig = config.auth.config; if (authConfig is OAuth2AuthConfig) { authConfig.accessToken = accessToken; } @@ -396,13 +397,13 @@ function updateRequestAndConfig(Request req, ClientEndpointConfig config) return # + return - AccessToken received from the authorization server or `error` if error occured during HTTP client invocation function getAccessTokenFromRefreshToken(ClientEndpointConfig config) returns string|error { Client refreshTokenClient; - var oAuth2AuthConfig = config.auth.oAuth2AuthConfig; - if (oAuth2AuthConfig is OAuth2AuthConfig) { - string refreshToken = oAuth2AuthConfig.refreshToken; - string clientId = oAuth2AuthConfig.clientId; - string clientSecret = oAuth2AuthConfig.clientSecret; - string refreshUrl = oAuth2AuthConfig.refreshUrl; - string[] scopes = oAuth2AuthConfig.scopes; + var authConfig = config.auth.config; + if (authConfig is OAuth2AuthConfig) { + string refreshToken = authConfig.refreshToken; + string clientId = authConfig.clientId; + string clientSecret = authConfig.clientSecret; + string refreshUrl = authConfig.refreshUrl; + string[] scopes = authConfig.scopes; if (refreshToken == EMPTY_STRING || clientId == EMPTY_STRING || clientSecret == EMPTY_STRING || refreshUrl == EMPTY_STRING) { @@ -424,7 +425,7 @@ function getAccessTokenFromRefreshToken(ClientEndpointConfig config) returns str if (scopeString != EMPTY_STRING) { textPayload = textPayload + "&scope=" + scopeString.trim(); } - if (oAuth2AuthConfig.credentialBearer == AUTH_HEADER_BEARER) { + if (authConfig.credentialBearer == AUTH_HEADER_BEARER) { string clientIdSecret = clientId + ":" + clientSecret; refreshTokenRequest.addHeader(AUTH_HEADER, AUTH_SCHEME_BASIC + WHITE_SPACE + encoding:encodeBase64(clientIdSecret.toByteArray("UTF-8"))); diff --git a/stdlib/http/src/main/ballerina/http/service_endpoint.bal b/stdlib/http/src/main/ballerina/http/service_endpoint.bal index 29d78487bf79..43402c5f165b 100644 --- a/stdlib/http/src/main/ballerina/http/service_endpoint.bal +++ b/stdlib/http/src/main/ballerina/http/service_endpoint.bal @@ -216,16 +216,12 @@ public type AuthCacheConfig record { # + id - Authentication provider instance id # + scheme - Authentication scheme # + authStoreProvider - Authentication store provider (Config, LDAP, etc.) implementation -# + ldapAuthProviderConfig - LDAP auth provider related configurations -# + configAuthProviderConfig - Config auth provider related configurations -# + jwtAuthProviderConfig - JWT auth provider related configurations +# + config - Configuration related to the selected authentication provider. public type AuthProvider record { string id = ""; InboundAuthScheme? scheme = (); AuthStoreProvider? authStoreProvider = (); - auth:LdapAuthProviderConfig? ldapAuthProviderConfig = (); - auth:ConfigAuthProviderConfig? configAuthProviderConfig = (); - auth:JWTAuthProviderConfig? jwtAuthProviderConfig = (); + auth:LdapAuthProviderConfig|auth:ConfigAuthProviderConfig|auth:JWTAuthProviderConfig? config = (); !...; }; @@ -293,21 +289,20 @@ function createAuthFiltersForSecureListener(ServiceEndpointConfiguration config, auth:AuthStoreProvider authStoreProvider = new; foreach var provider in authProviderList { + var authProviderConfig = provider.config; if (provider.scheme == BASIC_AUTH) { if (provider.authStoreProvider == LDAP_AUTH_STORE) { - var ldapAuthProviderConfig = provider.ldapAuthProviderConfig; - if (ldapAuthProviderConfig is auth:LdapAuthProviderConfig) { - auth:LdapAuthStoreProvider ldapAuthStoreProvider = new(ldapAuthProviderConfig, instanceId); + if (authProviderConfig is auth:LdapAuthProviderConfig) { + auth:LdapAuthStoreProvider ldapAuthStoreProvider = new(authProviderConfig, instanceId); authStoreProvider = ldapAuthStoreProvider; } else { error e = error("LDAP auth provider config not provided"); panic e; } } else if (provider.authStoreProvider == CONFIG_AUTH_STORE) { - var configAuthProviderConfig = provider.configAuthProviderConfig; auth:ConfigAuthStoreProvider configAuthStoreProvider; - if (configAuthProviderConfig is auth:ConfigAuthProviderConfig) { - configAuthStoreProvider = new(configAuthProviderConfig); + if (authProviderConfig is auth:ConfigAuthProviderConfig) { + configAuthStoreProvider = new(authProviderConfig); } else { configAuthStoreProvider = new({}); } @@ -329,21 +324,20 @@ function createAuthFiltersForSecureListener(ServiceEndpointConfiguration config, } function createAuthHandler(AuthProvider authProvider, string instanceId) returns HttpAuthnHandler { + var authProviderConfig = authProvider.config; if (authProvider.scheme == BASIC_AUTH) { auth:AuthStoreProvider authStoreProvider = new; if (authProvider.authStoreProvider == CONFIG_AUTH_STORE) { - var configAuthProviderConfig = authProvider.configAuthProviderConfig; auth:ConfigAuthStoreProvider configAuthStoreProvider; - if (configAuthProviderConfig is auth:ConfigAuthProviderConfig) { - configAuthStoreProvider = new(configAuthProviderConfig); + if (authProviderConfig is auth:ConfigAuthProviderConfig) { + configAuthStoreProvider = new(authProviderConfig); } else { configAuthStoreProvider = new({}); } authStoreProvider = configAuthStoreProvider; } else if (authProvider.authStoreProvider == LDAP_AUTH_STORE) { - var ldapAuthProviderConfig = authProvider.ldapAuthProviderConfig; - if (ldapAuthProviderConfig is auth:LdapAuthProviderConfig) { - auth:LdapAuthStoreProvider ldapAuthStoreProvider = new(ldapAuthProviderConfig, instanceId); + if (authProviderConfig is auth:LdapAuthProviderConfig) { + auth:LdapAuthStoreProvider ldapAuthStoreProvider = new(authProviderConfig, instanceId); authStoreProvider = ldapAuthStoreProvider; } else { error e = error("LDAP auth provider config not provided"); @@ -356,9 +350,8 @@ function createAuthHandler(AuthProvider authProvider, string instanceId) returns HttpBasicAuthnHandler basicAuthHandler = new(authStoreProvider); return basicAuthHandler; } else if (authProvider.scheme == JWT_AUTH){ - var jwtAuthProviderConfig = authProvider.jwtAuthProviderConfig; - if (jwtAuthProviderConfig is auth:JWTAuthProviderConfig) { - auth:JWTAuthProvider jwtAuthProvider = new(jwtAuthProviderConfig); + if (authProviderConfig is auth:JWTAuthProviderConfig) { + auth:JWTAuthProvider jwtAuthProvider = new(authProviderConfig); HttpJwtAuthnHandler jwtAuthnHandler = new(jwtAuthProvider); return jwtAuthnHandler; } else { diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authclients/oauth-client.bal b/tests/ballerina-integration-test/src/test/resources/auth/authclients/oauth-client.bal index e0b0e8557e9e..06f382030c22 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authclients/oauth-client.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authclients/oauth-client.bal @@ -19,7 +19,7 @@ import ballerina/http; http:Client clientEP1 = new("https://localhost:9095/foo", config = { auth: { scheme: http:OAUTH2, - oAuth2AuthConfig: { + config: { refreshToken: "5Aep861..zRMyCurAUgnwQaEjnCVqxK2utna7Mm4nb9UamD7BW50R2huecjSaLlv5mT1z_TViZ", clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L5w4gz52uriT8ksZ3nUVjKvrfQMrU4uvZohTftxStwNEW4cfStBEGRxRL68", clientSecret: "9205371918321623741", @@ -32,7 +32,7 @@ http:Client clientEP1 = new("https://localhost:9095/foo", config = { http:Client clientEP2 = new("https://localhost:9095/foo", config = { auth: { scheme: http:OAUTH2, - oAuth2AuthConfig: { + config: { refreshToken: "5Aep861..zRMyCurAUgnwQaEjnCVqxK2utna7Mm4nb9UamD7BW50R2huecjSaLlv5mT1z_TViZ", clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L5w4gz52uriT8ksZ3nUVjKvrfQMrU4uvZohTftxStwNEW4cfStBEGRxRL68", clientSecret: "9205371918321623741", @@ -45,7 +45,7 @@ http:Client clientEP2 = new("https://localhost:9095/foo", config = { http:Client clientEP3 = new("https://localhost:9095/foo", config = { auth: { scheme: http:OAUTH2, - oAuth2AuthConfig: { + config: { refreshToken: "5Aep861..zRMyCurAUgnwQaEjnCVqxK2utna7Mm4nb9UamD7BW50R2huecjSaLlv5mT1z_TViZ", clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L5w4gz52uriT8ksZ3nUVjKvrfQMrU4uvZohTftxStwNEW4cfStBEGRxRL68", clientSecret: "9205371918321623741", @@ -57,7 +57,7 @@ http:Client clientEP3 = new("https://localhost:9095/foo", config = { http:Client clientEP4 = new("https://localhost:9095/foo", config = { auth: { scheme: http:OAUTH2, - oAuth2AuthConfig : { + config : { refreshToken: "5Aep861..zRMyCurAUgnwQaEjnCVqxK2utna7Mm4nb9UamD7BW50R2huecjSaLlv5mT1z_TViZ", clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L5w4gz52uriT8ksZ3nUVjKvrfQMrU4uvZohTftxStwNEW4cfStBEGRxRL68", clientSecret: "9205371918321623741", @@ -70,7 +70,7 @@ http:Client clientEP4 = new("https://localhost:9095/foo", config = { http:Client clientEP5 = new("https://localhost:9095/foo", config = { auth: { scheme: http:OAUTH2, - oAuth2AuthConfig: { + config: { refreshToken: "5Aep861..zRMyCurAUgnwQaEjnCVqxK2utna7Mm4nb9UamD7BW50R2huecjSaLlv5mT1z_TViZ", clientId: "3MVG9YDQS5WtC11paU2WcQjBB3L5w4gz52uriT8ksZ3nUVjKvrfQMrU4uvZohTftxStwNEW4cfStBEGRxRL68", clientSecret: "9205371918321623741", diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/08_authn_with_multiple_providers.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/08_authn_with_multiple_providers.bal index c667b6832487..5a6db3a242c1 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/08_authn_with_multiple_providers.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/08_authn_with_multiple_providers.bal @@ -18,7 +18,7 @@ import ballerina/http; http:AuthProvider jwtAuthProvider1 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "example1", audience: ["ballerina"], certificateAlias: "ballerina", @@ -31,7 +31,7 @@ http:AuthProvider jwtAuthProvider1 = { http:AuthProvider jwtAuthProvider2 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "example2", audience: ["ballerina"], certificateAlias: "ballerina", diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/09_authn_with_different_scopes.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/09_authn_with_different_scopes.bal index ff8e1c30e6a5..ae9114a64ac2 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/09_authn_with_different_scopes.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/09_authn_with_different_scopes.bal @@ -18,7 +18,7 @@ import ballerina/http; http:AuthProvider jwtAuthProvider3 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "ballerina", audience: ["ballerina"], certificateAlias: "ballerina", diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/10_token_propagation_disabled_test.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/10_token_propagation_disabled_test.bal index 8f414201bfbb..7c26b5155707 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/10_token_propagation_disabled_test.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/10_token_propagation_disabled_test.bal @@ -58,7 +58,7 @@ service passthroughService on listener10_1 { http:AuthProvider jwtAuthProvider10 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "ballerina", audience: ["ballerina"], certificateAlias: "ballerina", diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/11_token_propagation_basic_auth_test.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/11_token_propagation_basic_auth_test.bal index 123e05f99e22..815202ea4166 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/11_token_propagation_basic_auth_test.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/11_token_propagation_basic_auth_test.bal @@ -34,7 +34,7 @@ listener http:Listener listener11 = new(9192, config = { http:Client nyseEP03 = new("https://localhost:9193", config = { auth: { scheme: http:JWT_AUTH, - jwtAuthConfig: { + config: { inferredJwtIssuerConfig: { issuer: "ballerina", audience: ["ballerina"], @@ -72,7 +72,7 @@ service passthroughService03 on listener11 { http:AuthProvider jwtAuthProvider03 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "ballerina", audience: ["ballerina"], certificateAlias: "ballerina", diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/13_authn_with_expired_certificate.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/13_authn_with_expired_certificate.bal index 878ac9984d0d..0c40d6cf35be 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/13_authn_with_expired_certificate.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/13_authn_with_expired_certificate.bal @@ -18,7 +18,7 @@ import ballerina/http; http:AuthProvider jwtAuthProvider4 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer:"ballerina", audience: ["ballerina.io"], certificateAlias: "cert", diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/14_authn_with_expired_certificate_with_no_expiry_validation.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/14_authn_with_expired_certificate_with_no_expiry_validation.bal index 59e533eed18f..e0cdc5e20937 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/14_authn_with_expired_certificate_with_no_expiry_validation.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/14_authn_with_expired_certificate_with_no_expiry_validation.bal @@ -18,7 +18,7 @@ import ballerina/http; http:AuthProvider jwtAuthProvider14 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer:"ballerina", audience: ["ballerina.io"], certificateAlias: "cert", diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/15_token_propagation_jwt_test.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/15_token_propagation_jwt_test.bal index 150a5ed7d21d..decfe0a9664f 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/15_token_propagation_jwt_test.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/15_token_propagation_jwt_test.bal @@ -18,7 +18,7 @@ import ballerina/http; http:AuthProvider basicAuthProvider15 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "example1", audience: ["ballerina"], certificateAlias: "ballerina", @@ -68,7 +68,7 @@ service passthroughService15 on listener15_1 { http:AuthProvider jwtAuthProvider15 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "example1", audience: ["ballerina"], certificateAlias: "ballerina", diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/16_token_propagation_jwt_reissuing_test.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/16_token_propagation_jwt_reissuing_test.bal index 869eea95be8a..cbd2c8cb70ed 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/16_token_propagation_jwt_reissuing_test.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/16_token_propagation_jwt_reissuing_test.bal @@ -18,7 +18,7 @@ import ballerina/http; http:AuthProvider basicAuthProvider16 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "example1", audience: ["ballerina"], certificateAlias: "ballerina", @@ -42,7 +42,7 @@ listener http:Listener listener16_1 = new(9105, config = { http:Client nyseEP16 = new("https://localhost:9106", config = { auth: { scheme: http:JWT_AUTH, - jwtAuthConfig: { + config: { inferredJwtIssuerConfig: { issuer: "example2", audience: ["ballerina"], @@ -80,7 +80,7 @@ service passthroughService16 on listener16_1 { http:AuthProvider jwtAuthProvider16 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "example2", audience: ["ballerina"], certificateAlias: "ballerina", diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/17_token_propagation_jwt_reissuing_negative_test.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/17_token_propagation_jwt_reissuing_negative_test.bal index a0a0fe5b3e7b..f322990aa895 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/17_token_propagation_jwt_reissuing_negative_test.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/17_token_propagation_jwt_reissuing_negative_test.bal @@ -18,7 +18,7 @@ import ballerina/http; http:AuthProvider basicAuthProvider17 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "example1", audience: ["ballerina"], certificateAlias: "ballerina", @@ -42,7 +42,7 @@ listener http:Listener listener17_1 = new(9107, config = { http:Client nyseEP17 = new("https://localhost:9108", config = { auth: { scheme: http:JWT_AUTH, - jwtAuthConfig: { + config: { inferredJwtIssuerConfig: { issuer: "ballerina", audience: ["ballerina"], @@ -80,7 +80,7 @@ service passthroughService17 on listener17_1 { http:AuthProvider jwtAuthProvider17 = { scheme: http:JWT_AUTH, - jwtAuthProviderConfig: { + config: { issuer: "example2aaaaaaaaaaaaaa", audience: ["ballerina"], certificateAlias: "ballerina", diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/ldap_auth_store_authorization_test.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/ldap_auth_store_authorization_test.bal index 7f225b9273e8..e3d52cf3228a 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/ldap_auth_store_authorization_test.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/ldap_auth_store_authorization_test.bal @@ -44,7 +44,7 @@ http:AuthProvider authProvider = { id: "basic02", scheme: http:BASIC_AUTH, authStoreProvider: http:LDAP_AUTH_STORE, - ldapAuthProviderConfig: ldapConfig + config: ldapConfig }; listener http:Listener authEP = new(9097, config = { diff --git a/tests/ballerina-integration-test/src/test/resources/auth/authservices/ldap_auth_store_test.bal b/tests/ballerina-integration-test/src/test/resources/auth/authservices/ldap_auth_store_test.bal index 3e148deb059c..0dafb206a570 100644 --- a/tests/ballerina-integration-test/src/test/resources/auth/authservices/ldap_auth_store_test.bal +++ b/tests/ballerina-integration-test/src/test/resources/auth/authservices/ldap_auth_store_test.bal @@ -44,7 +44,7 @@ http:AuthProvider basicAuthProvider = { id: "basic01", scheme: http:BASIC_AUTH, authStoreProvider: http:LDAP_AUTH_STORE, - ldapAuthProviderConfig: ldapAuthProviderConfig + config: ldapAuthProviderConfig }; listener http:Listener ep = new(9096, config = { diff --git a/tests/ballerina-integration-test/src/test/resources/websub/advanced_services/01_websub_publisher.bal b/tests/ballerina-integration-test/src/test/resources/websub/advanced_services/01_websub_publisher.bal index eaa129164296..e1c4334f20f0 100644 --- a/tests/ballerina-integration-test/src/test/resources/websub/advanced_services/01_websub_publisher.bal +++ b/tests/ballerina-integration-test/src/test/resources/websub/advanced_services/01_websub_publisher.bal @@ -51,7 +51,7 @@ listener http:Listener publisherServiceEP = new http:Listener(8080); websub:Client websubHubClientEP = new websub:Client(webSubHub.hubUrl, config = { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "peter", password: "pqr" } diff --git a/tests/ballerina-integration-test/src/test/resources/websub/test_subscribers_at_basic_auth_secured_hub.bal b/tests/ballerina-integration-test/src/test/resources/websub/test_subscribers_at_basic_auth_secured_hub.bal index 30442335d091..8718ec64f425 100644 --- a/tests/ballerina-integration-test/src/test/resources/websub/test_subscribers_at_basic_auth_secured_hub.bal +++ b/tests/ballerina-integration-test/src/test/resources/websub/test_subscribers_at_basic_auth_secured_hub.bal @@ -30,7 +30,7 @@ listener websub:Listener websubEP = new websub:Listener(8484); subscriptionClientConfig: { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "tom", password: "1234" } @@ -52,7 +52,7 @@ service websubSubscriber on websubEP { subscriptionClientConfig: { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "tom", password: "4321" } @@ -74,7 +74,7 @@ service websubSubscriberTwo on websubEP { subscriptionClientConfig: { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "mary", password: "xyz" } @@ -96,7 +96,7 @@ service websubSubscriberThree on websubEP { subscriptionClientConfig: { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "tom", password: "1234" } diff --git a/tests/ballerina-integration-test/src/test/resources/websub/test_subscribers_at_persistence_enabled_hub.bal b/tests/ballerina-integration-test/src/test/resources/websub/test_subscribers_at_persistence_enabled_hub.bal index a50171d2c2fe..5ab77d4bf4a2 100644 --- a/tests/ballerina-integration-test/src/test/resources/websub/test_subscribers_at_persistence_enabled_hub.bal +++ b/tests/ballerina-integration-test/src/test/resources/websub/test_subscribers_at_persistence_enabled_hub.bal @@ -30,7 +30,7 @@ listener websub:Listener websubEP = new websub:Listener(8383); subscriptionClientConfig: { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "tom", password: "1234" } @@ -52,7 +52,7 @@ service websubSubscriber on websubEP { subscriptionClientConfig: { auth: { scheme: http:BASIC_AUTH, - basicAuthConfig: { + config: { username: "tom", password: "1234" }