From 6b2614d3349613aacf0b7320b0facfb0b74aefb8 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Mon, 11 Nov 2024 18:05:22 +0530 Subject: [PATCH 01/32] Add SMS OTP test case --- .../auth/PasswordlessSMSOTPAuthTestCase.java | 333 ++++++++++++++++++ .../test/base/MockSMSProvider.java | 126 +++++++ .../oidc/OIDCAbstractIntegrationTest.java | 2 +- .../sender/v1/model/EmailProviderList.java | 66 ++++ .../sender/v1/model/EmailSender.java | 239 +++++++++++++ .../sender/v1/model/EmailSenderAdd.java | 239 +++++++++++++ .../v1/model/EmailSenderUpdateRequest.java | 216 ++++++++++++ .../notification/sender/v1/model/Error.java | 160 +++++++++ .../sender/v1/model/Properties.java | 114 ++++++ .../sender/v1/model/SMSProviderList.java | 66 ++++ .../sender/v1/model/SMSSender.java | 310 ++++++++++++++++ .../sender/v1/model/SMSSenderAdd.java | 310 ++++++++++++++++ .../v1/model/SMSSenderUpdateRequest.java | 287 +++++++++++++++ .../api/user/common/model/PhoneNumbers.java | 110 ++++++ .../api/user/common/model/UserObject.java | 29 ++ .../NotificationSenderRestClient.java | 112 ++++++ .../src/test/resources/testng.xml | 1 + 17 files changed, 2719 insertions(+), 1 deletion(-) create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/MockSMSProvider.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailProviderList.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSender.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderAdd.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderUpdateRequest.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Error.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Properties.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSProviderList.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSender.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderAdd.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderUpdateRequest.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/restclients/NotificationSenderRestClient.java diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java new file mode 100644 index 00000000000..f338dd67b6d --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java @@ -0,0 +1,333 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.auth; + +import org.apache.http.Header; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.utils.URLEncodedUtils; +import org.apache.http.config.Lookup; +import org.apache.http.config.RegistryBuilder; +import org.apache.http.cookie.CookieSpecProvider; +import org.apache.http.impl.client.DefaultRedirectStrategy; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.cookie.RFC6265CookieSpecProvider; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Factory; +import org.testng.annotations.Test; +import org.wso2.carbon.automation.engine.context.TestUserMode; +import org.wso2.identity.integration.test.base.MockSMSProvider; +import org.wso2.identity.integration.test.oidc.OIDCAbstractIntegrationTest; +import org.wso2.identity.integration.test.oidc.OIDCUtilTest; +import org.wso2.identity.integration.test.oidc.bean.OIDCApplication; +import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.ApplicationModel; +import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.AuthenticationSequence; +import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.AuthenticationStep; +import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.Authenticator; +import org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model.Properties; +import org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model.SMSSender; +import org.wso2.identity.integration.test.rest.api.user.common.model.Name; +import org.wso2.identity.integration.test.rest.api.user.common.model.PhoneNumbers; +import org.wso2.identity.integration.test.rest.api.user.common.model.UserObject; +import org.wso2.identity.integration.test.restclients.NotificationSenderRestClient; +import org.wso2.identity.integration.test.utils.DataExtractUtil; +import org.wso2.identity.integration.test.utils.OAuth2Constant; + +import java.io.IOException; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.wso2.identity.integration.test.utils.OAuth2Constant.ACCESS_TOKEN_ENDPOINT; +import static org.wso2.identity.integration.test.utils.OAuth2Constant.AUTHORIZATION_HEADER; +import static org.wso2.identity.integration.test.utils.OAuth2Constant.AUTHORIZE_ENDPOINT_URL; +import static org.wso2.identity.integration.test.utils.OAuth2Constant.OAUTH2_GRANT_TYPE_AUTHORIZATION_CODE; + +public class PasswordlessSMSOTPAuthTestCase extends OIDCAbstractIntegrationTest { + + public static final String USERNAME = "passwordlessuser"; + public static final String PASSWORD = "Oidcsessiontestuser@123"; + public static final String MOBILE = "+941111111111"; + public static final String SMS_SENDER_REQUEST_FORMAT = "{\"content\": {{body}}, \"to\": {{mobile}} }"; + + private HttpClient client; + + NotificationSenderRestClient notificationSenderRestClient; + + private OIDCApplication oidcApplication; + private UserObject userObject; + private String sessionDataKey; + private String authorizationCode; + + private MockSMSProvider mockSMSProvider; + private TestUserMode userMode; + + @Factory(dataProvider = "testExecutionContextProvider") + public PasswordlessSMSOTPAuthTestCase(TestUserMode userMode) { + + this.userMode = userMode; + } + + @DataProvider(name = "testExecutionContextProvider") + public static Object[][] getTestExecutionContext() throws Exception { + + return new Object[][]{ + {TestUserMode.SUPER_TENANT_USER}, + {TestUserMode.TENANT_USER}, + }; + } + + @BeforeClass(alwaysRun = true) + public void testInit() throws Exception { + + super.init(userMode); + mockSMSProvider = new MockSMSProvider(); + mockSMSProvider.start(); + super.init(); + + Lookup cookieSpecRegistry = RegistryBuilder.create() + .register(CookieSpecs.DEFAULT, new RFC6265CookieSpecProvider()) + .build(); + RequestConfig requestConfig = RequestConfig.custom() + .setCookieSpec(CookieSpecs.DEFAULT) + .build(); + client = HttpClientBuilder.create() + .setDefaultRequestConfig(requestConfig) + .setDefaultCookieSpecRegistry(cookieSpecRegistry) + .setRedirectStrategy(new DefaultRedirectStrategy() { + @Override + protected boolean isRedirectable(String method) { + + return false; + } + }).build(); + + backendURL = backendURL.replace("services/", ""); + + oidcApplication = initOIDCApplication(); + ApplicationModel applicationModel = initApplication(); + createApplication(applicationModel, oidcApplication); + + userObject = initUser(); + createUser(userObject); + + notificationSenderRestClient = new NotificationSenderRestClient(backendURL, tenantInfo); + SMSSender smsSender = initSMSSender(); + notificationSenderRestClient.createSMSProvider(smsSender); + } + + private static SMSSender initSMSSender() { + + SMSSender smsSender = new SMSSender(); + smsSender.setProvider(MockSMSProvider.SMS_SENDER_PROVIDER_TYPE); + smsSender.setProviderURL(MockSMSProvider.SMS_SENDER_URL); + smsSender.contentType(SMSSender.ContentTypeEnum.JSON); + ArrayList properties = new ArrayList<>(); + properties.add(new Properties().key("body").value(SMS_SENDER_REQUEST_FORMAT)); + smsSender.setProperties(properties); + return smsSender; + } + + @AfterClass(alwaysRun = true) + public void atEnd() throws Exception { + + deleteApplication(oidcApplication); + deleteUser(userObject); + notificationSenderRestClient.deleteSMSProvider(); + + mockSMSProvider.stop(); + } + + @Test(groups = "wso2.is", description = "Verify token response when pre-issue access token action fails with " + + "authorization code grant type.") + public void testPasswordlessAuthentication() throws Exception { + + sendAuthorizeRequest(); + performUserLogin(); + HttpResponse response = sendTokenRequestForCodeGrant(); + + assertNotNull(response); + assertEquals(response.getStatusLine().getStatusCode(), 200); + } + + private void sendAuthorizeRequest() throws Exception { + + List urlParameters = new ArrayList<>(); + urlParameters.add(new BasicNameValuePair("response_type", OAuth2Constant.OAUTH2_GRANT_TYPE_CODE)); + urlParameters.add(new BasicNameValuePair("client_id", oidcApplication.getClientId())); + urlParameters.add(new BasicNameValuePair("redirect_uri", OAuth2Constant.CALLBACK_URL)); + + urlParameters.add(new BasicNameValuePair("scope", "openid")); + + HttpResponse response = sendPostRequestWithParameters(client, urlParameters, + getTenantQualifiedURL(AUTHORIZE_ENDPOINT_URL, tenantInfo.getDomain())); + + Header locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); + assertNotNull(locationHeader, "Location header expected for authorize request is not available"); + EntityUtils.consume(response.getEntity()); + + response = sendGetRequest(client, locationHeader.getValue()); + + Map keyPositionMap = new HashMap<>(1); + keyPositionMap.put("name=\"sessionDataKey\"", 1); + List keyValues = DataExtractUtil.extractDataFromResponse(response, keyPositionMap); + assertNotNull(keyValues, "SessionDataKey key value is null"); + + sessionDataKey = keyValues.get(0).getValue(); + assertNotNull(sessionDataKey, "Session data key is null"); + EntityUtils.consume(response.getEntity()); + } + + public void performUserLogin() throws Exception { + + sendLoginPostForIdentifier(client, sessionDataKey, userObject.getUserName()); + HttpResponse response = sendLoginPostForOtp(client, sessionDataKey, mockSMSProvider.getOTP()); + + Header locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); + assertNotNull(locationHeader, "Location header expected post login is not available."); + EntityUtils.consume(response.getEntity()); + + response = sendGetRequest(client, locationHeader.getValue()); + locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); + assertNotNull(locationHeader, "Redirection URL to the application with authorization code is null."); + EntityUtils.consume(response.getEntity()); + + authorizationCode = getAuthorizationCodeFromURL(locationHeader.getValue()); + assertNotNull(authorizationCode); + } + + /** + * Send identifier login post request with given username. + * + * @param client Http client. + * @param sessionDataKey Session data key. + * @param username Username. + * @throws ClientProtocolException If an error occurred while executing login post request. + * @throws IOException If an error occurred while executing login post request. + */ + public void sendLoginPostForIdentifier(HttpClient client, String sessionDataKey, String username) + throws ClientProtocolException, IOException { + + List urlParameters = new ArrayList<>(); + urlParameters.add(new BasicNameValuePair("username", username)); + urlParameters.add(new BasicNameValuePair("sessionDataKey", sessionDataKey)); + sendPostRequestWithParameters(client, urlParameters, + getTenantQualifiedURL(OAuth2Constant.COMMON_AUTH_URL, tenantInfo.getDomain())); + } + + /** + * Send login post request with given username and otp credentials. + * + * @param client Http client. + * @param sessionDataKey Session data key. + * @param otp Otp. + * @return Http response. + * @throws ClientProtocolException If an error occurred while executing login post request. + * @throws IOException If an error occurred while executing login post request. + */ + public HttpResponse sendLoginPostForOtp(HttpClient client, String sessionDataKey, String otp) + throws ClientProtocolException, IOException { + + List urlParameters = new ArrayList<>(); + urlParameters.add(new BasicNameValuePair("OTPcode", otp)); + urlParameters.add(new BasicNameValuePair("sessionDataKey", sessionDataKey)); + return sendPostRequestWithParameters(client, urlParameters, + getTenantQualifiedURL(OAuth2Constant.COMMON_AUTH_URL, tenantInfo.getDomain())); + } + + private HttpResponse sendTokenRequestForCodeGrant() throws Exception { + + List urlParameters = new ArrayList<>(); + urlParameters.add(new BasicNameValuePair("code", authorizationCode)); + urlParameters.add(new BasicNameValuePair("grant_type", OAUTH2_GRANT_TYPE_AUTHORIZATION_CODE)); + urlParameters.add(new BasicNameValuePair("redirect_uri", OAuth2Constant.CALLBACK_URL)); + urlParameters.add(new BasicNameValuePair("client_id", oidcApplication.getClientSecret())); + + urlParameters.add(new BasicNameValuePair("scope", "openid")); + + List
headers = new ArrayList<>(); + headers.add(new BasicHeader(AUTHORIZATION_HEADER, + OAuth2Constant.BASIC_HEADER + " " + getBase64EncodedString(oidcApplication.getClientId(), + oidcApplication.getClientSecret()))); + headers.add(new BasicHeader("Content-Type", "application/x-www-form-urlencoded")); + headers.add(new BasicHeader("User-Agent", OAuth2Constant.USER_AGENT)); + + return sendPostRequest(client, headers, urlParameters, + getTenantQualifiedURL(ACCESS_TOKEN_ENDPOINT, tenantInfo.getDomain())); + } + + private String getAuthorizationCodeFromURL(String location) { + + URI uri = URI.create(location); + return URLEncodedUtils.parse(uri, StandardCharsets.UTF_8).stream() + .filter(param -> "code".equals(param.getName())) + .map(NameValuePair::getValue) + .findFirst() + .orElse(null); + } + + private OIDCApplication initOIDCApplication() { + + OIDCApplication playgroundApp = new OIDCApplication(OIDCUtilTest.playgroundAppOneAppName, + OIDCUtilTest.playgroundAppOneAppContext, + OAuth2Constant.CALLBACK_URL); + return playgroundApp; + } + + private ApplicationModel initApplication() { + + ApplicationModel application = new ApplicationModel(); + AuthenticationSequence authenticationSequence = new AuthenticationSequence(); + AuthenticationStep stepsItem = new AuthenticationStep(); + stepsItem.setId(1); + Authenticator optionsItem = new Authenticator(); + optionsItem.setAuthenticator("sms-otp-authenticator"); + optionsItem.setIdp("LOCAL"); + stepsItem.addOptionsItem(optionsItem); + authenticationSequence.addStepsItem(stepsItem); + authenticationSequence.setType(AuthenticationSequence.TypeEnum.USER_DEFINED); + authenticationSequence.setSubjectStepId(1); + application.setAuthenticationSequence(authenticationSequence); + return application; + } + + protected UserObject initUser() { + + UserObject user = new UserObject(); + user.setUserName(USERNAME); + user.setPassword(PASSWORD); + user.setName(new Name().givenName(OIDCUtilTest.firstName).familyName(OIDCUtilTest.lastName)); + user.addPhoneNumbers(new PhoneNumbers().value(MOBILE).type("mobile")); + return user; + } +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/MockSMSProvider.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/MockSMSProvider.java new file mode 100644 index 00000000000..fa1f41ca837 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/MockSMSProvider.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.base; + +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.github.tomakehurst.wiremock.extension.ResponseTransformerV2; +import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer; +import com.github.tomakehurst.wiremock.http.Response; +import com.github.tomakehurst.wiremock.stubbing.ServeEvent; +import com.jayway.jsonpath.JsonPath; +import org.wso2.identity.integration.common.utils.ISIntegrationTest; +import org.wso2.identity.integration.test.util.Utils; + +import java.nio.file.Paths; +import java.util.concurrent.atomic.AtomicReference; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.matchingJsonPath; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +/** + * Mock SMS Provider for testing SMS related flows. + */ +public class MockSMSProvider { + + public static final String SMS_SENDER_URL = "https://localhost:8090/sms/send"; + public static final String SMS_SENDER_PROVIDER_TYPE = "Custom"; + + private WireMockServer wireMockServer; + private final AtomicReference otp = new AtomicReference<>(); + + public void start() { + + wireMockServer = new WireMockServer(WireMockConfiguration.wireMockConfig() + .httpsPort(8090) + .keystorePath(Paths.get(Utils.getResidentCarbonHome(), "repository", "resources", "security", + ISIntegrationTest.KEYSTORE_NAME).toAbsolutePath().toString()) + .keystorePassword("wso2carbon") + .keyManagerPassword("wso2carbon") + .extensions( + new ResponseTemplateTransformer(null, true, null, null), + new ResponseTransformerV2() { + @Override + public Response transform(Response response, ServeEvent serveEvent) { + + // Extract the content value from the request body + String content = + JsonPath.parse(serveEvent.getRequest().getBodyAsString()).read("$.content"); + + String regex = "\\b\\d{6}\\b"; + + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(content); + + if (matcher.find()) { + String extractedOtp = matcher.group(); + // Store the content value for later use + otp.set(extractedOtp); + } + return response; + } + + @Override + public boolean applyGlobally() { + return false; + } + + @Override + public String getName() { + return "otp-transformer"; + } + })); + + wireMockServer.start(); + + // Configure the mock OIDC endpoints + configureMockEndpoints(); + } + + public void stop() { + + if (wireMockServer != null) { + wireMockServer.stop(); + } + } + + private void configureMockEndpoints() { + + try { + wireMockServer.stubFor(post(urlEqualTo("/sms/send")) + .withRequestBody(matchingJsonPath("$.content")) + .withRequestBody(matchingJsonPath("$.to")) + .willReturn(aResponse() + .withTransformers("response-template", "otp-transformer") + .withStatus(200))); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public String getOTP() { + + return otp.get(); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAbstractIntegrationTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAbstractIntegrationTest.java index d026577b135..6742e9b8823 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAbstractIntegrationTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAbstractIntegrationTest.java @@ -127,7 +127,7 @@ public void createApplication(OIDCApplication application) throws Exception { createApplication(applicationModel, application); } - private void createApplication(ApplicationModel applicationModel, OIDCApplication application) throws Exception { + public void createApplication(ApplicationModel applicationModel, OIDCApplication application) throws Exception { log.info("Creating application " + application.getApplicationName()); diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailProviderList.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailProviderList.java new file mode 100644 index 00000000000..509c67d4ce5 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailProviderList.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model; + +import java.util.ArrayList; +import java.util.Objects; + +/** + * EmailProviderList + */ +public class EmailProviderList extends ArrayList { + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailProviderList {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSender.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSender.java new file mode 100644 index 00000000000..b5411c9edec --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSender.java @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * EmailSender + */ +public class EmailSender { + @SerializedName("name") + private String name = null; + + @SerializedName("smtpServerHost") + private String smtpServerHost = null; + + @SerializedName("smtpPort") + private Integer smtpPort = null; + + @SerializedName("fromAddress") + private String fromAddress = null; + + @SerializedName("userName") + private String userName = null; + + @SerializedName("password") + private String password = null; + + @SerializedName("properties") + private List properties = null; + + public EmailSender name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Schema(example = "EmailPublisher", required = true, description = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public EmailSender smtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + return this; + } + + /** + * Get smtpServerHost + * @return smtpServerHost + **/ + @Schema(example = "smtp.gmail.com", description = "") + public String getSmtpServerHost() { + return smtpServerHost; + } + + public void setSmtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + } + + public EmailSender smtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + return this; + } + + /** + * Get smtpPort + * @return smtpPort + **/ + @Schema(example = "587", description = "") + public Integer getSmtpPort() { + return smtpPort; + } + + public void setSmtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + } + + public EmailSender fromAddress(String fromAddress) { + this.fromAddress = fromAddress; + return this; + } + + /** + * Get fromAddress + * @return fromAddress + **/ + @Schema(example = "iam@gmail.com", required = true, description = "") + public String getFromAddress() { + return fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + public EmailSender userName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get userName + * @return userName + **/ + @Schema(example = "iam", description = "") + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public EmailSender password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @Schema(example = "iam123", description = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public EmailSender properties(List properties) { + this.properties = properties; + return this; + } + + public EmailSender addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); + } + this.properties.add(propertiesItem); + return this; + } + + /** + * Get properties + * @return properties + **/ + @Schema(example = "[{\"key\":\"mail.smtp.starttls.enable\",\"value\":true}]", description = "") + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailSender emailSender = (EmailSender) o; + return Objects.equals(this.name, emailSender.name) && + Objects.equals(this.smtpServerHost, emailSender.smtpServerHost) && + Objects.equals(this.smtpPort, emailSender.smtpPort) && + Objects.equals(this.fromAddress, emailSender.fromAddress) && + Objects.equals(this.userName, emailSender.userName) && + Objects.equals(this.password, emailSender.password) && + Objects.equals(this.properties, emailSender.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, smtpServerHost, smtpPort, fromAddress, userName, password, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailSender {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" smtpServerHost: ").append(toIndentedString(smtpServerHost)).append("\n"); + sb.append(" smtpPort: ").append(toIndentedString(smtpPort)).append("\n"); + sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderAdd.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderAdd.java new file mode 100644 index 00000000000..66cc00efaef --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderAdd.java @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * EmailSenderAdd + */ +public class EmailSenderAdd { + @SerializedName("name") + private String name = null; + + @SerializedName("smtpServerHost") + private String smtpServerHost = null; + + @SerializedName("smtpPort") + private Integer smtpPort = null; + + @SerializedName("fromAddress") + private String fromAddress = null; + + @SerializedName("userName") + private String userName = null; + + @SerializedName("password") + private String password = null; + + @SerializedName("properties") + private List properties = null; + + public EmailSenderAdd name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Schema(description = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public EmailSenderAdd smtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + return this; + } + + /** + * Get smtpServerHost + * @return smtpServerHost + **/ + @Schema(description = "") + public String getSmtpServerHost() { + return smtpServerHost; + } + + public void setSmtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + } + + public EmailSenderAdd smtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + return this; + } + + /** + * Get smtpPort + * @return smtpPort + **/ + @Schema(description = "") + public Integer getSmtpPort() { + return smtpPort; + } + + public void setSmtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + } + + public EmailSenderAdd fromAddress(String fromAddress) { + this.fromAddress = fromAddress; + return this; + } + + /** + * Get fromAddress + * @return fromAddress + **/ + @Schema(example = "iam@gmail.com", required = true, description = "") + public String getFromAddress() { + return fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + public EmailSenderAdd userName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get userName + * @return userName + **/ + @Schema(example = "iam", description = "") + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public EmailSenderAdd password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @Schema(example = "iam123", description = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public EmailSenderAdd properties(List properties) { + this.properties = properties; + return this; + } + + public EmailSenderAdd addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); + } + this.properties.add(propertiesItem); + return this; + } + + /** + * Get properties + * @return properties + **/ + @Schema(example = "[{\"key\":\"body.scope\",\"value\":\"true\"},{\"key\":\"mail.smtp.starttls.enable\",\"value\":true}]", description = "") + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailSenderAdd emailSenderAdd = (EmailSenderAdd) o; + return Objects.equals(this.name, emailSenderAdd.name) && + Objects.equals(this.smtpServerHost, emailSenderAdd.smtpServerHost) && + Objects.equals(this.smtpPort, emailSenderAdd.smtpPort) && + Objects.equals(this.fromAddress, emailSenderAdd.fromAddress) && + Objects.equals(this.userName, emailSenderAdd.userName) && + Objects.equals(this.password, emailSenderAdd.password) && + Objects.equals(this.properties, emailSenderAdd.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, smtpServerHost, smtpPort, fromAddress, userName, password, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailSenderAdd {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" smtpServerHost: ").append(toIndentedString(smtpServerHost)).append("\n"); + sb.append(" smtpPort: ").append(toIndentedString(smtpPort)).append("\n"); + sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderUpdateRequest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderUpdateRequest.java new file mode 100644 index 00000000000..049ab458dc4 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderUpdateRequest.java @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * EmailSenderUpdateRequest + */ +public class EmailSenderUpdateRequest { + @SerializedName("smtpServerHost") + private String smtpServerHost = null; + + @SerializedName("smtpPort") + private Integer smtpPort = null; + + @SerializedName("fromAddress") + private String fromAddress = null; + + @SerializedName("userName") + private String userName = null; + + @SerializedName("password") + private String password = null; + + @SerializedName("properties") + private List properties = null; + + public EmailSenderUpdateRequest smtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + return this; + } + + /** + * Get smtpServerHost + * @return smtpServerHost + **/ + @Schema(example = "smtp.gmail.com", description = "") + public String getSmtpServerHost() { + return smtpServerHost; + } + + public void setSmtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + } + + public EmailSenderUpdateRequest smtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + return this; + } + + /** + * Get smtpPort + * @return smtpPort + **/ + @Schema(example = "587", description = "") + public Integer getSmtpPort() { + return smtpPort; + } + + public void setSmtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + } + + public EmailSenderUpdateRequest fromAddress(String fromAddress) { + this.fromAddress = fromAddress; + return this; + } + + /** + * Get fromAddress + * @return fromAddress + **/ + @Schema(example = "iam@gmail.com", required = true, description = "") + public String getFromAddress() { + return fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + public EmailSenderUpdateRequest userName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get userName + * @return userName + **/ + @Schema(example = "iam", description = "") + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public EmailSenderUpdateRequest password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @Schema(example = "iam123", description = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public EmailSenderUpdateRequest properties(List properties) { + this.properties = properties; + return this; + } + + public EmailSenderUpdateRequest addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); + } + this.properties.add(propertiesItem); + return this; + } + + /** + * Get properties + * @return properties + **/ + @Schema(example = "[{\"key\":\"body.scope\",\"value\":\"true\"},{\"key\":\"mail.smtp.starttls.enable\",\"value\":true}]", description = "") + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailSenderUpdateRequest emailSenderUpdateRequest = (EmailSenderUpdateRequest) o; + return Objects.equals(this.smtpServerHost, emailSenderUpdateRequest.smtpServerHost) && + Objects.equals(this.smtpPort, emailSenderUpdateRequest.smtpPort) && + Objects.equals(this.fromAddress, emailSenderUpdateRequest.fromAddress) && + Objects.equals(this.userName, emailSenderUpdateRequest.userName) && + Objects.equals(this.password, emailSenderUpdateRequest.password) && + Objects.equals(this.properties, emailSenderUpdateRequest.properties); + } + + @Override + public int hashCode() { + return Objects.hash(smtpServerHost, smtpPort, fromAddress, userName, password, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailSenderUpdateRequest {\n"); + + sb.append(" smtpServerHost: ").append(toIndentedString(smtpServerHost)).append("\n"); + sb.append(" smtpPort: ").append(toIndentedString(smtpPort)).append("\n"); + sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Error.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Error.java new file mode 100644 index 00000000000..e573e9ed86a --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Error.java @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.Objects; + +/** + * Error + */ +public class Error { + @SerializedName("code") + private String code = null; + + @SerializedName("message") + private String message = null; + + @SerializedName("description") + private String description = null; + + @SerializedName("traceId") + private String traceId = null; + + public Error code(String code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @Schema(example = "NSM-00000", description = "") + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public Error message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @Schema(example = "Some Error Message", description = "") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Error description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * @return description + **/ + @Schema(example = "Some Error Description", description = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Error traceId(String traceId) { + this.traceId = traceId; + return this; + } + + /** + * Get traceId + * @return traceId + **/ + @Schema(example = "e0fbcfeb-3617-43c4-8dd0-7b7d38e13047", description = "") + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) && + Objects.equals(this.message, error.message) && + Objects.equals(this.description, error.description) && + Objects.equals(this.traceId, error.traceId); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, description, traceId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Properties.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Properties.java new file mode 100644 index 00000000000..5f273da72c8 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Properties.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model; + +import com.google.gson.annotations.SerializedName; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.Objects; + +/** + * Properties + */ +public class Properties { + @SerializedName("key") + private String key = null; + + @SerializedName("value") + private String value = null; + + public Properties key(String key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + **/ + @Schema(required = true, description = "") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public Properties value(String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + **/ + @Schema(required = true, description = "") + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Properties properties = (Properties) o; + return Objects.equals(this.key, properties.key) && + Objects.equals(this.value, properties.value); + } + + @Override + public int hashCode() { + return Objects.hash(key, value); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Properties {\n"); + + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSProviderList.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSProviderList.java new file mode 100644 index 00000000000..fd8830ed66e --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSProviderList.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model; + +import java.util.ArrayList; +import java.util.Objects; + +/** + * SMSProviderList + */ +public class SMSProviderList extends ArrayList { + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SMSProviderList {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSender.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSender.java new file mode 100644 index 00000000000..3cd3b0d6a0e --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSender.java @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * SMSSender + */ +public class SMSSender { + @SerializedName("name") + private String name = null; + + @SerializedName("provider") + private String provider = null; + + @SerializedName("providerURL") + private String providerURL = null; + + @SerializedName("key") + private String key = null; + + @SerializedName("secret") + private String secret = null; + + @SerializedName("sender") + private String sender = null; + + /** + * Gets or Sets contentType + */ + @JsonAdapter(ContentTypeEnum.Adapter.class) + public enum ContentTypeEnum { + @SerializedName("JSON") + JSON("JSON"), + @SerializedName("FORM") + FORM("FORM"); + + private String value; + + ContentTypeEnum(String value) { + this.value = value; + } + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + public static ContentTypeEnum fromValue(String input) { + for (ContentTypeEnum b : ContentTypeEnum.values()) { + if (b.value.equals(input)) { + return b; + } + } + return null; + } + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { + jsonWriter.value(String.valueOf(enumeration.getValue())); + } + + @Override + public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { + Object value = jsonReader.nextString(); + return ContentTypeEnum.fromValue((String)(value)); + } + } + } @SerializedName("contentType") + private ContentTypeEnum contentType = null; + + @SerializedName("properties") + private List properties = null; + + public SMSSender name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Schema(example = "SMSPublisher", required = true, description = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public SMSSender provider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get provider + * @return provider + **/ + @Schema(example = "NEXMO", required = true, description = "") + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public SMSSender providerURL(String providerURL) { + this.providerURL = providerURL; + return this; + } + + /** + * Get providerURL + * @return providerURL + **/ + @Schema(example = "https://rest.nexmo.com/sms/json", required = true, description = "") + public String getProviderURL() { + return providerURL; + } + + public void setProviderURL(String providerURL) { + this.providerURL = providerURL; + } + + public SMSSender key(String key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + **/ + @Schema(example = "123**45", description = "") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public SMSSender secret(String secret) { + this.secret = secret; + return this; + } + + /** + * Get secret + * @return secret + **/ + @Schema(example = "5tg**ssd", description = "") + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public SMSSender sender(String sender) { + this.sender = sender; + return this; + } + + /** + * Get sender + * @return sender + **/ + @Schema(example = "+94 775563324", description = "") + public String getSender() { + return sender; + } + + public void setSender(String sender) { + this.sender = sender; + } + + public SMSSender contentType(ContentTypeEnum contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get contentType + * @return contentType + **/ + @Schema(required = true, description = "") + public ContentTypeEnum getContentType() { + return contentType; + } + + public void setContentType(ContentTypeEnum contentType) { + this.contentType = contentType; + } + + public SMSSender properties(List properties) { + this.properties = properties; + return this; + } + + public SMSSender addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); + } + this.properties.add(propertiesItem); + return this; + } + + /** + * Get properties + * @return properties + **/ + @Schema(example = "[{\"key\":\"body.scope\",\"value\":\"internal\"},{\"key\":\"http.headers\",\"value\":\"X-Version: 1, Authorization: bearer ,Accept: application/json ,Content-Type: application/json\"}]", description = "") + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SMSSender smSSender = (SMSSender) o; + return Objects.equals(this.name, smSSender.name) && + Objects.equals(this.provider, smSSender.provider) && + Objects.equals(this.providerURL, smSSender.providerURL) && + Objects.equals(this.key, smSSender.key) && + Objects.equals(this.secret, smSSender.secret) && + Objects.equals(this.sender, smSSender.sender) && + Objects.equals(this.contentType, smSSender.contentType) && + Objects.equals(this.properties, smSSender.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, provider, providerURL, key, secret, sender, contentType, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SMSSender {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" providerURL: ").append(toIndentedString(providerURL)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderAdd.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderAdd.java new file mode 100644 index 00000000000..0765fd76a0b --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderAdd.java @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * SMSSenderAdd + */ +public class SMSSenderAdd { + @SerializedName("name") + private String name = null; + + @SerializedName("provider") + private String provider = null; + + @SerializedName("providerURL") + private String providerURL = null; + + @SerializedName("key") + private String key = null; + + @SerializedName("secret") + private String secret = null; + + @SerializedName("sender") + private String sender = null; + + /** + * Gets or Sets contentType + */ + @JsonAdapter(ContentTypeEnum.Adapter.class) + public enum ContentTypeEnum { + @SerializedName("JSON") + JSON("JSON"), + @SerializedName("FORM") + FORM("FORM"); + + private String value; + + ContentTypeEnum(String value) { + this.value = value; + } + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + public static ContentTypeEnum fromValue(String input) { + for (ContentTypeEnum b : ContentTypeEnum.values()) { + if (b.value.equals(input)) { + return b; + } + } + return null; + } + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { + jsonWriter.value(String.valueOf(enumeration.getValue())); + } + + @Override + public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { + Object value = jsonReader.nextString(); + return ContentTypeEnum.fromValue((String)(value)); + } + } + } @SerializedName("contentType") + private ContentTypeEnum contentType = null; + + @SerializedName("properties") + private List properties = null; + + public SMSSenderAdd name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @Schema(example = "SMSPublisher", description = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public SMSSenderAdd provider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get provider + * @return provider + **/ + @Schema(example = "NEXMO", required = true, description = "") + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public SMSSenderAdd providerURL(String providerURL) { + this.providerURL = providerURL; + return this; + } + + /** + * Get providerURL + * @return providerURL + **/ + @Schema(example = "https://rest.nexmo.com/sms/json", required = true, description = "") + public String getProviderURL() { + return providerURL; + } + + public void setProviderURL(String providerURL) { + this.providerURL = providerURL; + } + + public SMSSenderAdd key(String key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + **/ + @Schema(example = "123**45", description = "") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public SMSSenderAdd secret(String secret) { + this.secret = secret; + return this; + } + + /** + * Get secret + * @return secret + **/ + @Schema(example = "5tg**ssd", description = "") + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public SMSSenderAdd sender(String sender) { + this.sender = sender; + return this; + } + + /** + * Get sender + * @return sender + **/ + @Schema(example = "+94 775563324", description = "") + public String getSender() { + return sender; + } + + public void setSender(String sender) { + this.sender = sender; + } + + public SMSSenderAdd contentType(ContentTypeEnum contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get contentType + * @return contentType + **/ + @Schema(required = true, description = "") + public ContentTypeEnum getContentType() { + return contentType; + } + + public void setContentType(ContentTypeEnum contentType) { + this.contentType = contentType; + } + + public SMSSenderAdd properties(List properties) { + this.properties = properties; + return this; + } + + public SMSSenderAdd addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); + } + this.properties.add(propertiesItem); + return this; + } + + /** + * Get properties + * @return properties + **/ + @Schema(example = "[{\"key\":\"http.headers\",\"value\":\"X-Version: 1, Authorization: bearer ,Accept: application/json ,Content-Type: application/json\"}]", description = "") + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SMSSenderAdd smSSenderAdd = (SMSSenderAdd) o; + return Objects.equals(this.name, smSSenderAdd.name) && + Objects.equals(this.provider, smSSenderAdd.provider) && + Objects.equals(this.providerURL, smSSenderAdd.providerURL) && + Objects.equals(this.key, smSSenderAdd.key) && + Objects.equals(this.secret, smSSenderAdd.secret) && + Objects.equals(this.sender, smSSenderAdd.sender) && + Objects.equals(this.contentType, smSSenderAdd.contentType) && + Objects.equals(this.properties, smSSenderAdd.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, provider, providerURL, key, secret, sender, contentType, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SMSSenderAdd {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" providerURL: ").append(toIndentedString(providerURL)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderUpdateRequest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderUpdateRequest.java new file mode 100644 index 00000000000..4e00bca7aec --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderUpdateRequest.java @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.v3.oas.annotations.media.Schema; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * SMSSenderUpdateRequest + */ +public class SMSSenderUpdateRequest { + @SerializedName("provider") + private String provider = null; + + @SerializedName("providerURL") + private String providerURL = null; + + @SerializedName("key") + private String key = null; + + @SerializedName("secret") + private String secret = null; + + @SerializedName("sender") + private String sender = null; + + /** + * Gets or Sets contentType + */ + @JsonAdapter(ContentTypeEnum.Adapter.class) + public enum ContentTypeEnum { + @SerializedName("JSON") + JSON("JSON"), + @SerializedName("FORM") + FORM("FORM"); + + private String value; + + ContentTypeEnum(String value) { + this.value = value; + } + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + public static ContentTypeEnum fromValue(String input) { + for (ContentTypeEnum b : ContentTypeEnum.values()) { + if (b.value.equals(input)) { + return b; + } + } + return null; + } + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { + jsonWriter.value(String.valueOf(enumeration.getValue())); + } + + @Override + public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { + Object value = jsonReader.nextString(); + return ContentTypeEnum.fromValue((String)(value)); + } + } + } @SerializedName("contentType") + private ContentTypeEnum contentType = null; + + @SerializedName("properties") + private List properties = null; + + public SMSSenderUpdateRequest provider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get provider + * @return provider + **/ + @Schema(example = "NEXMO", required = true, description = "") + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public SMSSenderUpdateRequest providerURL(String providerURL) { + this.providerURL = providerURL; + return this; + } + + /** + * Get providerURL + * @return providerURL + **/ + @Schema(example = "https://rest.nexmo.com/sms/json", required = true, description = "") + public String getProviderURL() { + return providerURL; + } + + public void setProviderURL(String providerURL) { + this.providerURL = providerURL; + } + + public SMSSenderUpdateRequest key(String key) { + this.key = key; + return this; + } + + /** + * Get key + * @return key + **/ + @Schema(example = "123**45", description = "") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public SMSSenderUpdateRequest secret(String secret) { + this.secret = secret; + return this; + } + + /** + * Get secret + * @return secret + **/ + @Schema(example = "5tg**ssd", description = "") + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public SMSSenderUpdateRequest sender(String sender) { + this.sender = sender; + return this; + } + + /** + * Get sender + * @return sender + **/ + @Schema(example = "+94 775563324", description = "") + public String getSender() { + return sender; + } + + public void setSender(String sender) { + this.sender = sender; + } + + public SMSSenderUpdateRequest contentType(ContentTypeEnum contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get contentType + * @return contentType + **/ + @Schema(required = true, description = "") + public ContentTypeEnum getContentType() { + return contentType; + } + + public void setContentType(ContentTypeEnum contentType) { + this.contentType = contentType; + } + + public SMSSenderUpdateRequest properties(List properties) { + this.properties = properties; + return this; + } + + public SMSSenderUpdateRequest addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); + } + this.properties.add(propertiesItem); + return this; + } + + /** + * Get properties + * @return properties + **/ + @Schema(example = "[{\"key\":\"http.headers\",\"value\":\"X-Version: 1, Authorization: bearer ,Accept: application/json ,Content-Type: application/json\"}]", description = "") + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SMSSenderUpdateRequest smSSenderUpdateRequest = (SMSSenderUpdateRequest) o; + return Objects.equals(this.provider, smSSenderUpdateRequest.provider) && + Objects.equals(this.providerURL, smSSenderUpdateRequest.providerURL) && + Objects.equals(this.key, smSSenderUpdateRequest.key) && + Objects.equals(this.secret, smSSenderUpdateRequest.secret) && + Objects.equals(this.sender, smSSenderUpdateRequest.sender) && + Objects.equals(this.contentType, smSSenderUpdateRequest.contentType) && + Objects.equals(this.properties, smSSenderUpdateRequest.properties); + } + + @Override + public int hashCode() { + return Objects.hash(provider, providerURL, key, secret, sender, contentType, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SMSSenderUpdateRequest {\n"); + + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" providerURL: ").append(toIndentedString(providerURL)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java new file mode 100644 index 00000000000..5cfe436cfea --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.identity.integration.test.rest.api.user.common.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.Valid; +import java.util.Objects; + +public class PhoneNumbers { + + private String type; + private String value; + + /** + * + **/ + public PhoneNumbers type(String type) { + + this.type = type; + return this; + } + + @ApiModelProperty(example = "mobile") + @JsonProperty("type") + @Valid + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + /** + * + **/ + public PhoneNumbers value(String value) { + + this.value = value; + return this; + } + + @ApiModelProperty(example = "1111111111") + @JsonProperty("value") + @Valid + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public boolean equals(Object o) { + + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PhoneNumbers email = (PhoneNumbers) o; + return Objects.equals(this.type, email.type) && + Objects.equals(this.value, email.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + + return "class Email {\n" + + " type: " + toIndentedString(type) + "\n" + + " value: " + toIndentedString(value) + "\n" + + "}"; + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + + if (o == null) { + return "null"; + } + return o.toString(); + } +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/UserObject.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/UserObject.java index 843e136e136..a1ee9c75e19 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/UserObject.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/UserObject.java @@ -33,6 +33,7 @@ public class UserObject { private String userName; private String password; private List emails = null; + private List phoneNumbers = null; private String locale; private ScimSchemaExtensionEnterprise scimSchemaExtensionEnterprise; @@ -144,6 +145,34 @@ public UserObject addEmail(Email email) { return this; } + /** + * + **/ + public UserObject phoneNumbers(List phoneNumbers) { + + this.phoneNumbers = phoneNumbers; + return this; + } + + @ApiModelProperty() + @JsonProperty("phoneNumbers") + @Valid + public List getPhoneNumbers() { + return phoneNumbers; + } + + public void setPhoneNumbers(List phoneNumbers) { + this.phoneNumbers = phoneNumbers; + } + + public UserObject addPhoneNumbers(PhoneNumbers phoneNumbers) { + if (this.phoneNumbers == null) { + this.phoneNumbers = new ArrayList<>(); + } + this.phoneNumbers.add(phoneNumbers); + return this; + } + /** * **/ diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/restclients/NotificationSenderRestClient.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/restclients/NotificationSenderRestClient.java new file mode 100644 index 00000000000..985849419f6 --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/restclients/NotificationSenderRestClient.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.identity.integration.test.restclients; + +import io.restassured.http.ContentType; +import org.apache.commons.codec.binary.Base64; +import org.apache.http.Header; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.message.BasicHeader; +import org.testng.Assert; +import org.wso2.carbon.automation.engine.context.beans.Tenant; +import org.wso2.carbon.utils.multitenancy.MultitenantConstants; +import org.wso2.identity.integration.test.rest.api.server.notification.sender.v1.model.SMSSender; +import org.wso2.identity.integration.test.utils.OAuth2Constant; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * Rest client for Notification Sender configurations. + */ +public class NotificationSenderRestClient extends RestBaseClient { + + private static final String NOTIFICATION_SENDER_SMS_ENDPOINT = "api/server/v1/notification-senders/sms"; + private final String serverUrl; + private final String tenantDomain; + private final String username; + private final String password; + + public NotificationSenderRestClient(String serverUrl, Tenant tenantInfo){ + + this.serverUrl = serverUrl; + this.tenantDomain = tenantInfo.getContextUser().getUserDomain(); + this.username = tenantInfo.getContextUser().getUserName(); + this.password = tenantInfo.getContextUser().getPassword(); + } + + /** + * Create SMS Sender. + * + * @param smsSender SMS sender details. + * @throws Exception If an error occurred while creating the SMS sender. + */ + public void createSMSProvider(SMSSender smsSender) throws Exception { + + String jsonRequest = toJSONString(smsSender); + + try (CloseableHttpResponse response = getResponseOfHttpPost(getSMSSenderPath(), jsonRequest, getHeaders())) { + Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpServletResponse.SC_CREATED, + "Notification sender creation failed"); + } + } + + /** + * Delete SMS Sender. + * + * @throws Exception If an error occurred while creating the SMS sender. + */ + public void deleteSMSProvider() throws Exception { + + try (CloseableHttpResponse response = getResponseOfHttpDelete(getSMSSenderPath() + "/SMSPublisher", + getHeaders())) { + Assert.assertEquals(response.getStatusLine().getStatusCode(), HttpServletResponse.SC_NO_CONTENT, + "Notification sender deletion failed"); + } + } + + private Header[] getHeaders() { + + Header[] headerList = new Header[3]; + headerList[0] = new BasicHeader(USER_AGENT_ATTRIBUTE, OAuth2Constant.USER_AGENT); + headerList[1] = new BasicHeader(AUTHORIZATION_ATTRIBUTE, BASIC_AUTHORIZATION_ATTRIBUTE + + Base64.encodeBase64String((username + ":" + password).getBytes()).trim()); + headerList[2] = new BasicHeader(CONTENT_TYPE_ATTRIBUTE, String.valueOf(ContentType.JSON)); + + return headerList; + } + + private String getSMSSenderPath() { + + if (tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) { + return serverUrl + NOTIFICATION_SENDER_SMS_ENDPOINT; + } else { + return serverUrl + TENANT_PATH + tenantDomain + PATH_SEPARATOR + NOTIFICATION_SENDER_SMS_ENDPOINT; + } + } + + /** + * Close the HTTP client. + * + * @throws IOException If an error occurred while closing the Http Client. + */ + public void closeHttpClient() throws IOException { + + client.close(); + } +} diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml index e6273bb978a..1ae74db335e 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml @@ -147,6 +147,7 @@ + From c39bb7375fef0e5307fac20c1b0bbfa64908cfa8 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Tue, 12 Nov 2024 12:27:10 +0530 Subject: [PATCH 02/32] Update the actions --- .github/workflows/dependency-updater-7.yml | 161 ------------------ .github/workflows/dependency-updater.yml | 6 +- .../workflows/fapi-oidc-conformance-test.yml | 6 +- .github/workflows/fork-branch-deleter.yml | 2 +- .github/workflows/fossa-scanner.yaml | 2 +- .github/workflows/migration-automation.yml | 14 +- .github/workflows/oidc-conformance-test.yml | 6 +- .github/workflows/pr-builder-test-JDK11-7.yml | 130 -------------- .github/workflows/pr-builder-test-JDK11.yml | 10 +- .../workflows/product-is-builder-jdk17.yml | 6 +- .../workflows/product-is-builder-jdk21.yml | 6 +- 11 files changed, 29 insertions(+), 320 deletions(-) delete mode 100644 .github/workflows/dependency-updater-7.yml delete mode 100644 .github/workflows/pr-builder-test-JDK11-7.yml diff --git a/.github/workflows/dependency-updater-7.yml b/.github/workflows/dependency-updater-7.yml deleted file mode 100644 index 6989aeeef74..00000000000 --- a/.github/workflows/dependency-updater-7.yml +++ /dev/null @@ -1,161 +0,0 @@ -# This workflow will update dependencies for product-is 7.x.x. -name: "[Deprecated] Dependency Updater 7.x.x" -on: - workflow_dispatch: - # schedule: - # Everyday at 15:30 UTC (9.00 PM SL time) - # - cron: '30 15 * * *' - -env: - MAVEN_OPTS: -Xmx4g -Xms1g - REPOSITORY: product-is - GIT_USERNAME: jenkins-is-staging - GIT_EMAIL: jenkins-is-staging@wso2.com - PRODUCT_REPOSITORY_FORKED: $GIT_USERNAME'/'${REPOSITORY} - REMOTE_PRODUCT_REPOSITORY_PUBLIC: wso2/$REPOSITORY - PRODUCT_REPOSITORY_PUBLIC: wso2/$REPOSITORY - BUILD_NUMBER: ${{github.run_id}} - DEPENDENCY_UPGRADE_BRANCH_NAME: IS_dependency_updater_7.x.x_github_action/$BUILD_NUMBER - PR: "https://github.com/wso2/product-is/pulls" - TARGET_BRANCH_NAME: 7.x.x - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Adopt JDK 11 - uses: actions/setup-java@v2 - with: - java-version: "11" - distribution: "adopt" - - name: Check $JAVA_HOME - run: | - echo $JAVA_HOME - - name: Cache local Maven repository - id: cache-maven-m2 - uses: actions/cache@v2 - env: - cache-name: cache-m2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven-${{ env.cache-name }}- - ${{ runner.os }}-maven- - ${{ runner.os }}- - - name: Update Dependencies - id: builder_step - run: | - echo "::set-output name=REPO_NAME::${{ env.REPOSITORY }}" - echo "" - echo "Starting dependency upgrade" - echo "==========================================================" - echo "" - echo "Clean up any existing files" - echo "==========================================================" - rm -rf ${{ env.REPOSITORY }} - echo "" - echo "Cloning: https://github.com/'${{ env.PRODUCT_REPOSITORY_FORKED }}" - echo "==========================================================" - git clone 'https://github.com/'${{ env.PRODUCT_REPOSITORY_FORKED }}'.git' - cd ${{ env.REPOSITORY }} - echo "" - echo 'Add remote: '${{ env.REMOTE_PRODUCT_REPOSITORY_PUBLIC }} 'as https://github.com/'${{ env.PRODUCT_REPOSITORY_PUBLIC }} - echo "==========================================================" - git remote add ${{ env.REMOTE_PRODUCT_REPOSITORY_PUBLIC }} 'https://@github.com/'${{ env.PRODUCT_REPOSITORY_PUBLIC }} - echo "" - echo 'Fetching:' ${{ env.REMOTE_PRODUCT_REPOSITORY_PUBLIC }} - echo "==========================================================" - git fetch ${{ env.REMOTE_PRODUCT_REPOSITORY_PUBLIC }} - echo "" - echo 'Checking out:' ${{ env.REMOTE_PRODUCT_REPOSITORY_PUBLIC }} ${{ env.TARGET_BRANCH_NAME }} 'branch' - echo "==========================================================" - git checkout -b ${{ env.DEPENDENCY_UPGRADE_BRANCH_NAME }} ${{ env.REMOTE_PRODUCT_REPOSITORY_PUBLIC }}'/'${{ env.TARGET_BRANCH_NAME }} - - echo "" - echo 'Updating dependencies' - echo "==========================================================" - mvn versions:update-properties -U -DgenerateBackupPoms=false -DallowMajorUpdates=false -Dincludes=org.wso2.carbon.identity.*,org.wso2.carbon.extension.identity.*,org.wso2.identity.*,org.wso2.carbon.consent.*,org.wso2.carbon.healthcheck.*,org.wso2.carbon.utils,org.wso2.charon,org.apache.rampart.wso2,org.apache.ws.security.wso2 - echo "" - echo 'Available updates' - echo "==========================================================" - git diff --color > dependency_updates.diff - cat dependency_updates.diff - - echo "" - echo 'Build' - echo "==========================================================" - mvn clean install -Dmaven.test.failure.ignore=false | tee mvn-build.log - PR_BUILD_STATUS=$(cat mvn-build.log | grep "\[INFO\] BUILD" | grep -oE '[^ ]+$') - PR_TEST_RESULT=$(sed -n -e '/\[INFO\] Results:/,/\[INFO\] Tests run:/ p' mvn-build.log) - PR_BUILD_FINAL_RESULT=$( - echo "===========================================================" - echo "product-is BUILD $PR_BUILD_STATUS" - echo "==========================================================" - echo "" - echo "$PR_TEST_RESULT" - ) - PR_BUILD_RESULT_LOG_TEMP=$(echo "$PR_BUILD_FINAL_RESULT" | sed 's/$/%0A/') - PR_BUILD_RESULT_LOG=$(echo $PR_BUILD_RESULT_LOG_TEMP) - echo "::warning::$PR_BUILD_RESULT_LOG" - PR_BUILD_SUCCESS_COUNT=$(grep -o -i "\[INFO\] BUILD SUCCESS" mvn-build.log | wc -l) - if [ "$PR_BUILD_SUCCESS_COUNT" != "1" ]; then - echo "PR BUILD not successfull. Aborting." - echo "::error::PR BUILD not successfull. Check artifacts for logs." - exit 1 - fi - - if [ -s dependency_updates.diff ] - then - echo "" - echo 'Commit Changes' - echo "==========================================================" - git config --global user.email ${{ env.GIT_EMAIL }} - git config --global user.name ${{ env.GIT_USERNAME }} - git commit -a -m 'Bump dependencies from '${{ env.DEPENDENCY_UPGRADE_BRANCH_NAME }} - git remote rm origin - git remote add origin 'https://'${{ secrets.PAT }}'@github.com/'${{ env.PRODUCT_REPOSITORY_FORKED }} - - echo "" - echo 'Push Changes' - echo "==========================================================" - git push -u origin ${{ env.DEPENDENCY_UPGRADE_BRANCH_NAME }} - - echo "" - echo 'Send Pull Request' - echo "==========================================================" - - TITLE="[7.x.x] Bump Dependencies #"${{ env.BUILD_NUMBER }} - RESPONSE=$(curl -s -w "%{http_code}" -k -X \ - POST https://api.github.com/repos/${{ env.PRODUCT_REPOSITORY_PUBLIC }}/pulls \ - -H "Authorization: Bearer "${{ secrets.PAT }}"" \ - -H "Content-Type: application/json" \ - -d '{ "title": "'"${TITLE}"'","body": "Bumps dependencies for product-is. Link : https://github.com/wso2/product-is/actions/runs/${{github.run_id}}","head": "'"${{ env.GIT_USERNAME }}:${{ env.DEPENDENCY_UPGRADE_BRANCH_NAME }}"'","base":"'"${{ env.TARGET_BRANCH_NAME }}"'"}') - RESPONSE_BODY=${RESPONSE::-3} - STATUS=$(printf "%s" "$RESPONSE" | tail -c 3) - if [[ $STATUS == "201" ]]; then - echo "PR=$(echo $RESPONSE_BODY | jq -r '.html_url')" >> $GITHUB_ENV - fi - else - echo "" - echo "There are no dependency updates available" - echo "==========================================================" - exit 0 - fi - - name: Archive dependency diff file - if: always() - uses: actions/upload-artifact@v4 - with: - name: dependency-updates-diff - path: | - ${{steps.builder_step.outputs.REPO_NAME}}/dependency_updates.diff - - name: Archive maven-build-log file - if: always() - uses: actions/upload-artifact@v4 - with: - name: mvn-build.log - path: | - ${{steps.builder_step.outputs.REPO_NAME}}/mvn-build.log - if-no-files-found: warn diff --git a/.github/workflows/dependency-updater.yml b/.github/workflows/dependency-updater.yml index 284ac65fe0a..a76d7e2e3fa 100644 --- a/.github/workflows/dependency-updater.yml +++ b/.github/workflows/dependency-updater.yml @@ -26,9 +26,9 @@ jobs: JAVA_TOOL_OPTIONS: "-Djdk.util.zip.disableZip64ExtraFieldValidation=true -Djdk.nio.zipfs.allowDotZipEntry=true" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Adopt JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: "11" distribution: "adopt" @@ -37,7 +37,7 @@ jobs: echo $JAVA_HOME - name: Cache local Maven repository id: cache-maven-m2 - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: cache-m2 with: diff --git a/.github/workflows/fapi-oidc-conformance-test.yml b/.github/workflows/fapi-oidc-conformance-test.yml index db67cf415cd..42a499256ae 100644 --- a/.github/workflows/fapi-oidc-conformance-test.yml +++ b/.github/workflows/fapi-oidc-conformance-test.yml @@ -32,12 +32,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: './product-is' - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11.0.18+10 @@ -189,7 +189,7 @@ jobs: python3 ./configure_is_fapi.py ../../$PRODUCT_IS_ZIP - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 17 distribution: temurin diff --git a/.github/workflows/fork-branch-deleter.yml b/.github/workflows/fork-branch-deleter.yml index a6b1e897c69..d6dbcb6c902 100644 --- a/.github/workflows/fork-branch-deleter.yml +++ b/.github/workflows/fork-branch-deleter.yml @@ -13,7 +13,7 @@ jobs: steps: # Check out the product-is fork of 'jenkins-is-staging' user - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.head.repo.full_name }} token: ${{ secrets.PAT }} diff --git a/.github/workflows/fossa-scanner.yaml b/.github/workflows/fossa-scanner.yaml index f735365f733..b735f753f62 100644 --- a/.github/workflows/fossa-scanner.yaml +++ b/.github/workflows/fossa-scanner.yaml @@ -8,7 +8,7 @@ jobs: fossa-scan: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: fossas/fossa-action@main with: api-key: ${{secrets.FOSSAAPIKEY}} diff --git a/.github/workflows/migration-automation.yml b/.github/workflows/migration-automation.yml index eead65a5089..b4d9167c57d 100644 --- a/.github/workflows/migration-automation.yml +++ b/.github/workflows/migration-automation.yml @@ -53,7 +53,7 @@ jobs: runs-on: ${{ github.event.inputs.os }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Setup Docker environment run: | # Get the ID of the workflow from the GitHub API using curl and jq @@ -136,7 +136,7 @@ jobs: runs-on: ${{ github.event.inputs.os }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Execute Migration Automation Script Ubuntu run: | chmod +x ${{ github.workspace }}/.github/migration-tester/migration-automation/ubuntu-os/migration-script-ubuntu.sh @@ -172,7 +172,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Create MS SQL Database run: | @@ -215,7 +215,7 @@ jobs: runs-on: ${{ github.event.inputs.os }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Execute Migration Automation Script Mac run: | @@ -240,7 +240,7 @@ jobs: if: ${{ github.event.inputs.database == 'postgres' && github.event.inputs.os == 'macos-latest' }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up PostgreSQL env: PGDATA: /usr/local/var/postgres @@ -287,7 +287,7 @@ jobs: runs-on: ${{ github.event.inputs.os }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - uses: potatoqualitee/mssqlsuite@v1.7 with: @@ -344,7 +344,7 @@ jobs: runs-on: ${{ github.event.inputs.os }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Download Artifacts uses: actions/download-artifact@v2 if: always() diff --git a/.github/workflows/oidc-conformance-test.yml b/.github/workflows/oidc-conformance-test.yml index e6391ced686..99b593f09ae 100644 --- a/.github/workflows/oidc-conformance-test.yml +++ b/.github/workflows/oidc-conformance-test.yml @@ -36,12 +36,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: path: './product-is' - name: Set up JDK 11 - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: java-version: 11.0.18+10 @@ -142,7 +142,7 @@ jobs: python3 ./configure_is.py ../../$PRODUCT_IS_ZIP $ROOT_DIR $ROOT_DIR/jacoco.exec - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 17 distribution: temurin diff --git a/.github/workflows/pr-builder-test-JDK11-7.yml b/.github/workflows/pr-builder-test-JDK11-7.yml deleted file mode 100644 index 75aab52ac5c..00000000000 --- a/.github/workflows/pr-builder-test-JDK11-7.yml +++ /dev/null @@ -1,130 +0,0 @@ -name: "[Deprecated] pr-builder-test 7.x.x" - -on: - workflow_dispatch: - inputs: - pr: - description: "Enter PR link (ex: https://github.com/wso2-extensions/identity-inbound-auth-oauth/pull/1481)" - default: - required: true - jdk: - description: "Enter Java version (ex: 8,11)" - default: - required: true - -env: - MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 - - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Print Input - run: echo Running the PR builder for PR - ${{ github.event.inputs.pr }} - - name: Comment build info - run: | - owner=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 4) - repo=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 5) - pr_number=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 7) - curl -X POST https://api.github.com/repos/$owner/$repo/issues/$pr_number/comments -H 'Authorization: token ${{secrets.PR_BUILDER_COMMENT}}' -d '{"body":"PR builder [7.x.x] started \nLink: https://github.com/wso2/product-is/actions/runs/${{github.run_id}}"}' - - uses: actions/checkout@v2 - - name: Set up Adopt JDK 8 - uses: actions/setup-java@v2 - with: - java-version: "8" - distribution: "adopt" - - name: Echo java 8 home - run: | - echo "J8HOME=$JAVA_HOME" >> ${GITHUB_ENV} - id: java-8-setup - - name: Set up Adopt JDK 11 - uses: actions/setup-java@v2 - with: - java-version: "11" - distribution: "adopt" - - name: Echo java 11 home - run: | - echo "J11HOME=$JAVA_HOME" >> ${GITHUB_ENV} - - name: Build init - run: | - echo "CURRENT_MONTH=$(date +%Y-%m)" >> ${GITHUB_ENV} - - name: Cache maven packages - id: cache-maven-m2 - uses: actions/cache@v2 - with: - path: | - ~/.m2 - !~/.m2/repository/org/wso2/is/wso2is - key: ${{ runner.os }}-pr-builder-${{ env.CURRENT_MONTH }} - - name: Setup pnpm - id: setup-pnpm - uses: pnpm/action-setup@v2.1.0 - with: - version: latest - run_install: false - - name: Run PR builder - id: builder_step - env: - PR_LINK: ${{github.event.inputs.pr}} - JDK_VERSION: ${{github.event.inputs.jdk}} - JAVA_8_HOME: ${{env.J8HOME}} - JAVA_11_HOME: ${{env.J11HOME}} - run: | - wget https://raw.githubusercontent.com/wso2/product-is/master/.github/scripts/pr-builder-7.sh - bash pr-builder-7.sh - - name: Archive PR diff file - if: always() - uses: actions/upload-artifact@v4 - with: - name: repo-pr-diff - path: | - ${{steps.builder_step.outputs.REPO_NAME}}/diff.diff - if-no-files-found: warn - - name: Archive repo mvn build log - if: always() && steps.builder_step.outputs.REPO_NAME != 'product-is' - uses: actions/upload-artifact@v4 - with: - name: repo-mvn-build-log - path: | - ${{steps.builder_step.outputs.REPO_NAME}}/mvn-build.log - if-no-files-found: warn - - name: Archive repo surefire reports - if: always() && steps.builder_step.outputs.REPO_NAME != 'product-is' - uses: actions/upload-artifact@v4 - with: - name: repo-surefire-report - path: | - ${{steps.builder_step.outputs.REPO_NAME}}/**/surefire-reports - if-no-files-found: warn - - name: Archive product-is mvn build log - if: always() - uses: actions/upload-artifact@v4 - with: - name: product-is-mvn-build-log - path: | - product-is/mvn-build.log - if-no-files-found: warn - - name: Archive product-is surefire reports - if: always() - uses: actions/upload-artifact@v4 - with: - name: product-is-surefire-report - path: | - product-is/**/surefire-reports - if-no-files-found: warn - - name: Comment build status - if: always() - run: | - owner=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 4) - repo=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 5) - pr_number=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 7) - curl -X POST https://api.github.com/repos/$owner/$repo/issues/$pr_number/comments -H 'Authorization: token ${{secrets.PR_BUILDER_COMMENT}}' -d '{"body":"PR builder [7.x.x] completed \nLink: https://github.com/wso2/product-is/actions/runs/${{github.run_id}} \nStatus: **${{job.status}}**"}' - - name: Approve PR - if: success() - run: | - owner=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 4) - repo=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 5) - pr_number=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 7) - curl -X POST https://api.github.com/repos/$owner/$repo/pulls/$pr_number/reviews -H 'Authorization:token ${{secrets.PR_BUILDER_COMMENT}}' -d '{"body":"Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/${{github.run_id}}","event":"APPROVE"}' diff --git a/.github/workflows/pr-builder-test-JDK11.yml b/.github/workflows/pr-builder-test-JDK11.yml index 8dba76647fc..b043b577461 100644 --- a/.github/workflows/pr-builder-test-JDK11.yml +++ b/.github/workflows/pr-builder-test-JDK11.yml @@ -32,9 +32,9 @@ jobs: repo=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 5) pr_number=$(echo '${{github.event.inputs.pr}}' | cut -d "/" -f 7) curl -X POST https://api.github.com/repos/$owner/$repo/issues/$pr_number/comments -H 'Authorization: token ${{secrets.PR_BUILDER_COMMENT}}' -d '{"body":"PR builder started \nLink: https://github.com/wso2/product-is/actions/runs/${{github.run_id}}"}' - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Adopt JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: "8" distribution: "adopt" @@ -43,7 +43,7 @@ jobs: echo "J8HOME=$JAVA_HOME" >> ${GITHUB_ENV} id: java-8-setup - name: Set up Adopt JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: "11" distribution: "adopt" @@ -55,7 +55,7 @@ jobs: echo "CURRENT_MONTH=$(date +%Y-%m)" >> ${GITHUB_ENV} - name: Cache maven packages id: cache-maven-m2 - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.m2 @@ -63,7 +63,7 @@ jobs: key: ${{ runner.os }}-pr-builder-${{ env.CURRENT_MONTH }} - name: Setup pnpm id: setup-pnpm - uses: pnpm/action-setup@v2.1.0 + uses: pnpm/action-setup@v4 with: version: latest run_install: false diff --git a/.github/workflows/product-is-builder-jdk17.yml b/.github/workflows/product-is-builder-jdk17.yml index c94a139c99d..5ab1355da9d 100644 --- a/.github/workflows/product-is-builder-jdk17.yml +++ b/.github/workflows/product-is-builder-jdk17.yml @@ -20,9 +20,9 @@ jobs: steps: - name: Checkout repository code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Adopt JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: "11" distribution: "adopt" @@ -30,7 +30,7 @@ jobs: run: | mvn clean install --batch-mode -Dmaven.test.skip=true | tee mvn-build.log - name: Set up Adopt JDK 17 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: "17" distribution: "adopt" diff --git a/.github/workflows/product-is-builder-jdk21.yml b/.github/workflows/product-is-builder-jdk21.yml index 632f0b71100..772a3331918 100644 --- a/.github/workflows/product-is-builder-jdk21.yml +++ b/.github/workflows/product-is-builder-jdk21.yml @@ -20,9 +20,9 @@ jobs: steps: - name: Checkout repository code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Adopt JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: "11" distribution: "adopt" @@ -30,7 +30,7 @@ jobs: run: | mvn clean install --batch-mode -Dmaven.test.skip=true | tee mvn-build.log - name: Set up Adopt JDK 21 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: "21" distribution: "adopt" From dadbdd2ce242e3440b053b21d24c414683127633 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Tue, 12 Nov 2024 14:17:11 +0530 Subject: [PATCH 03/32] Update the formatting --- .../auth/PasswordlessSMSOTPAuthTestCase.java | 38 +- .../sender/v1/model/EmailProviderList.java | 63 ++- .../sender/v1/model/EmailSender.java | 421 +++++++------- .../sender/v1/model/EmailSenderAdd.java | 421 +++++++------- .../v1/model/EmailSenderUpdateRequest.java | 374 ++++++------- .../notification/sender/v1/model/Error.java | 262 ++++----- .../sender/v1/model/Properties.java | 162 +++--- .../sender/v1/model/SMSProviderList.java | 62 +-- .../sender/v1/model/SMSSender.java | 521 +++++++++--------- .../sender/v1/model/SMSSenderAdd.java | 521 +++++++++--------- .../v1/model/SMSSenderUpdateRequest.java | 476 ++++++++-------- .../api/user/common/model/PhoneNumbers.java | 6 - 12 files changed, 1685 insertions(+), 1642 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java index f338dd67b6d..9b2232048b6 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java @@ -73,6 +73,9 @@ import static org.wso2.identity.integration.test.utils.OAuth2Constant.AUTHORIZE_ENDPOINT_URL; import static org.wso2.identity.integration.test.utils.OAuth2Constant.OAUTH2_GRANT_TYPE_AUTHORIZATION_CODE; +/** + * This class includes the test cases for passwordless SMS OTP authentication. + */ public class PasswordlessSMSOTPAuthTestCase extends OIDCAbstractIntegrationTest { public static final String USERNAME = "passwordlessuser"; @@ -164,12 +167,14 @@ public void atEnd() throws Exception { deleteApplication(oidcApplication); deleteUser(userObject); notificationSenderRestClient.deleteSMSProvider(); + notificationSenderRestClient.closeHttpClient(); + restClient.closeHttpClient(); + scim2RestClient.closeHttpClient(); mockSMSProvider.stop(); } - @Test(groups = "wso2.is", description = "Verify token response when pre-issue access token action fails with " + - "authorization code grant type.") + @Test(groups = "wso2.is", description = "Test passwordless autehtncation with SMS OTP") public void testPasswordlessAuthentication() throws Exception { sendAuthorizeRequest(); @@ -208,7 +213,7 @@ private void sendAuthorizeRequest() throws Exception { EntityUtils.consume(response.getEntity()); } - public void performUserLogin() throws Exception { + private void performUserLogin() throws Exception { sendLoginPostForIdentifier(client, sessionDataKey, userObject.getUserName()); HttpResponse response = sendLoginPostForOtp(client, sessionDataKey, mockSMSProvider.getOTP()); @@ -226,17 +231,8 @@ public void performUserLogin() throws Exception { assertNotNull(authorizationCode); } - /** - * Send identifier login post request with given username. - * - * @param client Http client. - * @param sessionDataKey Session data key. - * @param username Username. - * @throws ClientProtocolException If an error occurred while executing login post request. - * @throws IOException If an error occurred while executing login post request. - */ - public void sendLoginPostForIdentifier(HttpClient client, String sessionDataKey, String username) - throws ClientProtocolException, IOException { + private void sendLoginPostForIdentifier(HttpClient client, String sessionDataKey, String username) + throws IOException { List urlParameters = new ArrayList<>(); urlParameters.add(new BasicNameValuePair("username", username)); @@ -245,18 +241,8 @@ public void sendLoginPostForIdentifier(HttpClient client, String sessionDataKey, getTenantQualifiedURL(OAuth2Constant.COMMON_AUTH_URL, tenantInfo.getDomain())); } - /** - * Send login post request with given username and otp credentials. - * - * @param client Http client. - * @param sessionDataKey Session data key. - * @param otp Otp. - * @return Http response. - * @throws ClientProtocolException If an error occurred while executing login post request. - * @throws IOException If an error occurred while executing login post request. - */ - public HttpResponse sendLoginPostForOtp(HttpClient client, String sessionDataKey, String otp) - throws ClientProtocolException, IOException { + private HttpResponse sendLoginPostForOtp(HttpClient client, String sessionDataKey, String otp) + throws IOException { List urlParameters = new ArrayList<>(); urlParameters.add(new BasicNameValuePair("OTPcode", otp)); diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailProviderList.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailProviderList.java index 509c67d4ce5..05741cf970c 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailProviderList.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailProviderList.java @@ -22,45 +22,44 @@ import java.util.Objects; /** - * EmailProviderList + * Email Provider List */ public class EmailProviderList extends ArrayList { - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); } - if (o == null || getClass() != o.getClass()) { - return false; - } - return super.equals(o); - } - - @Override - public int hashCode() { - return Objects.hash(super.hashCode()); - } + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EmailProviderList {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append("}"); - return sb.toString(); - } - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailProviderList {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); } - return o.toString().replace("\n", "\n "); - } + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSender.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSender.java index b5411c9edec..3c7dcd0ad16 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSender.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSender.java @@ -26,214 +26,221 @@ import java.util.Objects; /** - * EmailSender + * Email Sender */ public class EmailSender { - @SerializedName("name") - private String name = null; - - @SerializedName("smtpServerHost") - private String smtpServerHost = null; - - @SerializedName("smtpPort") - private Integer smtpPort = null; - - @SerializedName("fromAddress") - private String fromAddress = null; - - @SerializedName("userName") - private String userName = null; - - @SerializedName("password") - private String password = null; - - @SerializedName("properties") - private List properties = null; - - public EmailSender name(String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - **/ - @Schema(example = "EmailPublisher", required = true, description = "") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public EmailSender smtpServerHost(String smtpServerHost) { - this.smtpServerHost = smtpServerHost; - return this; - } - - /** - * Get smtpServerHost - * @return smtpServerHost - **/ - @Schema(example = "smtp.gmail.com", description = "") - public String getSmtpServerHost() { - return smtpServerHost; - } - - public void setSmtpServerHost(String smtpServerHost) { - this.smtpServerHost = smtpServerHost; - } - - public EmailSender smtpPort(Integer smtpPort) { - this.smtpPort = smtpPort; - return this; - } - - /** - * Get smtpPort - * @return smtpPort - **/ - @Schema(example = "587", description = "") - public Integer getSmtpPort() { - return smtpPort; - } - - public void setSmtpPort(Integer smtpPort) { - this.smtpPort = smtpPort; - } - - public EmailSender fromAddress(String fromAddress) { - this.fromAddress = fromAddress; - return this; - } - - /** - * Get fromAddress - * @return fromAddress - **/ - @Schema(example = "iam@gmail.com", required = true, description = "") - public String getFromAddress() { - return fromAddress; - } - - public void setFromAddress(String fromAddress) { - this.fromAddress = fromAddress; - } - - public EmailSender userName(String userName) { - this.userName = userName; - return this; - } - - /** - * Get userName - * @return userName - **/ - @Schema(example = "iam", description = "") - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public EmailSender password(String password) { - this.password = password; - return this; - } - - /** - * Get password - * @return password - **/ - @Schema(example = "iam123", description = "") - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public EmailSender properties(List properties) { - this.properties = properties; - return this; - } - - public EmailSender addPropertiesItem(Properties propertiesItem) { - if (this.properties == null) { - this.properties = new ArrayList(); - } - this.properties.add(propertiesItem); - return this; - } - - /** - * Get properties - * @return properties - **/ - @Schema(example = "[{\"key\":\"mail.smtp.starttls.enable\",\"value\":true}]", description = "") - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EmailSender emailSender = (EmailSender) o; - return Objects.equals(this.name, emailSender.name) && - Objects.equals(this.smtpServerHost, emailSender.smtpServerHost) && - Objects.equals(this.smtpPort, emailSender.smtpPort) && - Objects.equals(this.fromAddress, emailSender.fromAddress) && - Objects.equals(this.userName, emailSender.userName) && - Objects.equals(this.password, emailSender.password) && - Objects.equals(this.properties, emailSender.properties); - } - - @Override - public int hashCode() { - return Objects.hash(name, smtpServerHost, smtpPort, fromAddress, userName, password, properties); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EmailSender {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" smtpServerHost: ").append(toIndentedString(smtpServerHost)).append("\n"); - sb.append(" smtpPort: ").append(toIndentedString(smtpPort)).append("\n"); - sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); - sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); - sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } + @SerializedName("name") + private String name = null; + + @SerializedName("smtpServerHost") + private String smtpServerHost = null; + + @SerializedName("smtpPort") + private Integer smtpPort = null; + + @SerializedName("fromAddress") + private String fromAddress = null; + + @SerializedName("userName") + private String userName = null; + + @SerializedName("password") + private String password = null; + + @SerializedName("properties") + private List properties = null; + + public EmailSender name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + **/ + @Schema(example = "EmailPublisher", required = true, description = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public EmailSender smtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + return this; + } + + /** + * Get smtpServerHost + * + * @return smtpServerHost + **/ + @Schema(example = "smtp.gmail.com", description = "") + public String getSmtpServerHost() { + return smtpServerHost; + } + + public void setSmtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + } + + public EmailSender smtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + return this; + } + + /** + * Get smtpPort + * + * @return smtpPort + **/ + @Schema(example = "587", description = "") + public Integer getSmtpPort() { + return smtpPort; + } + + public void setSmtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + } + + public EmailSender fromAddress(String fromAddress) { + this.fromAddress = fromAddress; + return this; + } + + /** + * Get fromAddress + * + * @return fromAddress + **/ + @Schema(example = "iam@gmail.com", required = true, description = "") + public String getFromAddress() { + return fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + public EmailSender userName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get userName + * + * @return userName + **/ + @Schema(example = "iam", description = "") + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public EmailSender password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * + * @return password + **/ + @Schema(example = "iam123", description = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public EmailSender properties(List properties) { + this.properties = properties; + return this; + } + + public EmailSender addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); + } + this.properties.add(propertiesItem); + return this; + } + + /** + * Get properties + * + * @return properties + **/ + @Schema(example = "[{\"key\":\"mail.smtp.starttls.enable\",\"value\":true}]", description = "") + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailSender emailSender = (EmailSender) o; + return Objects.equals(this.name, emailSender.name) && + Objects.equals(this.smtpServerHost, emailSender.smtpServerHost) && + Objects.equals(this.smtpPort, emailSender.smtpPort) && + Objects.equals(this.fromAddress, emailSender.fromAddress) && + Objects.equals(this.userName, emailSender.userName) && + Objects.equals(this.password, emailSender.password) && + Objects.equals(this.properties, emailSender.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, smtpServerHost, smtpPort, fromAddress, userName, password, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailSender {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" smtpServerHost: ").append(toIndentedString(smtpServerHost)).append("\n"); + sb.append(" smtpPort: ").append(toIndentedString(smtpPort)).append("\n"); + sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderAdd.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderAdd.java index 66cc00efaef..c02b6025295 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderAdd.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderAdd.java @@ -26,214 +26,221 @@ import java.util.Objects; /** - * EmailSenderAdd + * Email Sender Add request */ public class EmailSenderAdd { - @SerializedName("name") - private String name = null; - - @SerializedName("smtpServerHost") - private String smtpServerHost = null; - - @SerializedName("smtpPort") - private Integer smtpPort = null; - - @SerializedName("fromAddress") - private String fromAddress = null; - - @SerializedName("userName") - private String userName = null; - - @SerializedName("password") - private String password = null; - - @SerializedName("properties") - private List properties = null; - - public EmailSenderAdd name(String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - **/ - @Schema(description = "") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public EmailSenderAdd smtpServerHost(String smtpServerHost) { - this.smtpServerHost = smtpServerHost; - return this; - } - - /** - * Get smtpServerHost - * @return smtpServerHost - **/ - @Schema(description = "") - public String getSmtpServerHost() { - return smtpServerHost; - } - - public void setSmtpServerHost(String smtpServerHost) { - this.smtpServerHost = smtpServerHost; - } - - public EmailSenderAdd smtpPort(Integer smtpPort) { - this.smtpPort = smtpPort; - return this; - } - - /** - * Get smtpPort - * @return smtpPort - **/ - @Schema(description = "") - public Integer getSmtpPort() { - return smtpPort; - } - - public void setSmtpPort(Integer smtpPort) { - this.smtpPort = smtpPort; - } - - public EmailSenderAdd fromAddress(String fromAddress) { - this.fromAddress = fromAddress; - return this; - } - - /** - * Get fromAddress - * @return fromAddress - **/ - @Schema(example = "iam@gmail.com", required = true, description = "") - public String getFromAddress() { - return fromAddress; - } - - public void setFromAddress(String fromAddress) { - this.fromAddress = fromAddress; - } - - public EmailSenderAdd userName(String userName) { - this.userName = userName; - return this; - } - - /** - * Get userName - * @return userName - **/ - @Schema(example = "iam", description = "") - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public EmailSenderAdd password(String password) { - this.password = password; - return this; - } - - /** - * Get password - * @return password - **/ - @Schema(example = "iam123", description = "") - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public EmailSenderAdd properties(List properties) { - this.properties = properties; - return this; - } - - public EmailSenderAdd addPropertiesItem(Properties propertiesItem) { - if (this.properties == null) { - this.properties = new ArrayList(); - } - this.properties.add(propertiesItem); - return this; - } - - /** - * Get properties - * @return properties - **/ - @Schema(example = "[{\"key\":\"body.scope\",\"value\":\"true\"},{\"key\":\"mail.smtp.starttls.enable\",\"value\":true}]", description = "") - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EmailSenderAdd emailSenderAdd = (EmailSenderAdd) o; - return Objects.equals(this.name, emailSenderAdd.name) && - Objects.equals(this.smtpServerHost, emailSenderAdd.smtpServerHost) && - Objects.equals(this.smtpPort, emailSenderAdd.smtpPort) && - Objects.equals(this.fromAddress, emailSenderAdd.fromAddress) && - Objects.equals(this.userName, emailSenderAdd.userName) && - Objects.equals(this.password, emailSenderAdd.password) && - Objects.equals(this.properties, emailSenderAdd.properties); - } - - @Override - public int hashCode() { - return Objects.hash(name, smtpServerHost, smtpPort, fromAddress, userName, password, properties); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EmailSenderAdd {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" smtpServerHost: ").append(toIndentedString(smtpServerHost)).append("\n"); - sb.append(" smtpPort: ").append(toIndentedString(smtpPort)).append("\n"); - sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); - sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); - sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } + @SerializedName("name") + private String name = null; + + @SerializedName("smtpServerHost") + private String smtpServerHost = null; + + @SerializedName("smtpPort") + private Integer smtpPort = null; + + @SerializedName("fromAddress") + private String fromAddress = null; + + @SerializedName("userName") + private String userName = null; + + @SerializedName("password") + private String password = null; + + @SerializedName("properties") + private List properties = null; + + public EmailSenderAdd name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name + **/ + @Schema(description = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public EmailSenderAdd smtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + return this; + } + + /** + * Get smtpServerHost + * + * @return smtpServerHost + **/ + @Schema(description = "") + public String getSmtpServerHost() { + return smtpServerHost; + } + + public void setSmtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + } + + public EmailSenderAdd smtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + return this; + } + + /** + * Get smtpPort + * + * @return smtpPort + **/ + @Schema(description = "") + public Integer getSmtpPort() { + return smtpPort; + } + + public void setSmtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + } + + public EmailSenderAdd fromAddress(String fromAddress) { + this.fromAddress = fromAddress; + return this; + } + + /** + * Get fromAddress + * + * @return fromAddress + **/ + @Schema(example = "iam@gmail.com", required = true, description = "") + public String getFromAddress() { + return fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + public EmailSenderAdd userName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get userName + * + * @return userName + **/ + @Schema(example = "iam", description = "") + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public EmailSenderAdd password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * + * @return password + **/ + @Schema(example = "iam123", description = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public EmailSenderAdd properties(List properties) { + this.properties = properties; + return this; + } + + public EmailSenderAdd addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); + } + this.properties.add(propertiesItem); + return this; + } + + /** + * Get properties + * + * @return properties + **/ + @Schema(example = "[{\"key\":\"body.scope\",\"value\":\"true\"},{\"key\":\"mail.smtp.starttls.enable\",\"value\":true}]", description = "") + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailSenderAdd emailSenderAdd = (EmailSenderAdd) o; + return Objects.equals(this.name, emailSenderAdd.name) && + Objects.equals(this.smtpServerHost, emailSenderAdd.smtpServerHost) && + Objects.equals(this.smtpPort, emailSenderAdd.smtpPort) && + Objects.equals(this.fromAddress, emailSenderAdd.fromAddress) && + Objects.equals(this.userName, emailSenderAdd.userName) && + Objects.equals(this.password, emailSenderAdd.password) && + Objects.equals(this.properties, emailSenderAdd.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, smtpServerHost, smtpPort, fromAddress, userName, password, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailSenderAdd {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" smtpServerHost: ").append(toIndentedString(smtpServerHost)).append("\n"); + sb.append(" smtpPort: ").append(toIndentedString(smtpPort)).append("\n"); + sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderUpdateRequest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderUpdateRequest.java index 049ab458dc4..09ee4d83f5d 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderUpdateRequest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/EmailSenderUpdateRequest.java @@ -26,191 +26,197 @@ import java.util.Objects; /** - * EmailSenderUpdateRequest + * Email Sender Update Request */ public class EmailSenderUpdateRequest { - @SerializedName("smtpServerHost") - private String smtpServerHost = null; - - @SerializedName("smtpPort") - private Integer smtpPort = null; - - @SerializedName("fromAddress") - private String fromAddress = null; - - @SerializedName("userName") - private String userName = null; - - @SerializedName("password") - private String password = null; - - @SerializedName("properties") - private List properties = null; - - public EmailSenderUpdateRequest smtpServerHost(String smtpServerHost) { - this.smtpServerHost = smtpServerHost; - return this; - } - - /** - * Get smtpServerHost - * @return smtpServerHost - **/ - @Schema(example = "smtp.gmail.com", description = "") - public String getSmtpServerHost() { - return smtpServerHost; - } - - public void setSmtpServerHost(String smtpServerHost) { - this.smtpServerHost = smtpServerHost; - } - - public EmailSenderUpdateRequest smtpPort(Integer smtpPort) { - this.smtpPort = smtpPort; - return this; - } - - /** - * Get smtpPort - * @return smtpPort - **/ - @Schema(example = "587", description = "") - public Integer getSmtpPort() { - return smtpPort; - } - - public void setSmtpPort(Integer smtpPort) { - this.smtpPort = smtpPort; - } - - public EmailSenderUpdateRequest fromAddress(String fromAddress) { - this.fromAddress = fromAddress; - return this; - } - - /** - * Get fromAddress - * @return fromAddress - **/ - @Schema(example = "iam@gmail.com", required = true, description = "") - public String getFromAddress() { - return fromAddress; - } - - public void setFromAddress(String fromAddress) { - this.fromAddress = fromAddress; - } - - public EmailSenderUpdateRequest userName(String userName) { - this.userName = userName; - return this; - } - - /** - * Get userName - * @return userName - **/ - @Schema(example = "iam", description = "") - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public EmailSenderUpdateRequest password(String password) { - this.password = password; - return this; - } - - /** - * Get password - * @return password - **/ - @Schema(example = "iam123", description = "") - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public EmailSenderUpdateRequest properties(List properties) { - this.properties = properties; - return this; - } - - public EmailSenderUpdateRequest addPropertiesItem(Properties propertiesItem) { - if (this.properties == null) { - this.properties = new ArrayList(); - } - this.properties.add(propertiesItem); - return this; - } - - /** - * Get properties - * @return properties - **/ - @Schema(example = "[{\"key\":\"body.scope\",\"value\":\"true\"},{\"key\":\"mail.smtp.starttls.enable\",\"value\":true}]", description = "") - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - EmailSenderUpdateRequest emailSenderUpdateRequest = (EmailSenderUpdateRequest) o; - return Objects.equals(this.smtpServerHost, emailSenderUpdateRequest.smtpServerHost) && - Objects.equals(this.smtpPort, emailSenderUpdateRequest.smtpPort) && - Objects.equals(this.fromAddress, emailSenderUpdateRequest.fromAddress) && - Objects.equals(this.userName, emailSenderUpdateRequest.userName) && - Objects.equals(this.password, emailSenderUpdateRequest.password) && - Objects.equals(this.properties, emailSenderUpdateRequest.properties); - } - - @Override - public int hashCode() { - return Objects.hash(smtpServerHost, smtpPort, fromAddress, userName, password, properties); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class EmailSenderUpdateRequest {\n"); - - sb.append(" smtpServerHost: ").append(toIndentedString(smtpServerHost)).append("\n"); - sb.append(" smtpPort: ").append(toIndentedString(smtpPort)).append("\n"); - sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); - sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); - sb.append(" password: ").append(toIndentedString(password)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } + @SerializedName("smtpServerHost") + private String smtpServerHost = null; + + @SerializedName("smtpPort") + private Integer smtpPort = null; + + @SerializedName("fromAddress") + private String fromAddress = null; + + @SerializedName("userName") + private String userName = null; + + @SerializedName("password") + private String password = null; + + @SerializedName("properties") + private List properties = null; + + public EmailSenderUpdateRequest smtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + return this; + } + + /** + * Get smtpServerHost + * + * @return smtpServerHost + **/ + @Schema(example = "smtp.gmail.com", description = "") + public String getSmtpServerHost() { + return smtpServerHost; + } + + public void setSmtpServerHost(String smtpServerHost) { + this.smtpServerHost = smtpServerHost; + } + + public EmailSenderUpdateRequest smtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + return this; + } + + /** + * Get smtpPort + * + * @return smtpPort + **/ + @Schema(example = "587", description = "") + public Integer getSmtpPort() { + return smtpPort; + } + + public void setSmtpPort(Integer smtpPort) { + this.smtpPort = smtpPort; + } + + public EmailSenderUpdateRequest fromAddress(String fromAddress) { + this.fromAddress = fromAddress; + return this; + } + + /** + * Get fromAddress + * + * @return fromAddress + **/ + @Schema(example = "iam@gmail.com", required = true, description = "") + public String getFromAddress() { + return fromAddress; + } + + public void setFromAddress(String fromAddress) { + this.fromAddress = fromAddress; + } + + public EmailSenderUpdateRequest userName(String userName) { + this.userName = userName; + return this; + } + + /** + * Get userName + * + * @return userName + **/ + @Schema(example = "iam", description = "") + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public EmailSenderUpdateRequest password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * + * @return password + **/ + @Schema(example = "iam123", description = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public EmailSenderUpdateRequest properties(List properties) { + this.properties = properties; + return this; + } + + public EmailSenderUpdateRequest addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); + } + this.properties.add(propertiesItem); + return this; + } + + /** + * Get properties + * + * @return properties + **/ + @Schema(example = "[{\"key\":\"body.scope\",\"value\":\"true\"},{\"key\":\"mail.smtp.starttls.enable\",\"value\":true}]", description = "") + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EmailSenderUpdateRequest emailSenderUpdateRequest = (EmailSenderUpdateRequest) o; + return Objects.equals(this.smtpServerHost, emailSenderUpdateRequest.smtpServerHost) && + Objects.equals(this.smtpPort, emailSenderUpdateRequest.smtpPort) && + Objects.equals(this.fromAddress, emailSenderUpdateRequest.fromAddress) && + Objects.equals(this.userName, emailSenderUpdateRequest.userName) && + Objects.equals(this.password, emailSenderUpdateRequest.password) && + Objects.equals(this.properties, emailSenderUpdateRequest.properties); + } + + @Override + public int hashCode() { + return Objects.hash(smtpServerHost, smtpPort, fromAddress, userName, password, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailSenderUpdateRequest {\n"); + + sb.append(" smtpServerHost: ").append(toIndentedString(smtpServerHost)).append("\n"); + sb.append(" smtpPort: ").append(toIndentedString(smtpPort)).append("\n"); + sb.append(" fromAddress: ").append(toIndentedString(fromAddress)).append("\n"); + sb.append(" userName: ").append(toIndentedString(userName)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Error.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Error.java index e573e9ed86a..079c6219e74 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Error.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Error.java @@ -27,134 +27,138 @@ * Error */ public class Error { - @SerializedName("code") - private String code = null; - - @SerializedName("message") - private String message = null; - - @SerializedName("description") - private String description = null; - - @SerializedName("traceId") - private String traceId = null; - - public Error code(String code) { - this.code = code; - return this; - } - - /** - * Get code - * @return code - **/ - @Schema(example = "NSM-00000", description = "") - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public Error message(String message) { - this.message = message; - return this; - } - - /** - * Get message - * @return message - **/ - @Schema(example = "Some Error Message", description = "") - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public Error description(String description) { - this.description = description; - return this; - } - - /** - * Get description - * @return description - **/ - @Schema(example = "Some Error Description", description = "") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Error traceId(String traceId) { - this.traceId = traceId; - return this; - } - - /** - * Get traceId - * @return traceId - **/ - @Schema(example = "e0fbcfeb-3617-43c4-8dd0-7b7d38e13047", description = "") - public String getTraceId() { - return traceId; - } - - public void setTraceId(String traceId) { - this.traceId = traceId; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - Error error = (Error) o; - return Objects.equals(this.code, error.code) && - Objects.equals(this.message, error.message) && - Objects.equals(this.description, error.description) && - Objects.equals(this.traceId, error.traceId); - } - - @Override - public int hashCode() { - return Objects.hash(code, message, description, traceId); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Error {\n"); - - sb.append(" code: ").append(toIndentedString(code)).append("\n"); - sb.append(" message: ").append(toIndentedString(message)).append("\n"); - sb.append(" description: ").append(toIndentedString(description)).append("\n"); - sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } + @SerializedName("code") + private String code = null; + + @SerializedName("message") + private String message = null; + + @SerializedName("description") + private String description = null; + + @SerializedName("traceId") + private String traceId = null; + + public Error code(String code) { + this.code = code; + return this; + } + + /** + * Get code + * + * @return code + **/ + @Schema(example = "NSM-00000", description = "") + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public Error message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message + **/ + @Schema(example = "Some Error Message", description = "") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Error description(String description) { + this.description = description; + return this; + } + + /** + * Get description + * + * @return description + **/ + @Schema(example = "Some Error Description", description = "") + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Error traceId(String traceId) { + this.traceId = traceId; + return this; + } + + /** + * Get traceId + * + * @return traceId + **/ + @Schema(example = "e0fbcfeb-3617-43c4-8dd0-7b7d38e13047", description = "") + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Error error = (Error) o; + return Objects.equals(this.code, error.code) && + Objects.equals(this.message, error.message) && + Objects.equals(this.description, error.description) && + Objects.equals(this.traceId, error.traceId); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, description, traceId); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Error {\n"); + + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Properties.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Properties.java index 5f273da72c8..ee86bc29538 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Properties.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/Properties.java @@ -27,88 +27,90 @@ * Properties */ public class Properties { - @SerializedName("key") - private String key = null; - - @SerializedName("value") - private String value = null; - - public Properties key(String key) { - this.key = key; - return this; - } - - /** - * Get key - * @return key - **/ - @Schema(required = true, description = "") - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public Properties value(String value) { - this.value = value; - return this; - } - - /** - * Get value - * @return value - **/ - @Schema(required = true, description = "") - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @SerializedName("key") + private String key = null; + + @SerializedName("value") + private String value = null; + + public Properties key(String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key + **/ + @Schema(required = true, description = "") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; } - if (o == null || getClass() != o.getClass()) { - return false; + + public Properties value(String value) { + this.value = value; + return this; + } + + /** + * Get value + * + * @return value + **/ + @Schema(required = true, description = "") + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; } - Properties properties = (Properties) o; - return Objects.equals(this.key, properties.key) && - Objects.equals(this.value, properties.value); - } - - @Override - public int hashCode() { - return Objects.hash(key, value); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Properties {\n"); - - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" value: ").append(toIndentedString(value)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Properties properties = (Properties) o; + return Objects.equals(this.key, properties.key) && + Objects.equals(this.value, properties.value); + } + + @Override + public int hashCode() { + return Objects.hash(key, value); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Properties {\n"); + + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSProviderList.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSProviderList.java index fd8830ed66e..92f74ac24f4 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSProviderList.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSProviderList.java @@ -22,45 +22,45 @@ import java.util.Objects; /** - * SMSProviderList + * SMS Provider List */ public class SMSProviderList extends ArrayList { - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); } - if (o == null || getClass() != o.getClass()) { - return false; - } - return super.equals(o); - } - @Override - public int hashCode() { - return Objects.hash(super.hashCode()); - } + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SMSProviderList {\n"); - sb.append(" ").append(toIndentedString(super.toString())).append("\n"); - sb.append("}"); - return sb.toString(); - } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SMSProviderList {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append("}"); + return sb.toString(); + } - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSender.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSender.java index 3cd3b0d6a0e..db94e4a166f 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSender.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSender.java @@ -31,280 +31,293 @@ import java.util.Objects; /** - * SMSSender + * SMS Sender */ public class SMSSender { - @SerializedName("name") - private String name = null; + @SerializedName("name") + private String name = null; - @SerializedName("provider") - private String provider = null; + @SerializedName("provider") + private String provider = null; - @SerializedName("providerURL") - private String providerURL = null; + @SerializedName("providerURL") + private String providerURL = null; - @SerializedName("key") - private String key = null; + @SerializedName("key") + private String key = null; - @SerializedName("secret") - private String secret = null; + @SerializedName("secret") + private String secret = null; - @SerializedName("sender") - private String sender = null; + @SerializedName("sender") + private String sender = null; - /** - * Gets or Sets contentType - */ - @JsonAdapter(ContentTypeEnum.Adapter.class) - public enum ContentTypeEnum { - @SerializedName("JSON") - JSON("JSON"), - @SerializedName("FORM") - FORM("FORM"); + /** + * Gets or Sets contentType + */ + @JsonAdapter(ContentTypeEnum.Adapter.class) + public enum ContentTypeEnum { + @SerializedName("JSON") + JSON("JSON"), + @SerializedName("FORM") + FORM("FORM"); - private String value; + private String value; - ContentTypeEnum(String value) { - this.value = value; + ContentTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ContentTypeEnum fromValue(String input) { + for (ContentTypeEnum b : ContentTypeEnum.values()) { + if (b.value.equals(input)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { + jsonWriter.value(String.valueOf(enumeration.getValue())); + } + + @Override + public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { + Object value = jsonReader.nextString(); + return ContentTypeEnum.fromValue((String) (value)); + } + } } - public String getValue() { - return value; + + @SerializedName("contentType") + private ContentTypeEnum contentType = null; + + @SerializedName("properties") + private List properties = null; + + public SMSSender name(String name) { + this.name = name; + return this; } - @Override - public String toString() { - return String.valueOf(value); + /** + * Get name + * + * @return name + **/ + @Schema(example = "SMSPublisher", required = true, description = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public SMSSender provider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get provider + * + * @return provider + **/ + @Schema(example = "NEXMO", required = true, description = "") + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public SMSSender providerURL(String providerURL) { + this.providerURL = providerURL; + return this; + } + + /** + * Get providerURL + * + * @return providerURL + **/ + @Schema(example = "https://rest.nexmo.com/sms/json", required = true, description = "") + public String getProviderURL() { + return providerURL; + } + + public void setProviderURL(String providerURL) { + this.providerURL = providerURL; + } + + public SMSSender key(String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key + **/ + @Schema(example = "123**45", description = "") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public SMSSender secret(String secret) { + this.secret = secret; + return this; } - public static ContentTypeEnum fromValue(String input) { - for (ContentTypeEnum b : ContentTypeEnum.values()) { - if (b.value.equals(input)) { - return b; + + /** + * Get secret + * + * @return secret + **/ + @Schema(example = "5tg**ssd", description = "") + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public SMSSender sender(String sender) { + this.sender = sender; + return this; + } + + /** + * Get sender + * + * @return sender + **/ + @Schema(example = "+94 775563324", description = "") + public String getSender() { + return sender; + } + + public void setSender(String sender) { + this.sender = sender; + } + + public SMSSender contentType(ContentTypeEnum contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get contentType + * + * @return contentType + **/ + @Schema(required = true, description = "") + public ContentTypeEnum getContentType() { + return contentType; + } + + public void setContentType(ContentTypeEnum contentType) { + this.contentType = contentType; + } + + public SMSSender properties(List properties) { + this.properties = properties; + return this; + } + + public SMSSender addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); } - } - return null; + this.properties.add(propertiesItem); + return this; } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { - jsonWriter.value(String.valueOf(enumeration.getValue())); - } - - @Override - public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { - Object value = jsonReader.nextString(); - return ContentTypeEnum.fromValue((String)(value)); - } + + /** + * Get properties + * + * @return properties + **/ + @Schema(example = "[{\"key\":\"body.scope\",\"value\":\"internal\"},{\"key\":\"http.headers\",\"value\":\"X-Version: 1, Authorization: bearer ,Accept: application/json ,Content-Type: application/json\"}]", description = "") + public List getProperties() { + return properties; } - } @SerializedName("contentType") - private ContentTypeEnum contentType = null; - - @SerializedName("properties") - private List properties = null; - - public SMSSender name(String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - **/ - @Schema(example = "SMSPublisher", required = true, description = "") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public SMSSender provider(String provider) { - this.provider = provider; - return this; - } - - /** - * Get provider - * @return provider - **/ - @Schema(example = "NEXMO", required = true, description = "") - public String getProvider() { - return provider; - } - - public void setProvider(String provider) { - this.provider = provider; - } - - public SMSSender providerURL(String providerURL) { - this.providerURL = providerURL; - return this; - } - - /** - * Get providerURL - * @return providerURL - **/ - @Schema(example = "https://rest.nexmo.com/sms/json", required = true, description = "") - public String getProviderURL() { - return providerURL; - } - - public void setProviderURL(String providerURL) { - this.providerURL = providerURL; - } - - public SMSSender key(String key) { - this.key = key; - return this; - } - - /** - * Get key - * @return key - **/ - @Schema(example = "123**45", description = "") - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public SMSSender secret(String secret) { - this.secret = secret; - return this; - } - - /** - * Get secret - * @return secret - **/ - @Schema(example = "5tg**ssd", description = "") - public String getSecret() { - return secret; - } - - public void setSecret(String secret) { - this.secret = secret; - } - - public SMSSender sender(String sender) { - this.sender = sender; - return this; - } - - /** - * Get sender - * @return sender - **/ - @Schema(example = "+94 775563324", description = "") - public String getSender() { - return sender; - } - - public void setSender(String sender) { - this.sender = sender; - } - - public SMSSender contentType(ContentTypeEnum contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get contentType - * @return contentType - **/ - @Schema(required = true, description = "") - public ContentTypeEnum getContentType() { - return contentType; - } - - public void setContentType(ContentTypeEnum contentType) { - this.contentType = contentType; - } - - public SMSSender properties(List properties) { - this.properties = properties; - return this; - } - - public SMSSender addPropertiesItem(Properties propertiesItem) { - if (this.properties == null) { - this.properties = new ArrayList(); + + public void setProperties(List properties) { + this.properties = properties; } - this.properties.add(propertiesItem); - return this; - } - - /** - * Get properties - * @return properties - **/ - @Schema(example = "[{\"key\":\"body.scope\",\"value\":\"internal\"},{\"key\":\"http.headers\",\"value\":\"X-Version: 1, Authorization: bearer ,Accept: application/json ,Content-Type: application/json\"}]", description = "") - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SMSSender smSSender = (SMSSender) o; + return Objects.equals(this.name, smSSender.name) && + Objects.equals(this.provider, smSSender.provider) && + Objects.equals(this.providerURL, smSSender.providerURL) && + Objects.equals(this.key, smSSender.key) && + Objects.equals(this.secret, smSSender.secret) && + Objects.equals(this.sender, smSSender.sender) && + Objects.equals(this.contentType, smSSender.contentType) && + Objects.equals(this.properties, smSSender.properties); } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public int hashCode() { + return Objects.hash(name, provider, providerURL, key, secret, sender, contentType, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SMSSender {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" providerURL: ").append(toIndentedString(providerURL)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); } - SMSSender smSSender = (SMSSender) o; - return Objects.equals(this.name, smSSender.name) && - Objects.equals(this.provider, smSSender.provider) && - Objects.equals(this.providerURL, smSSender.providerURL) && - Objects.equals(this.key, smSSender.key) && - Objects.equals(this.secret, smSSender.secret) && - Objects.equals(this.sender, smSSender.sender) && - Objects.equals(this.contentType, smSSender.contentType) && - Objects.equals(this.properties, smSSender.properties); - } - - @Override - public int hashCode() { - return Objects.hash(name, provider, providerURL, key, secret, sender, contentType, properties); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SMSSender {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); - sb.append(" providerURL: ").append(toIndentedString(providerURL)).append("\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); - sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); - sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderAdd.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderAdd.java index 0765fd76a0b..41c6c3dc878 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderAdd.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderAdd.java @@ -31,280 +31,293 @@ import java.util.Objects; /** - * SMSSenderAdd + * SMS Sender Add request */ public class SMSSenderAdd { - @SerializedName("name") - private String name = null; + @SerializedName("name") + private String name = null; - @SerializedName("provider") - private String provider = null; + @SerializedName("provider") + private String provider = null; - @SerializedName("providerURL") - private String providerURL = null; + @SerializedName("providerURL") + private String providerURL = null; - @SerializedName("key") - private String key = null; + @SerializedName("key") + private String key = null; - @SerializedName("secret") - private String secret = null; + @SerializedName("secret") + private String secret = null; - @SerializedName("sender") - private String sender = null; + @SerializedName("sender") + private String sender = null; - /** - * Gets or Sets contentType - */ - @JsonAdapter(ContentTypeEnum.Adapter.class) - public enum ContentTypeEnum { - @SerializedName("JSON") - JSON("JSON"), - @SerializedName("FORM") - FORM("FORM"); + /** + * Gets or Sets contentType + */ + @JsonAdapter(ContentTypeEnum.Adapter.class) + public enum ContentTypeEnum { + @SerializedName("JSON") + JSON("JSON"), + @SerializedName("FORM") + FORM("FORM"); - private String value; + private String value; - ContentTypeEnum(String value) { - this.value = value; + ContentTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ContentTypeEnum fromValue(String input) { + for (ContentTypeEnum b : ContentTypeEnum.values()) { + if (b.value.equals(input)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { + jsonWriter.value(String.valueOf(enumeration.getValue())); + } + + @Override + public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { + Object value = jsonReader.nextString(); + return ContentTypeEnum.fromValue((String) (value)); + } + } } - public String getValue() { - return value; + + @SerializedName("contentType") + private ContentTypeEnum contentType = null; + + @SerializedName("properties") + private List properties = null; + + public SMSSenderAdd name(String name) { + this.name = name; + return this; } - @Override - public String toString() { - return String.valueOf(value); + /** + * Get name + * + * @return name + **/ + @Schema(example = "SMSPublisher", description = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public SMSSenderAdd provider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get provider + * + * @return provider + **/ + @Schema(example = "NEXMO", required = true, description = "") + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; + } + + public SMSSenderAdd providerURL(String providerURL) { + this.providerURL = providerURL; + return this; + } + + /** + * Get providerURL + * + * @return providerURL + **/ + @Schema(example = "https://rest.nexmo.com/sms/json", required = true, description = "") + public String getProviderURL() { + return providerURL; + } + + public void setProviderURL(String providerURL) { + this.providerURL = providerURL; + } + + public SMSSenderAdd key(String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key + **/ + @Schema(example = "123**45", description = "") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public SMSSenderAdd secret(String secret) { + this.secret = secret; + return this; } - public static ContentTypeEnum fromValue(String input) { - for (ContentTypeEnum b : ContentTypeEnum.values()) { - if (b.value.equals(input)) { - return b; + + /** + * Get secret + * + * @return secret + **/ + @Schema(example = "5tg**ssd", description = "") + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public SMSSenderAdd sender(String sender) { + this.sender = sender; + return this; + } + + /** + * Get sender + * + * @return sender + **/ + @Schema(example = "+94 775563324", description = "") + public String getSender() { + return sender; + } + + public void setSender(String sender) { + this.sender = sender; + } + + public SMSSenderAdd contentType(ContentTypeEnum contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get contentType + * + * @return contentType + **/ + @Schema(required = true, description = "") + public ContentTypeEnum getContentType() { + return contentType; + } + + public void setContentType(ContentTypeEnum contentType) { + this.contentType = contentType; + } + + public SMSSenderAdd properties(List properties) { + this.properties = properties; + return this; + } + + public SMSSenderAdd addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); } - } - return null; + this.properties.add(propertiesItem); + return this; } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { - jsonWriter.value(String.valueOf(enumeration.getValue())); - } - - @Override - public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { - Object value = jsonReader.nextString(); - return ContentTypeEnum.fromValue((String)(value)); - } + + /** + * Get properties + * + * @return properties + **/ + @Schema(example = "[{\"key\":\"http.headers\",\"value\":\"X-Version: 1, Authorization: bearer ,Accept: application/json ,Content-Type: application/json\"}]", description = "") + public List getProperties() { + return properties; } - } @SerializedName("contentType") - private ContentTypeEnum contentType = null; - - @SerializedName("properties") - private List properties = null; - - public SMSSenderAdd name(String name) { - this.name = name; - return this; - } - - /** - * Get name - * @return name - **/ - @Schema(example = "SMSPublisher", description = "") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public SMSSenderAdd provider(String provider) { - this.provider = provider; - return this; - } - - /** - * Get provider - * @return provider - **/ - @Schema(example = "NEXMO", required = true, description = "") - public String getProvider() { - return provider; - } - - public void setProvider(String provider) { - this.provider = provider; - } - - public SMSSenderAdd providerURL(String providerURL) { - this.providerURL = providerURL; - return this; - } - - /** - * Get providerURL - * @return providerURL - **/ - @Schema(example = "https://rest.nexmo.com/sms/json", required = true, description = "") - public String getProviderURL() { - return providerURL; - } - - public void setProviderURL(String providerURL) { - this.providerURL = providerURL; - } - - public SMSSenderAdd key(String key) { - this.key = key; - return this; - } - - /** - * Get key - * @return key - **/ - @Schema(example = "123**45", description = "") - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public SMSSenderAdd secret(String secret) { - this.secret = secret; - return this; - } - - /** - * Get secret - * @return secret - **/ - @Schema(example = "5tg**ssd", description = "") - public String getSecret() { - return secret; - } - - public void setSecret(String secret) { - this.secret = secret; - } - - public SMSSenderAdd sender(String sender) { - this.sender = sender; - return this; - } - - /** - * Get sender - * @return sender - **/ - @Schema(example = "+94 775563324", description = "") - public String getSender() { - return sender; - } - - public void setSender(String sender) { - this.sender = sender; - } - - public SMSSenderAdd contentType(ContentTypeEnum contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get contentType - * @return contentType - **/ - @Schema(required = true, description = "") - public ContentTypeEnum getContentType() { - return contentType; - } - - public void setContentType(ContentTypeEnum contentType) { - this.contentType = contentType; - } - - public SMSSenderAdd properties(List properties) { - this.properties = properties; - return this; - } - - public SMSSenderAdd addPropertiesItem(Properties propertiesItem) { - if (this.properties == null) { - this.properties = new ArrayList(); + + public void setProperties(List properties) { + this.properties = properties; } - this.properties.add(propertiesItem); - return this; - } - - /** - * Get properties - * @return properties - **/ - @Schema(example = "[{\"key\":\"http.headers\",\"value\":\"X-Version: 1, Authorization: bearer ,Accept: application/json ,Content-Type: application/json\"}]", description = "") - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SMSSenderAdd smSSenderAdd = (SMSSenderAdd) o; + return Objects.equals(this.name, smSSenderAdd.name) && + Objects.equals(this.provider, smSSenderAdd.provider) && + Objects.equals(this.providerURL, smSSenderAdd.providerURL) && + Objects.equals(this.key, smSSenderAdd.key) && + Objects.equals(this.secret, smSSenderAdd.secret) && + Objects.equals(this.sender, smSSenderAdd.sender) && + Objects.equals(this.contentType, smSSenderAdd.contentType) && + Objects.equals(this.properties, smSSenderAdd.properties); } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public int hashCode() { + return Objects.hash(name, provider, providerURL, key, secret, sender, contentType, properties); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SMSSenderAdd {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" providerURL: ").append(toIndentedString(providerURL)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); } - SMSSenderAdd smSSenderAdd = (SMSSenderAdd) o; - return Objects.equals(this.name, smSSenderAdd.name) && - Objects.equals(this.provider, smSSenderAdd.provider) && - Objects.equals(this.providerURL, smSSenderAdd.providerURL) && - Objects.equals(this.key, smSSenderAdd.key) && - Objects.equals(this.secret, smSSenderAdd.secret) && - Objects.equals(this.sender, smSSenderAdd.sender) && - Objects.equals(this.contentType, smSSenderAdd.contentType) && - Objects.equals(this.properties, smSSenderAdd.properties); - } - - @Override - public int hashCode() { - return Objects.hash(name, provider, providerURL, key, secret, sender, contentType, properties); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SMSSenderAdd {\n"); - - sb.append(" name: ").append(toIndentedString(name)).append("\n"); - sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); - sb.append(" providerURL: ").append(toIndentedString(providerURL)).append("\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); - sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); - sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderUpdateRequest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderUpdateRequest.java index 4e00bca7aec..7c00e18e727 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderUpdateRequest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/server/notification/sender/v1/model/SMSSenderUpdateRequest.java @@ -31,257 +31,269 @@ import java.util.Objects; /** - * SMSSenderUpdateRequest + * SMS Sender Update Request */ public class SMSSenderUpdateRequest { - @SerializedName("provider") - private String provider = null; + @SerializedName("provider") + private String provider = null; - @SerializedName("providerURL") - private String providerURL = null; + @SerializedName("providerURL") + private String providerURL = null; - @SerializedName("key") - private String key = null; + @SerializedName("key") + private String key = null; - @SerializedName("secret") - private String secret = null; + @SerializedName("secret") + private String secret = null; - @SerializedName("sender") - private String sender = null; + @SerializedName("sender") + private String sender = null; - /** - * Gets or Sets contentType - */ - @JsonAdapter(ContentTypeEnum.Adapter.class) - public enum ContentTypeEnum { - @SerializedName("JSON") - JSON("JSON"), - @SerializedName("FORM") - FORM("FORM"); + /** + * Gets or Sets contentType + */ + @JsonAdapter(ContentTypeEnum.Adapter.class) + public enum ContentTypeEnum { + @SerializedName("JSON") + JSON("JSON"), + @SerializedName("FORM") + FORM("FORM"); - private String value; + private String value; - ContentTypeEnum(String value) { - this.value = value; + ContentTypeEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static ContentTypeEnum fromValue(String input) { + for (ContentTypeEnum b : ContentTypeEnum.values()) { + if (b.value.equals(input)) { + return b; + } + } + return null; + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { + jsonWriter.value(String.valueOf(enumeration.getValue())); + } + + @Override + public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { + Object value = jsonReader.nextString(); + return ContentTypeEnum.fromValue((String) (value)); + } + } } - public String getValue() { - return value; + + @SerializedName("contentType") + private ContentTypeEnum contentType = null; + + @SerializedName("properties") + private List properties = null; + + public SMSSenderUpdateRequest provider(String provider) { + this.provider = provider; + return this; } - @Override - public String toString() { - return String.valueOf(value); + /** + * Get provider + * + * @return provider + **/ + @Schema(example = "NEXMO", required = true, description = "") + public String getProvider() { + return provider; + } + + public void setProvider(String provider) { + this.provider = provider; } - public static ContentTypeEnum fromValue(String input) { - for (ContentTypeEnum b : ContentTypeEnum.values()) { - if (b.value.equals(input)) { - return b; + + public SMSSenderUpdateRequest providerURL(String providerURL) { + this.providerURL = providerURL; + return this; + } + + /** + * Get providerURL + * + * @return providerURL + **/ + @Schema(example = "https://rest.nexmo.com/sms/json", required = true, description = "") + public String getProviderURL() { + return providerURL; + } + + public void setProviderURL(String providerURL) { + this.providerURL = providerURL; + } + + public SMSSenderUpdateRequest key(String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key + **/ + @Schema(example = "123**45", description = "") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public SMSSenderUpdateRequest secret(String secret) { + this.secret = secret; + return this; + } + + /** + * Get secret + * + * @return secret + **/ + @Schema(example = "5tg**ssd", description = "") + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + + public SMSSenderUpdateRequest sender(String sender) { + this.sender = sender; + return this; + } + + /** + * Get sender + * + * @return sender + **/ + @Schema(example = "+94 775563324", description = "") + public String getSender() { + return sender; + } + + public void setSender(String sender) { + this.sender = sender; + } + + public SMSSenderUpdateRequest contentType(ContentTypeEnum contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get contentType + * + * @return contentType + **/ + @Schema(required = true, description = "") + public ContentTypeEnum getContentType() { + return contentType; + } + + public void setContentType(ContentTypeEnum contentType) { + this.contentType = contentType; + } + + public SMSSenderUpdateRequest properties(List properties) { + this.properties = properties; + return this; + } + + public SMSSenderUpdateRequest addPropertiesItem(Properties propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList(); } - } - return null; + this.properties.add(propertiesItem); + return this; } - public static class Adapter extends TypeAdapter { - @Override - public void write(final JsonWriter jsonWriter, final ContentTypeEnum enumeration) throws IOException { - jsonWriter.value(String.valueOf(enumeration.getValue())); - } - - @Override - public ContentTypeEnum read(final JsonReader jsonReader) throws IOException { - Object value = jsonReader.nextString(); - return ContentTypeEnum.fromValue((String)(value)); - } + + /** + * Get properties + * + * @return properties + **/ + @Schema(example = "[{\"key\":\"http.headers\",\"value\":\"X-Version: 1, Authorization: bearer ,Accept: application/json ,Content-Type: application/json\"}]", description = "") + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; } - } @SerializedName("contentType") - private ContentTypeEnum contentType = null; - - @SerializedName("properties") - private List properties = null; - - public SMSSenderUpdateRequest provider(String provider) { - this.provider = provider; - return this; - } - - /** - * Get provider - * @return provider - **/ - @Schema(example = "NEXMO", required = true, description = "") - public String getProvider() { - return provider; - } - - public void setProvider(String provider) { - this.provider = provider; - } - - public SMSSenderUpdateRequest providerURL(String providerURL) { - this.providerURL = providerURL; - return this; - } - - /** - * Get providerURL - * @return providerURL - **/ - @Schema(example = "https://rest.nexmo.com/sms/json", required = true, description = "") - public String getProviderURL() { - return providerURL; - } - - public void setProviderURL(String providerURL) { - this.providerURL = providerURL; - } - - public SMSSenderUpdateRequest key(String key) { - this.key = key; - return this; - } - - /** - * Get key - * @return key - **/ - @Schema(example = "123**45", description = "") - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public SMSSenderUpdateRequest secret(String secret) { - this.secret = secret; - return this; - } - - /** - * Get secret - * @return secret - **/ - @Schema(example = "5tg**ssd", description = "") - public String getSecret() { - return secret; - } - - public void setSecret(String secret) { - this.secret = secret; - } - - public SMSSenderUpdateRequest sender(String sender) { - this.sender = sender; - return this; - } - - /** - * Get sender - * @return sender - **/ - @Schema(example = "+94 775563324", description = "") - public String getSender() { - return sender; - } - - public void setSender(String sender) { - this.sender = sender; - } - - public SMSSenderUpdateRequest contentType(ContentTypeEnum contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get contentType - * @return contentType - **/ - @Schema(required = true, description = "") - public ContentTypeEnum getContentType() { - return contentType; - } - - public void setContentType(ContentTypeEnum contentType) { - this.contentType = contentType; - } - - public SMSSenderUpdateRequest properties(List properties) { - this.properties = properties; - return this; - } - - public SMSSenderUpdateRequest addPropertiesItem(Properties propertiesItem) { - if (this.properties == null) { - this.properties = new ArrayList(); + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SMSSenderUpdateRequest smSSenderUpdateRequest = (SMSSenderUpdateRequest) o; + return Objects.equals(this.provider, smSSenderUpdateRequest.provider) && + Objects.equals(this.providerURL, smSSenderUpdateRequest.providerURL) && + Objects.equals(this.key, smSSenderUpdateRequest.key) && + Objects.equals(this.secret, smSSenderUpdateRequest.secret) && + Objects.equals(this.sender, smSSenderUpdateRequest.sender) && + Objects.equals(this.contentType, smSSenderUpdateRequest.contentType) && + Objects.equals(this.properties, smSSenderUpdateRequest.properties); } - this.properties.add(propertiesItem); - return this; - } - - /** - * Get properties - * @return properties - **/ - @Schema(example = "[{\"key\":\"http.headers\",\"value\":\"X-Version: 1, Authorization: bearer ,Accept: application/json ,Content-Type: application/json\"}]", description = "") - public List getProperties() { - return properties; - } - - public void setProperties(List properties) { - this.properties = properties; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + + @Override + public int hashCode() { + return Objects.hash(provider, providerURL, key, secret, sender, contentType, properties); } - if (o == null || getClass() != o.getClass()) { - return false; + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SMSSenderUpdateRequest {\n"); + + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); + sb.append(" providerURL: ").append(toIndentedString(providerURL)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); } - SMSSenderUpdateRequest smSSenderUpdateRequest = (SMSSenderUpdateRequest) o; - return Objects.equals(this.provider, smSSenderUpdateRequest.provider) && - Objects.equals(this.providerURL, smSSenderUpdateRequest.providerURL) && - Objects.equals(this.key, smSSenderUpdateRequest.key) && - Objects.equals(this.secret, smSSenderUpdateRequest.secret) && - Objects.equals(this.sender, smSSenderUpdateRequest.sender) && - Objects.equals(this.contentType, smSSenderUpdateRequest.contentType) && - Objects.equals(this.properties, smSSenderUpdateRequest.properties); - } - - @Override - public int hashCode() { - return Objects.hash(provider, providerURL, key, secret, sender, contentType, properties); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SMSSenderUpdateRequest {\n"); - - sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); - sb.append(" providerURL: ").append(toIndentedString(providerURL)).append("\n"); - sb.append(" key: ").append(toIndentedString(key)).append("\n"); - sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); - sb.append(" sender: ").append(toIndentedString(sender)).append("\n"); - sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); - sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); } - return o.toString().replace("\n", "\n "); - } } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java index 5cfe436cfea..cab2a92f30a 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java @@ -28,9 +28,6 @@ public class PhoneNumbers { private String type; private String value; - /** - * - **/ public PhoneNumbers type(String type) { this.type = type; @@ -48,9 +45,6 @@ public void setType(String type) { this.type = type; } - /** - * - **/ public PhoneNumbers value(String value) { this.value = value; From 9e7c4d50efb08de8138e53049c274825976b3327 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Tue, 12 Nov 2024 14:50:20 +0530 Subject: [PATCH 04/32] Add step to archive the memory dump if available --- .github/workflows/pr-builder-test-JDK11.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/pr-builder-test-JDK11.yml b/.github/workflows/pr-builder-test-JDK11.yml index b043b577461..944e27ac41b 100644 --- a/.github/workflows/pr-builder-test-JDK11.yml +++ b/.github/workflows/pr-builder-test-JDK11.yml @@ -117,6 +117,14 @@ jobs: path: | product-is/**/surefire-reports if-no-files-found: warn + - name: Archive heap dump + if: always() + uses: actions/upload-artifact@v4 + with: + name: heap-dump + path: | + product-is/**/heap-dump.hprof + if-no-files-found: ignore - name: Comment build status if: always() run: | From c8107506b08fa9f7aea79148b40a4d7a04cf6862 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Tue, 12 Nov 2024 14:56:43 +0530 Subject: [PATCH 05/32] Add step to archive the memory dump if available --- .github/workflows/dependency-updater.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/dependency-updater.yml b/.github/workflows/dependency-updater.yml index a76d7e2e3fa..d24f231d7a1 100644 --- a/.github/workflows/dependency-updater.yml +++ b/.github/workflows/dependency-updater.yml @@ -161,6 +161,14 @@ jobs: path: | ${{steps.builder_step.outputs.REPO_NAME}}/mvn-build.log if-no-files-found: warn + - name: Archive heap dump + if: always() + uses: actions/upload-artifact@v4 + with: + name: heap-dump + path: | + product-is/**/heap-dump.hprof + if-no-files-found: ignore - name: Google Chat Notification run: | STATUS_COLOR=$(if [[ ${{ job.status }} == "success" ]];then echo "#009944"; From 2f83ed684c77844e8ab4f800d0331a101ad719f9 Mon Sep 17 00:00:00 2001 From: jenkins-is-staging Date: Tue, 12 Nov 2024 17:07:39 +0000 Subject: [PATCH 06/32] Bump dependencies from IS_dependency_updater_github_action/11799938832 --- pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index aad54e3ade0..85c64767c85 100755 --- a/pom.xml +++ b/pom.xml @@ -2365,7 +2365,7 @@ - 7.6.3 + 7.6.6 [5.14.67, 8.0.0) @@ -2386,16 +2386,16 @@ - 7.0.187 + 7.0.188 5.11.45 5.10.2 5.11.12 5.7.7 - 3.4.99 + 3.4.100 5.5.10 - 5.8.4 + 5.8.5 5.2.5 @@ -2436,7 +2436,7 @@ 2.0.6 - 6.8.15 + 6.8.16 5.4.15 5.4.7 @@ -2477,7 +2477,7 @@ 2.0.17 - 1.2.249 + 1.2.251 1.3.45 5.5.9 @@ -2488,8 +2488,8 @@ 1.2.66 - 2.34.23 - 2.13.0 + 2.34.24 + 2.13.1 2.7.4 1.6.378 From 67985924c1f9097ff95c6720d722efaa0edfb58a Mon Sep 17 00:00:00 2001 From: Thilina Shashimal Senarath Date: Thu, 15 Aug 2024 10:13:57 +0530 Subject: [PATCH 07/32] add negative test cases --- .../OIDCAccessTokenAttributesTestCase.java | 266 ++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAccessTokenAttributesTestCase.java diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAccessTokenAttributesTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAccessTokenAttributesTestCase.java new file mode 100644 index 00000000000..e81559fea6c --- /dev/null +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAccessTokenAttributesTestCase.java @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.identity.integration.test.oidc; + +import com.nimbusds.jwt.JWTClaimsSet; +import com.nimbusds.jwt.SignedJWT; +import io.restassured.RestAssured; +import io.restassured.response.Response; +import org.apache.http.HttpStatus; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.identity.integration.test.oidc.bean.OIDCApplication; +import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.AccessTokenConfiguration; +import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.ApplicationModel; +import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.InboundProtocols; +import org.wso2.identity.integration.test.rest.api.server.application.management.v1.model.OpenIDConnectConfiguration; +import org.wso2.identity.integration.test.utils.OAuth2Constant; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.CoreMatchers.notNullValue; + +public class OIDCAccessTokenAttributesTestCase extends OIDCAbstractIntegrationTest { + + private static final String OAUTH2_TOKEN_ENDPOINT_URI = "/oauth2/token"; + private static final String SERVICES = "/services"; + private OIDCApplication application; + private OpenIDConnectConfiguration oidcInboundConfig; + protected String refreshToken; + protected String sessionDataKey; + + @BeforeClass(alwaysRun = true) + public void testInit() throws Exception { + + super.init(); + + RestAssured.baseURI = backendURL.replace(SERVICES, ""); + + // Create a user + OIDCUtilTest.initUser(); + createUser(OIDCUtilTest.user); + + // Create application + OIDCUtilTest.initApplications(); + application = OIDCUtilTest.applications.get(OIDCUtilTest.playgroundAppTwoAppName); + createApplication(application); + } + + @AfterClass(alwaysRun = true) + public void testClear() throws Exception { + + deleteUser(OIDCUtilTest.user); + deleteApplication(application); + clear(); + } + + @Test(groups = "wso2.is", description = "Validate access token attributes with password grant") + public void testValidateAccessTokenAttributesWithPasswordGrant() throws Exception { + + Map params = new HashMap<>(); + params.put("grant_type", OAuth2Constant.OAUTH2_GRANT_TYPE_RESOURCE_OWNER); + params.put("scope", ""); + params.put("username", OIDCUtilTest.user.getUserName()); + params.put("password", OIDCUtilTest.user.getPassword()); + + Response response = getResponseOfFormPostWithAuth(OAUTH2_TOKEN_ENDPOINT_URI, params, new HashMap<>(), + application.getClientId(), application.getClientSecret()); + + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_OK) + .body("access_token", notNullValue()) + .body("refresh_token", notNullValue()); + + String accessToken = response.then().extract().path("access_token"); + refreshToken = response.then().extract().path("refresh_token"); + Assert.assertNotNull(accessToken, "Access token is null"); + JWTClaimsSet jwtClaimsSet = SignedJWT.parse(accessToken).getJWTClaimsSet(); + Assert.assertNotNull(jwtClaimsSet.getClaim("username"), "Username is null."); + + } + + @Test(groups = "wso2.is", description = "Validate access token attributes with refresh grant", + dependsOnMethods = "testValidateAccessTokenAttributesWithPasswordGrant") + public void testValidateAccessTokenAttributesWithRefreshGrant() throws Exception { + + Map params = new HashMap<>(); + params.put("grant_type", OAuth2Constant.OAUTH2_GRANT_TYPE_REFRESH_TOKEN); + params.put(OAuth2Constant.OAUTH2_GRANT_TYPE_REFRESH_TOKEN, refreshToken); + + Response response = getResponseOfFormPostWithAuth(OAUTH2_TOKEN_ENDPOINT_URI, params, new HashMap<>(), + application.getClientId(), application.getClientSecret()); + + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_OK) + .body("access_token", notNullValue()) + .body("refresh_token", notNullValue()); + + String accessToken = response.then().extract().path("access_token"); + refreshToken = response.then().extract().path("refresh_token"); + Assert.assertNotNull(accessToken, "Access token is null"); + JWTClaimsSet jwtClaimsSet = SignedJWT.parse(accessToken).getJWTClaimsSet(); + Assert.assertNotNull(jwtClaimsSet.getClaim("username"), "Username is null."); + } + + @Test(groups = "wso2.is", description = "Update access token attributes of the application", + dependsOnMethods = "testValidateAccessTokenAttributesWithRefreshGrant") + public void testUpdateAccessTokenAttributes() throws Exception { + + AccessTokenConfiguration accessTokenConfig = new AccessTokenConfiguration().type("JWT"); + accessTokenConfig.setUserAccessTokenExpiryInSeconds(3600L); + accessTokenConfig.setApplicationAccessTokenExpiryInSeconds(3600L); + // Add access token attributes + accessTokenConfig.setAccessTokenAttributes(new ArrayList<>()); + oidcInboundConfig.setAccessToken(accessTokenConfig); + updateApplicationInboundConfig(application.getApplicationId(), oidcInboundConfig, OIDC); + + OpenIDConnectConfiguration updatedOidcInboundConfig = + getOIDCInboundDetailsOfApplication(application.getApplicationId()); + Assert.assertTrue(updatedOidcInboundConfig.getAccessToken().getAccessTokenAttributes().isEmpty(), + "Access token attribute should be empty."); + } + + @Test(groups = "wso2.is", description = "Validate access token attributes for empty allowed attributes", + dependsOnMethods = "testUpdateAccessTokenAttributes") + public void testValidateAccessTokenAttributesForEmptyAllowedAttributes() throws Exception { + + Map params = new HashMap<>(); + params.put("grant_type", OAuth2Constant.OAUTH2_GRANT_TYPE_RESOURCE_OWNER); + params.put("scope", ""); + params.put("username", OIDCUtilTest.user.getUserName()); + params.put("password", OIDCUtilTest.user.getPassword()); + + Response response = getResponseOfFormPostWithAuth(OAUTH2_TOKEN_ENDPOINT_URI, params, new HashMap<>(), + application.getClientId(), application.getClientSecret()); + + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_OK) + .body("access_token", notNullValue()) + .body("refresh_token", notNullValue()); + + String accessToken = response.then().extract().path("access_token"); + refreshToken = response.then().extract().path("refresh_token"); + Assert.assertNotNull(accessToken, "Access token is null"); + JWTClaimsSet jwtClaimsSet = SignedJWT.parse(accessToken).getJWTClaimsSet(); + Assert.assertNull(jwtClaimsSet.getClaim("username"), "Username is not null."); + } + + @Test(groups = "wso2.is", description = "Validate access token attributes for empty allowed attributes with " + + "refresh grant", dependsOnMethods = "testValidateAccessTokenAttributesForEmptyAllowedAttributes") + public void testValidateAccessTokenAttributesForEmptyAllowedAttributesWithRefreshGrant() throws Exception { + + Map params = new HashMap<>(); + params.put("grant_type", OAuth2Constant.OAUTH2_GRANT_TYPE_REFRESH_TOKEN); + params.put(OAuth2Constant.OAUTH2_GRANT_TYPE_REFRESH_TOKEN, refreshToken); + + Response response = getResponseOfFormPostWithAuth(OAUTH2_TOKEN_ENDPOINT_URI, params, new HashMap<>(), + application.getClientId(), application.getClientSecret()); + + response.then() + .log().ifValidationFails() + .assertThat() + .statusCode(HttpStatus.SC_OK) + .body("access_token", notNullValue()) + .body("refresh_token", notNullValue()); + + String accessToken = response.then().extract().path("access_token"); + refreshToken = response.then().extract().path("refresh_token"); + Assert.assertNotNull(accessToken, "Access token is null"); + JWTClaimsSet jwtClaimsSet = SignedJWT.parse(accessToken).getJWTClaimsSet(); + Assert.assertNull(jwtClaimsSet.getClaim("username"), "Username is not null."); + } + + /** + * Invoke given endpointUri for Form POST request with given body, headers and Basic authentication credentials. + * + * @param endpointUri endpoint to be invoked. + * @param params map of parameters to be added to the request. + * @param headers map of headers to be added to the request. + * @param username basic auth username. + * @param password basic auth password. + * @return response. + */ + protected Response getResponseOfFormPostWithAuth(String endpointUri, Map params, Map + headers, String username, String password) { + + return given().auth().preemptive().basic(username, password) + .headers(headers) + .params(params) + .when() + .post(endpointUri); + } + + /** + * Create an OIDC application. + * + * @param application application instance. + * @throws Exception If an error creating an application. + */ + public void createApplication(OIDCApplication application) throws Exception { + + ApplicationModel applicationModel = new ApplicationModel(); + createAccessTokenAttributesEnabledApplication(applicationModel, application); + } + + private void createAccessTokenAttributesEnabledApplication(ApplicationModel applicationModel, + OIDCApplication application) throws Exception { + + List grantTypes = new ArrayList<>(); + Collections.addAll(grantTypes, OAuth2Constant.OAUTH2_GRANT_TYPE_RESOURCE_OWNER, + OAuth2Constant.OAUTH2_GRANT_TYPE_REFRESH_TOKEN); + + OpenIDConnectConfiguration oidcConfig = new OpenIDConnectConfiguration(); + oidcConfig.setGrantTypes(grantTypes); + oidcConfig.addCallbackURLsItem(application.getCallBackURL()); + + AccessTokenConfiguration accessTokenConfig = new AccessTokenConfiguration().type("JWT"); + accessTokenConfig.setUserAccessTokenExpiryInSeconds(3600L); + accessTokenConfig.setApplicationAccessTokenExpiryInSeconds(3600L); + // Add access token attributes + List accessTokenAttributes = new ArrayList<>(); + Collections.addAll(accessTokenAttributes, "username", "email"); + accessTokenConfig.setAccessTokenAttributes(accessTokenAttributes); + + oidcConfig.setAccessToken(accessTokenConfig); + + applicationModel.setName(application.getApplicationName()); + applicationModel.setInboundProtocolConfiguration(new InboundProtocols().oidc(oidcConfig)); + + String applicationId = addApplication(applicationModel); + oidcConfig = getOIDCInboundDetailsOfApplication(applicationId); + oidcInboundConfig = oidcConfig; + + application.setApplicationId(applicationId); + application.setClientId(oidcConfig.getClientId()); + application.setClientSecret(oidcConfig.getClientSecret()); + } +} From 87a01b028c013f41b6b788ff36bd423bffee5556 Mon Sep 17 00:00:00 2001 From: Thilina Shashimal Senarath Date: Thu, 22 Aug 2024 00:14:55 +0530 Subject: [PATCH 08/32] Add test to testng --- .../tests-backend/src/test/resources/testng.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml index e6273bb978a..cb14206aa06 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml +++ b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml @@ -144,6 +144,7 @@ + From 7b047986452b7340d728667fe37804afc8eb77f9 Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri Date: Thu, 24 Oct 2024 12:12:05 +0530 Subject: [PATCH 09/32] Remove accessToken user claim validations. --- ...th2AuthorizationCodeGrantJWTTokenTestCase.java | 8 +++----- .../OAuth2ServiceAbstractIntegrationTest.java | 4 ++++ ...cessTokenWithConsentedTokenColumnTestCase.java | 14 ++++++++------ ...cessTokenWithConsentedTokenColumnTestCase.java | 15 ++++++++------- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java index c7763ccf0d1..0d94e4494fa 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java @@ -67,6 +67,7 @@ import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; import static org.wso2.identity.integration.test.utils.DataExtractUtil.KeyValue; import static org.wso2.identity.integration.test.utils.OAuth2Constant.ACCESS_TOKEN_ENDPOINT; @@ -322,11 +323,8 @@ public void testValidateAdditionalUserClaims() { applicationConfig.getRequestedClaimList().forEach(claim -> { if (authorizingUser.getUserClaims().get(claim) != null) { - assertNotNull(accessTokenClaims.getClaim(claim.getOidcClaimUri()), - "Claim " + claim.getOidcClaimUri() + " not found in the access token."); - assertEquals(accessTokenClaims.getClaim(claim.getOidcClaimUri()), - authorizingUser.getUserClaims().get(claim), - "Value for claim " + claim.getOidcClaimUri() + " is incorrect in the access token."); + assertNull(accessTokenClaims.getClaim(claim.getOidcClaimUri()), + "User claim " + claim.getOidcClaimUri() + " found in the access token."); } }); } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAbstractIntegrationTest.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAbstractIntegrationTest.java index 554c0770041..a5100fae8a4 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAbstractIntegrationTest.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2ServiceAbstractIntegrationTest.java @@ -187,6 +187,10 @@ public ApplicationResponseModel addApplication(ApplicationConfig applicationConf accessTokenConfiguration.type(applicationConfig.getTokenType().getTokenTypeProperty()); accessTokenConfiguration.applicationAccessTokenExpiryInSeconds(applicationConfig.getExpiryTime()); accessTokenConfiguration.userAccessTokenExpiryInSeconds(applicationConfig.getExpiryTime()); + // Add access token claim list. + List accessTokenClaimList = applicationConfig.getRequestedClaimList().stream() + .map(UserClaimConfig::getOidcClaimUri).collect(Collectors.toList()); + accessTokenConfiguration.accessTokenAttributes(accessTokenClaimList); oidcConfig.accessToken(accessTokenConfiguration); if (applicationConfig.getAudienceList() != null && !applicationConfig.getRequestedClaimList().isEmpty()) { diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java index 3716f8ec2bc..979f37a18c4 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java @@ -239,13 +239,15 @@ private void validateUserClaims(OIDCTokens oidcTokens) throws JSONException, Par accessToken = oidcTokens.getAccessToken().getValue(); refreshToken = oidcTokens.getRefreshToken().getValue(); - // Get the user info from the JWT access token. + // Check if user claims are present in access token. JSONObject jwtJsonObject = new JSONObject(new String(Base64.decodeBase64(accessToken.split("\\.")[1]))); - String email = jwtJsonObject.getString(EMAIL_OIDC_CLAIM); - Assert.assertEquals(USER_EMAIL, email, "Requested user claim (Email) is not present in the JWT access " - + "token."); - Assert.assertTrue(jwtJsonObject.isNull(ADDRESS_OIDC_CLAIM), "Non-consented user claim (address) is" - + " present in the JWT access token."); + boolean assertion = false; + try { + Object emailClaim = jwtJsonObject.get(EMAIL_OIDC_CLAIM); + } catch (JSONException e) { + assertion = true; + } + Assert.assertTrue(assertion, "Requested user claim (email) is present in the JWT access token."); // Get the user info from the ID token. Assert.assertEquals(oidcTokens.getIDToken().getJWTClaimsSet().getClaim(EMAIL_OIDC_CLAIM).toString(), USER_EMAIL, diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java index 4cd2a23c29d..4ae07542765 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java @@ -77,7 +77,6 @@ public void testRegisterApplication() throws Exception { registerApplication(); } - @Test(description = "This test case tests the JWT access token generation using password grant type.", dependsOnMethods = "testRegisterApplication") public void testPasswordGrantBasedAccessTokenGeneration() throws IOException, URISyntaxException, ParseException, @@ -139,13 +138,15 @@ private void validateUserClaims(OIDCTokens oidcTokens) throws JSONException, jav // Get the user info from the JWT access token. JSONObject jwtJsonObject = new JSONObject(new String(Base64.decodeBase64(accessToken.split( "\\.")[1]))); - String email = jwtJsonObject.get(EMAIL_OIDC_CLAIM).toString(); - String country = ((JSONObject) jwtJsonObject.get(ADDRESS_OIDC_CLAIM)).get(COUNTRY_OIDC_CLAIM).toString(); - // Check the user info of the JWT access token. - Assert.assertEquals(USER_EMAIL, email, "Requested user claim (email) is not present in the JWT access token."); - Assert.assertEquals(COUNTRY, country, "Requested user claim (country) is not present in the JWT " - + "access token."); + // Check if user claims are present in access token. + boolean assertion = false; + try { + Object emailClaim = jwtJsonObject.get(EMAIL_OIDC_CLAIM); + } catch (JSONException e) { + assertion = true; + } + Assert.assertTrue(assertion, "Requested user claim (email) is present in the JWT access token."); Assert.assertEquals(oidcTokens.getIDToken().getJWTClaimsSet().getClaim(EMAIL_OIDC_CLAIM), USER_EMAIL, "Requested user claims is not returned back with the ID token."); From 926880fd020077663a8981b474018fc3b4205818 Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri Date: Thu, 24 Oct 2024 12:25:14 +0530 Subject: [PATCH 10/32] Refactor. --- ...eGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java | 5 ++--- ...dGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java index 979f37a18c4..1327c122039 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServiceAuthCodeGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java @@ -241,13 +241,12 @@ private void validateUserClaims(OIDCTokens oidcTokens) throws JSONException, Par // Check if user claims are present in access token. JSONObject jwtJsonObject = new JSONObject(new String(Base64.decodeBase64(accessToken.split("\\.")[1]))); - boolean assertion = false; try { Object emailClaim = jwtJsonObject.get(EMAIL_OIDC_CLAIM); + Assert.fail("Requested user claim (email) is present in the JWT access token."); } catch (JSONException e) { - assertion = true; + Assert.assertTrue(true, "Requested user claim (email) is present in the JWT access token."); } - Assert.assertTrue(assertion, "Requested user claim (email) is present in the JWT access token."); // Get the user info from the ID token. Assert.assertEquals(oidcTokens.getIDToken().getJWTClaimsSet().getClaim(EMAIL_OIDC_CLAIM).toString(), USER_EMAIL, diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java index 4ae07542765..571ed18d46f 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/consented/token/OAuth2ServicePasswordGrantJWTAccessTokenWithConsentedTokenColumnTestCase.java @@ -140,13 +140,12 @@ private void validateUserClaims(OIDCTokens oidcTokens) throws JSONException, jav "\\.")[1]))); // Check if user claims are present in access token. - boolean assertion = false; try { Object emailClaim = jwtJsonObject.get(EMAIL_OIDC_CLAIM); + Assert.fail("Requested user claim (email) is present in the JWT access token."); } catch (JSONException e) { - assertion = true; + Assert.assertTrue(true, "Requested user claim (email) is present in the JWT access token."); } - Assert.assertTrue(assertion, "Requested user claim (email) is present in the JWT access token."); Assert.assertEquals(oidcTokens.getIDToken().getJWTClaimsSet().getClaim(EMAIL_OIDC_CLAIM), USER_EMAIL, "Requested user claims is not returned back with the ID token."); From 7c47a28cbf3eb9763924df258001901ce53c3414 Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri Date: Mon, 28 Oct 2024 23:24:48 +0530 Subject: [PATCH 11/32] Add claim config validations. --- .../OAuth2AuthorizationCodeGrantJWTTokenTestCase.java | 4 ++-- .../test/oidc/OIDCAccessTokenAttributesTestCase.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java mode change 100644 => 100755 modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAccessTokenAttributesTestCase.java diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java old mode 100644 new mode 100755 index 0d94e4494fa..da0d7007b87 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java @@ -323,8 +323,8 @@ public void testValidateAdditionalUserClaims() { applicationConfig.getRequestedClaimList().forEach(claim -> { if (authorizingUser.getUserClaims().get(claim) != null) { - assertNull(accessTokenClaims.getClaim(claim.getOidcClaimUri()), - "User claim " + claim.getOidcClaimUri() + " found in the access token."); + assertNotNull(accessTokenClaims.getClaim(claim.getOidcClaimUri()), + "User claim " + claim.getOidcClaimUri() + " not found in the access token."); } }); } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAccessTokenAttributesTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAccessTokenAttributesTestCase.java old mode 100644 new mode 100755 index e81559fea6c..3f5787ac399 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAccessTokenAttributesTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oidc/OIDCAccessTokenAttributesTestCase.java @@ -143,8 +143,8 @@ public void testUpdateAccessTokenAttributes() throws Exception { OpenIDConnectConfiguration updatedOidcInboundConfig = getOIDCInboundDetailsOfApplication(application.getApplicationId()); - Assert.assertTrue(updatedOidcInboundConfig.getAccessToken().getAccessTokenAttributes().isEmpty(), - "Access token attribute should be empty."); + Assert.assertFalse(updatedOidcInboundConfig.getAccessToken().getAccessTokenAttributes().isEmpty(), + "Access token attribute should not be empty."); } @Test(groups = "wso2.is", description = "Validate access token attributes for empty allowed attributes", @@ -171,7 +171,7 @@ public void testValidateAccessTokenAttributesForEmptyAllowedAttributes() throws refreshToken = response.then().extract().path("refresh_token"); Assert.assertNotNull(accessToken, "Access token is null"); JWTClaimsSet jwtClaimsSet = SignedJWT.parse(accessToken).getJWTClaimsSet(); - Assert.assertNull(jwtClaimsSet.getClaim("username"), "Username is not null."); + Assert.assertNotNull(jwtClaimsSet.getClaim("username"), "Username is null."); } @Test(groups = "wso2.is", description = "Validate access token attributes for empty allowed attributes with " + @@ -196,7 +196,7 @@ public void testValidateAccessTokenAttributesForEmptyAllowedAttributesWithRefres refreshToken = response.then().extract().path("refresh_token"); Assert.assertNotNull(accessToken, "Access token is null"); JWTClaimsSet jwtClaimsSet = SignedJWT.parse(accessToken).getJWTClaimsSet(); - Assert.assertNull(jwtClaimsSet.getClaim("username"), "Username is not null."); + Assert.assertNotNull(jwtClaimsSet.getClaim("username"), "Username is null."); } /** From ddc2d92e966df91993cdfcb555a53f902fd6abc0 Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri Date: Mon, 11 Nov 2024 10:40:30 +0530 Subject: [PATCH 12/32] Add access token initializing when needed. --- .../test/oauth2/OAuth2TokenExchangeGrantTypeTestCase.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2TokenExchangeGrantTypeTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2TokenExchangeGrantTypeTestCase.java index 7c38b928861..13921edf7ae 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2TokenExchangeGrantTypeTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2TokenExchangeGrantTypeTestCase.java @@ -557,6 +557,8 @@ private OAuthConsumerAppDTO getOAuthConsumerAppDTO(OIDCApplication application) appDTO.setTokenType("JWT"); appDTO.setGrantTypes("authorization_code implicit password client_credentials refresh_token " + "urn:ietf:params:oauth:grant-type:token-exchange"); + String[] accessTokenClaims = {"username", "email"}; + appDTO.setAccessTokenClaims(accessTokenClaims); return appDTO; } From 607b2a01d9d6b13e7fd683541cca0d8eb404d3ba Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri Date: Mon, 11 Nov 2024 10:40:57 +0530 Subject: [PATCH 13/32] Remove unnecessary refactors. --- .../oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java index da0d7007b87..e22aeec2e1c 100755 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/oauth2/OAuth2AuthorizationCodeGrantJWTTokenTestCase.java @@ -324,7 +324,10 @@ public void testValidateAdditionalUserClaims() { applicationConfig.getRequestedClaimList().forEach(claim -> { if (authorizingUser.getUserClaims().get(claim) != null) { assertNotNull(accessTokenClaims.getClaim(claim.getOidcClaimUri()), - "User claim " + claim.getOidcClaimUri() + " not found in the access token."); + "Claim " + claim.getOidcClaimUri() + " not found in the access token."); + assertEquals(accessTokenClaims.getClaim(claim.getOidcClaimUri()), + authorizingUser.getUserClaims().get(claim), + "Value for claim " + claim.getOidcClaimUri() + " is incorrect in the access token."); } }); } From a420b7cb14348992afd1c17033b3f141f7a4949a Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri Date: Wed, 13 Nov 2024 07:28:23 +0530 Subject: [PATCH 14/32] Bump framework version. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index aad54e3ade0..2394bac3f82 100755 --- a/pom.xml +++ b/pom.xml @@ -2365,7 +2365,7 @@ - 7.6.3 + 7.6.7 [5.14.67, 8.0.0) From 55dec3976054d469408a60355058e5b0c099dbca Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri <47152272+mpmadhavig@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:00:18 +0530 Subject: [PATCH 15/32] Bump console version. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a4748d82ed8..728b6025e07 100755 --- a/pom.xml +++ b/pom.xml @@ -2488,7 +2488,7 @@ 1.2.66 - 2.34.24 + 2.34.25 2.13.1 2.7.4 1.6.378 From 1371b886826434bc5a7ff2601ff9acd6e5100a48 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Wed, 13 Nov 2024 10:38:09 +0530 Subject: [PATCH 16/32] Update git actions --- .github/scripts/pr-builder-7.sh | 371 ----------------------- .github/scripts/pr-builder.sh | 2 +- .github/workflows/dependency-updater.yml | 2 +- 3 files changed, 2 insertions(+), 373 deletions(-) delete mode 100644 .github/scripts/pr-builder-7.sh diff --git a/.github/scripts/pr-builder-7.sh b/.github/scripts/pr-builder-7.sh deleted file mode 100644 index e86d98d96be..00000000000 --- a/.github/scripts/pr-builder-7.sh +++ /dev/null @@ -1,371 +0,0 @@ -#!/bin/bash +x -OUTBOUND_AUTH_OIDC_REPO=identity-outbound-auth-oidc -OUTBOUND_AUTH_OIDC_REPO_CLONE_LINK=https://github.com/wso2-extensions/identity-outbound-auth-oidc.git -SCIM2_REPO=identity-inbound-provisioning-scim2 -SCIM2_REPO_CLONE_LINK=https://github.com/wso2-extensions/identity-inbound-provisioning-scim2.git - -echo "" -echo "==========================================================" -PR_LINK=${PR_LINK%/} -JDK_VERSION=${JDK_VERSION%/} -JAVA_8_HOME=${JAVA_8_HOME%/} -JAVA_11_HOME=${JAVA_11_HOME%/} -echo " PR_LINK: $PR_LINK" -echo " JAVA 8 Home: $JAVA_8_HOME" -echo " JAVA 11 Home: $JAVA_11_HOME" -echo " User Input: $JDK_VERSION" -echo "::warning::Build ran for PR $PR_LINK" - -USER=$(echo $PR_LINK | awk -F'/' '{print $4}') -REPO=$(echo $PR_LINK | awk -F'/' '{print $5}') -PULL_NUMBER=$(echo $PR_LINK | awk -F'/' '{print $7}') - -echo " USER: $USER" -echo " REPO: $REPO" -echo " PULL_NUMBER: $PULL_NUMBER" -echo "::set-output name=REPO_NAME::$REPO" -echo "==========================================================" -echo "Cloning product-is" -echo "==========================================================" - -git clone https://github.com/wso2/product-is - -if [ "$REPO" = "product-is" ]; then - - echo "" - echo "PR is for the product-is itself. Start building with test..." - echo "==========================================================" - cd product-is - git checkout 7.x.x - - echo "" - echo "Applying PR $PULL_NUMBER as a diff..." - echo "==========================================================" - wget -q --output-document=diff.diff $PR_LINK.diff - cat diff.diff - echo "==========================================================" - git apply diff.diff || { - echo 'Applying diff failed. Exiting...' - echo "::error::Applying diff failed." - exit 1 - } - - echo "Last 3 changes:" - COMMIT1=$(git log --oneline -1) - COMMIT2=$(git log --oneline -2 | tail -1) - COMMIT3=$(git log --oneline -3 | tail -1) - echo "$COMMIT1" - echo "$COMMIT2" - echo "$COMMIT3" - - cat pom.xml - export JAVA_HOME=$JAVA_11_HOME - mvn clean install --batch-mode | tee mvn-build.log - - PR_BUILD_STATUS=$(cat mvn-build.log | grep "\[INFO\] BUILD" | grep -oE '[^ ]+$') - PR_TEST_RESULT=$(sed -n -e '/\[INFO\] Results:/,/\[INFO\] Tests run:/ p' mvn-build.log) - - PR_BUILD_FINAL_RESULT=$( - echo "===========================================================" - echo "product-is BUILD $PR_BUILD_STATUS" - echo "==========================================================" - echo "" - echo "$PR_TEST_RESULT" - ) - - PR_BUILD_RESULT_LOG_TEMP=$(echo "$PR_BUILD_FINAL_RESULT" | sed 's/$/%0A/') - PR_BUILD_RESULT_LOG=$(echo $PR_BUILD_RESULT_LOG_TEMP) - echo "::warning::$PR_BUILD_RESULT_LOG" - - PR_BUILD_SUCCESS_COUNT=$(grep -o -i "\[INFO\] BUILD SUCCESS" mvn-build.log | wc -l) - if [ "$PR_BUILD_SUCCESS_COUNT" != "1" ]; then - echo "PR BUILD not successfull. Aborting." - echo "::error::PR BUILD not successfull. Check artifacts for logs." - exit 1 - fi -else - echo "" - echo "PR is for the dependency repository $REPO." - echo "" - echo "Cloning $USER/$REPO" - echo "==========================================================" - git clone https://github.com/$USER/$REPO - echo "" - echo "Determining dependency version property key..." - echo "==========================================================" - wget https://raw.githubusercontent.com/wso2/product-is/master/.github/scripts/version_property_finder.py - VERSION_PROPERTY=$(python version_property_finder.py $REPO product-is 2>&1) - VERSION_PROPERTY_KEY="" - if [ "$VERSION_PROPERTY" != "invalid" ]; then - echo "Version property key for the $REPO is $VERSION_PROPERTY" - VERSION_PROPERTY_KEY=$VERSION_PROPERTY - else - echo "" - echo "==========================================================" - echo "$REPO is not yet supported! Exiting..." - echo "==========================================================" - echo "" - echo "::error::PR builder not supprted" - exit 1 - fi - - echo "" - echo "Property key found: $VERSION_PROPERTY_KEY" - cd $REPO - if [ "$REPO" = "carbon-kernel" ]; then - echo "" - echo "Checking out for 4.10.x branch..." - echo "==========================================================" - git checkout 4.10.x - elif [ "$REPO" = "carbon-deployment" ]; then - echo "" - echo "Checking out for 4.x.x branch in carbon-deployment..." - echo "==========================================================" - git checkout 4.x.x - elif [ "$REPO" = "carbon-analytics-common" ]; then - echo "" - echo "Checking out for 5.2.x branch in carbon-analytics-common..." - echo "==========================================================" - git checkout 5.2.x - elif [ "$REPO" = "carbon-identity-framework" ]; then - echo "" - echo "Checking out for 6.0.x branch in carbon-identity-framework..." - echo "==========================================================" - git checkout 6.0.x - elif [ "$REPO" = "identity-governance" ]; then - echo "" - echo "Checking out for 2.0.x branch in identity-governance..." - echo "==========================================================" - git checkout 2.0.x - fi - DEPENDENCY_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) - echo "Dependency Version: $DEPENDENCY_VERSION" - echo "" - echo "Applying PR $PULL_NUMBER as a diff..." - echo "==========================================================" - wget -q --output-document=diff.diff $PR_LINK.diff - cat diff.diff - echo "==========================================================" - git apply diff.diff || { - echo 'Applying diff failed. Exiting...' - echo "::error::Applying diff failed." - exit 1 - } - - echo "" - echo "Building dependency repo $REPO..." - echo "==========================================================" - - if [ "$JDK_VERSION" = "11" ]; then - export JAVA_HOME=$JAVA_11_HOME - else - export JAVA_HOME=$JAVA_8_HOME - fi - - if [ "$REPO" = "carbon-kernel" ]; then - mvn clean install -Dmaven.test.skip=true --batch-mode | tee mvn-build.log - else - mvn clean install --batch-mode | tee mvn-build.log - fi - - echo "" - echo "Dependency repo $REPO build complete." - echo "Built version: $DEPENDENCY_VERSION" - echo "==========================================================" - echo "" - - REPO_BUILD_STATUS=$(cat mvn-build.log | grep "\[INFO\] BUILD" | grep -oE '[^ ]+$') - REPO_TEST_RESULT_1=$(sed -n -e '/Results :/,/Tests run:/ p' mvn-build.log) - REPO_TEST_RESULT_2=$(sed -n -e '/\[INFO\] Results:/,/\[INFO\] Tests run:/ p' mvn-build.log) - - REPO_FINAL_RESULT=$( - echo "===========================================================" - echo "$REPO BUILD $REPO_BUILD_STATUS" - echo "==========================================================" - echo "" - echo "Built version: $DEPENDENCY_VERSION" - echo "" - echo "$REPO_TEST_RESULT_1" - echo "" - echo "$REPO_TEST_RESULT_2" - ) - - REPO_BUILD_RESULT_LOG_TEMP=$(echo "$REPO_FINAL_RESULT" | sed 's/$/%0A/') - REPO_BUILD_RESULT_LOG=$(echo $REPO_BUILD_RESULT_LOG_TEMP) - echo "::warning::$REPO_BUILD_RESULT_LOG" - - if [ "$REPO_BUILD_STATUS" != "SUCCESS" ]; then - echo "$REPO BUILD not successfull. Aborting." - echo "::error::$REPO BUILD not successfull. Check artifacts for logs." - exit 1 - fi - cd .. - - OUTBOUND_AUTH_OIDC_VERSION_PROPERTY_KEY="" - OUTBOUND_AUTH_OIDC_DEPENDENCY_VERSION="" - if [ "$REPO" = "carbon-kernel" ]; then - echo "" - echo "Building Outbound Auth OIDC repo..." - echo "==========================================================" - git clone $OUTBOUND_AUTH_OIDC_REPO_CLONE_LINK - OUTBOUND_AUTH_OIDC_VERSION_PROPERTY=$(python version_property_finder.py $OUTBOUND_AUTH_OIDC_REPO product-is 2>&1) - if [ "$OUTBOUND_AUTH_OIDC_VERSION_PROPERTY" != "invalid" ]; then - echo "Version property key for the $OUTBOUND_AUTH_OIDC_REPO is $OUTBOUND_AUTH_OIDC_VERSION_PROPERTY" - OUTBOUND_AUTH_OIDC_VERSION_PROPERTY_KEY=$OUTBOUND_AUTH_OIDC_VERSION_PROPERTY - else - echo "" - echo "==========================================================" - echo "Unable to find the version property for $OUTBOUND_AUTH_OIDC_REPO..." - echo "==========================================================" - echo "" - echo "::error::Unable to find the version property for $OUTBOUND_AUTH_OIDC_REPO..." - exit 1 - fi - cd $OUTBOUND_AUTH_OIDC_REPO - OUTBOUND_AUTH_OIDC_DEPENDENCY_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) - echo "Outbound Auth OIDC Dependency Version: $OUTBOUND_AUTH_OIDC_DEPENDENCY_VERSION" - echo "" - - KERNEL_VERSION_PROPERTY_KEY=carbon.kernel.version - echo "Updating carbon-kernel dependency version in identity-outbound-auth-oidc repo..." - echo "==========================================================" - echo "" - sed -i "s/<$KERNEL_VERSION_PROPERTY_KEY>.*<\/$KERNEL_VERSION_PROPERTY_KEY>/<$KERNEL_VERSION_PROPERTY_KEY>$DEPENDENCY_VERSION<\/$KERNEL_VERSION_PROPERTY_KEY>/" pom.xml - - echo "" - echo "Building repo $OUTBOUND_AUTH_OIDC_REPO..." - echo "==========================================================" - - - export JAVA_HOME=$JAVA_11_HOME - mvn clean install -Dmaven.test.skip=true --batch-mode | tee mvn-build.log - - echo "Repo $OUTBOUND_AUTH_OIDC_REPO build complete." - SUB_REPO_BUILD_STATUS=$(cat mvn-build.log | grep "\[INFO\] BUILD" | grep -oE '[^ ]+$') - - if [ "$SUB_REPO_BUILD_STATUS" != "SUCCESS" ]; then - echo "$OUTBOUND_AUTH_OIDC_REPO repo build not successfull. Aborting." - echo "::error::$OUTBOUND_AUTH_OIDC_REPO repo build not successfull. Aborting." - exit 1 - fi - - echo "" - echo "Built version: $OUTBOUND_AUTH_OIDC_DEPENDENCY_VERSION" - echo "==========================================================" - echo "" - cd .. - fi - - SCIM2_VERSION_PROPERTY_KEY="" - SCIM2_DEPENDENCY_VERSION="" - if [ "$REPO" = "charon" ]; then - echo "" - echo "Building SCIM2 repo..." - echo "==========================================================" - git clone $SCIM2_REPO_CLONE_LINK - SCIM2_VERSION_PROPERTY=$(python version_property_finder.py $SCIM2_REPO product-is 2>&1) - if [ "$SCIM2_VERSION_PROPERTY" != "invalid" ]; then - echo "Version property key for the $SCIM2_REPO is $SCIM2_VERSION_PROPERTY" - SCIM2_VERSION_PROPERTY_KEY=$SCIM2_VERSION_PROPERTY - else - echo "" - echo "==========================================================" - echo "Unable to find the version property for $SCIM2_REPO..." - echo "==========================================================" - echo "" - echo "::error::Unable to find the version property for $SCIM2_REPO..." - exit 1 - fi - cd $SCIM2_REPO - SCIM2_DEPENDENCY_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) - echo "SCIM2 Dependency Version: $SCIM2_DEPENDENCY_VERSION" - echo "" - - CHARON_VERSION_PROPERTY_KEY=charon.version - echo "Updating charon dependency version in $SCIM2_REPO repo..." - echo "==========================================================" - echo "" - sed -i "s/<$CHARON_VERSION_PROPERTY_KEY>.*<\/$CHARON_VERSION_PROPERTY_KEY>/<$CHARON_VERSION_PROPERTY_KEY>$DEPENDENCY_VERSION<\/$CHARON_VERSION_PROPERTY_KEY>/" pom.xml - - echo "" - echo "Building $SCIM2_REPO repo..." - echo "==========================================================" - - export JAVA_HOME=$JAVA_8_HOME - mvn clean install -Dmaven.test.skip=true --batch-mode | tee mvn-build.log - - echo "Repo $SCIM2_REPO build complete." - SUB_REPO_BUILD_STATUS=$(cat mvn-build.log | grep "\[INFO\] BUILD" | grep -oE '[^ ]+$') - - if [ "$SUB_REPO_BUILD_STATUS" != "SUCCESS" ]; then - echo "$SCIM2_REPO repo build not successfull. Aborting." - echo "::error::$SCIM2_REPO repo build not successfull. Aborting." - exit 1 - fi - - echo "" - echo "Built version: $SCIM2_DEPENDENCY_VERSION" - echo "==========================================================" - echo "" - cd .. - fi - - cd product-is - git checkout 7.x.x - - echo "Updating dependency version in product-is..." - echo "==========================================================" - echo "" - if [ "$REPO" = "charon" ]; then - echo "Updating SCIM2 version in product-is..." - echo "==========================================================" - echo "" - sed -i "s/<$SCIM2_VERSION_PROPERTY_KEY>.*<\/$SCIM2_VERSION_PROPERTY_KEY>/<$SCIM2_VERSION_PROPERTY_KEY>$SCIM2_DEPENDENCY_VERSION<\/$SCIM2_VERSION_PROPERTY_KEY>/" pom.xml - else - sed -i "s/<$VERSION_PROPERTY_KEY>.*<\/$VERSION_PROPERTY_KEY>/<$VERSION_PROPERTY_KEY>$DEPENDENCY_VERSION<\/$VERSION_PROPERTY_KEY>/" pom.xml - if [ "$REPO" = "carbon-kernel" ]; then - echo "Updating Outbound Auth OIDC version in product-is..." - echo "==========================================================" - echo "" - sed -i "s/<$OUTBOUND_AUTH_OIDC_VERSION_PROPERTY_KEY>.*<\/$OUTBOUND_AUTH_OIDC_VERSION_PROPERTY_KEY>/<$OUTBOUND_AUTH_OIDC_VERSION_PROPERTY_KEY>$OUTBOUND_AUTH_OIDC_DEPENDENCY_VERSION<\/$OUTBOUND_AUTH_OIDC_VERSION_PROPERTY_KEY>/" pom.xml - echo "Updating caron-kernel version in carbon.product..." - echo "==========================================================" - echo "" - KERNEL_DEPENDENCY_VERSION=$(echo $DEPENDENCY_VERSION | sed -e "s/-/./g") - echo "Dependency version for carbon.product : $KERNEL_DEPENDENCY_VERSION" - sed -i "s/version=\"4.10.*\"/version=\"$KERNEL_DEPENDENCY_VERSION\"/g" modules/p2-profile-gen/carbon.product - fi - fi - - export JAVA_HOME=$JAVA_11_HOME - cat pom.xml - mvn clean install --batch-mode | tee mvn-build.log - - PR_BUILD_STATUS=$(cat mvn-build.log | grep "\[INFO\] BUILD" | grep -oE '[^ ]+$') - PR_TEST_RESULT=$(sed -n -e '/\[INFO\] Results:/,/\[INFO\] Tests run:/ p' mvn-build.log) - - PR_BUILD_FINAL_RESULT=$( - echo "===========================================================" - echo "product-is BUILD $PR_BUILD_STATUS" - echo "==========================================================" - echo "" - echo "$PR_TEST_RESULT" - ) - - PR_BUILD_RESULT_LOG_TEMP=$(echo "$PR_BUILD_FINAL_RESULT" | sed 's/$/%0A/') - PR_BUILD_RESULT_LOG=$(echo $PR_BUILD_RESULT_LOG_TEMP) - echo "::warning::$PR_BUILD_RESULT_LOG" - - PR_BUILD_SUCCESS_COUNT=$(grep -o -i "\[INFO\] BUILD SUCCESS" mvn-build.log | wc -l) - if [ "$PR_BUILD_SUCCESS_COUNT" != "1" ]; then - echo "PR BUILD not successfull. Aborting." - echo "::error::PR BUILD not successfull. Check artifacts for logs." - exit 1 - fi -fi - -echo "" -echo "==========================================================" -echo "Build completed" -echo "==========================================================" -echo "" diff --git a/.github/scripts/pr-builder.sh b/.github/scripts/pr-builder.sh index 83c681ef493..08cc3cb0b15 100644 --- a/.github/scripts/pr-builder.sh +++ b/.github/scripts/pr-builder.sh @@ -23,7 +23,7 @@ PULL_NUMBER=$(echo $PR_LINK | awk -F'/' '{print $7}') echo " USER: $USER" echo " REPO: $REPO" echo " PULL_NUMBER: $PULL_NUMBER" -echo "::set-output name=REPO_NAME::$REPO" +echo "REPO_NAME=$REPO" >> $GITHUB_OUTPUT echo "==========================================================" echo "Cloning product-is" echo "==========================================================" diff --git a/.github/workflows/dependency-updater.yml b/.github/workflows/dependency-updater.yml index d24f231d7a1..f5597d178c1 100644 --- a/.github/workflows/dependency-updater.yml +++ b/.github/workflows/dependency-updater.yml @@ -50,7 +50,7 @@ jobs: - name: Update Dependencies id: builder_step run: | - echo "::set-output name=REPO_NAME::${{ env.REPOSITORY }}" + echo "REPO_NAME=${{ env.REPOSITORY }}" >> $GITHUB_OUTPUT echo "" echo "Starting dependency upgrade" echo "==========================================================" From ed50f52eb92923c229031b418e82891d60daf4cc Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Wed, 13 Nov 2024 11:29:08 +0530 Subject: [PATCH 17/32] Apply suggestions from code review Co-authored-by: Ayesha Jayasankha <51480027+ayeshajay@users.noreply.github.com> --- .github/scripts/pr-builder.sh | 2 +- .github/workflows/dependency-updater.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/pr-builder.sh b/.github/scripts/pr-builder.sh index 08cc3cb0b15..c191e75a666 100644 --- a/.github/scripts/pr-builder.sh +++ b/.github/scripts/pr-builder.sh @@ -23,7 +23,7 @@ PULL_NUMBER=$(echo $PR_LINK | awk -F'/' '{print $7}') echo " USER: $USER" echo " REPO: $REPO" echo " PULL_NUMBER: $PULL_NUMBER" -echo "REPO_NAME=$REPO" >> $GITHUB_OUTPUT +echo "REPO_NAME=$REPO" >> "$GITHUB_OUTPUT" echo "==========================================================" echo "Cloning product-is" echo "==========================================================" diff --git a/.github/workflows/dependency-updater.yml b/.github/workflows/dependency-updater.yml index f5597d178c1..4f960e19e55 100644 --- a/.github/workflows/dependency-updater.yml +++ b/.github/workflows/dependency-updater.yml @@ -50,7 +50,7 @@ jobs: - name: Update Dependencies id: builder_step run: | - echo "REPO_NAME=${{ env.REPOSITORY }}" >> $GITHUB_OUTPUT + echo "REPO_NAME=${{ env.REPOSITORY }}" >> "$GITHUB_OUTPUT" echo "" echo "Starting dependency upgrade" echo "==========================================================" From 2a365dd9c9ea53c71fbf64ec748fe30e1eed20b1 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Wed, 13 Nov 2024 11:56:57 +0530 Subject: [PATCH 18/32] Address review comments --- .../test/rest/api/user/common/model/PhoneNumbers.java | 2 +- .../test/rest/api/user/common/model/UserObject.java | 3 --- .../test/restclients/NotificationSenderRestClient.java | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java index cab2a92f30a..bd74affd7ef 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/PhoneNumbers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/UserObject.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/UserObject.java index a1ee9c75e19..ca2963ad363 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/UserObject.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/rest/api/user/common/model/UserObject.java @@ -145,9 +145,6 @@ public UserObject addEmail(Email email) { return this; } - /** - * - **/ public UserObject phoneNumbers(List phoneNumbers) { this.phoneNumbers = phoneNumbers; diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/restclients/NotificationSenderRestClient.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/restclients/NotificationSenderRestClient.java index 985849419f6..e6523008432 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/restclients/NotificationSenderRestClient.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/restclients/NotificationSenderRestClient.java @@ -42,7 +42,7 @@ public class NotificationSenderRestClient extends RestBaseClient { private final String username; private final String password; - public NotificationSenderRestClient(String serverUrl, Tenant tenantInfo){ + public NotificationSenderRestClient(String serverUrl, Tenant tenantInfo) { this.serverUrl = serverUrl; this.tenantDomain = tenantInfo.getContextUser().getUserDomain(); From 22a80a85d21fe7cf965e476de5e49f8547519cd3 Mon Sep 17 00:00:00 2001 From: Amanda Ariyaratne Date: Wed, 13 Nov 2024 13:14:12 +0530 Subject: [PATCH 19/32] change scim local attribute mapping --- .../rest/api/customSchema/SCIM2CustomSchemaMeTestCase.java | 2 +- .../rest/api/customSchema/SCIM2CustomSchemaUserTestCase.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/scim2/rest/api/customSchema/SCIM2CustomSchemaMeTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/scim2/rest/api/customSchema/SCIM2CustomSchemaMeTestCase.java index 4e8c4c67cf5..89ca5e534d2 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/scim2/rest/api/customSchema/SCIM2CustomSchemaMeTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/scim2/rest/api/customSchema/SCIM2CustomSchemaMeTestCase.java @@ -87,7 +87,7 @@ public class SCIM2CustomSchemaMeTestCase extends SCIM2BaseTest { private static final String MANAGER_EMAIL_CLAIM_ATTRIBUTE_URI = MANAGER_CLAIM_ATTRIBUTE_URI + "." + MANAGER_EMAIL_CLAIM_ATTRIBUTE_NAME; private static final String MANAGER_LOCAL_CLAIM_URI = "http://wso2.org/claims/manager"; - private static final String MANAGER_EMAIL_LOCAL_CLAIM_URI = "http://wso2.org/claims/emailaddress"; + private static final String MANAGER_EMAIL_LOCAL_CLAIM_URI = "http://wso2.org/claims/emails.work"; private static final String MANAGER_EMAIL_LOCAL_CLAIM_VALUE = "piraveena@gmail.com"; private static final String MANAGER_EMAIL_LOCAL_CLAIM_VALUE_AFTER_REPLACE = "piraveenaReplace@gmail.com"; diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/scim2/rest/api/customSchema/SCIM2CustomSchemaUserTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/scim2/rest/api/customSchema/SCIM2CustomSchemaUserTestCase.java index 57ba44cd3ba..3c5ca2cac1c 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/scim2/rest/api/customSchema/SCIM2CustomSchemaUserTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/scim2/rest/api/customSchema/SCIM2CustomSchemaUserTestCase.java @@ -88,7 +88,7 @@ public class SCIM2CustomSchemaUserTestCase extends SCIM2BaseTest { private static final String MANAGER_EMAIL_CLAIM_ATTRIBUTE_URI = MANAGER_CLAIM_ATTRIBUTE_URI + "." + MANAGER_EMAIL_CLAIM_ATTRIBUTE_NAME; private static final String MANAGER_LOCAL_CLAIM_URI = "http://wso2.org/claims/manager"; - private static final String MANAGER_EMAIL_LOCAL_CLAIM_URI = "http://wso2.org/claims/emailaddress"; + private static final String MANAGER_EMAIL_LOCAL_CLAIM_URI = "http://wso2.org/claims/emails.work"; private static final String MANAGER_EMAIL_LOCAL_CLAIM_VALUE = "piraveena@gmail.com"; private static final String MANAGER_EMAIL_LOCAL_CLAIM_VALUE_AFTER_REPLACE = "piraveenaReplace@gmail.com"; private static final String MANAGER_EMAIL_LOCAL_CLAIM_VALUE_AFTER_ADD = "piraveenaAdd@gmail.com"; From 7516c5e5ea9f6be8e1bfa49ad9debf60aef7dfab Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri <47152272+mpmadhavig@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:58:56 +0530 Subject: [PATCH 20/32] Bump oauth version. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 728b6025e07..ff9e03e5402 100755 --- a/pom.xml +++ b/pom.xml @@ -2386,7 +2386,7 @@ - 7.0.188 + 7.0.190 5.11.45 5.10.2 5.11.12 From 63f3041c1c4c91a8dc62113be742fa3210a82fcb Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Wed, 13 Nov 2024 17:35:35 +0530 Subject: [PATCH 21/32] Apply suggestions from code review Co-authored-by: Pamoda Wimalasiri --- .../test/auth/PasswordlessSMSOTPAuthTestCase.java | 4 ++-- .../identity/integration/test/base/MockSMSProvider.java | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java index 9b2232048b6..c03f7387772 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java @@ -198,7 +198,7 @@ private void sendAuthorizeRequest() throws Exception { getTenantQualifiedURL(AUTHORIZE_ENDPOINT_URL, tenantInfo.getDomain())); Header locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); - assertNotNull(locationHeader, "Location header expected for authorize request is not available"); + assertNotNull(locationHeader, "Location header expected for authorize request is not available."); EntityUtils.consume(response.getEntity()); response = sendGetRequest(client, locationHeader.getValue()); @@ -209,7 +209,7 @@ private void sendAuthorizeRequest() throws Exception { assertNotNull(keyValues, "SessionDataKey key value is null"); sessionDataKey = keyValues.get(0).getValue(); - assertNotNull(sessionDataKey, "Session data key is null"); + assertNotNull(sessionDataKey, "Session data key is null."); EntityUtils.consume(response.getEntity()); } diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/MockSMSProvider.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/MockSMSProvider.java index fa1f41ca837..7fa1693a5a5 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/MockSMSProvider.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/base/MockSMSProvider.java @@ -63,7 +63,7 @@ public void start() { @Override public Response transform(Response response, ServeEvent serveEvent) { - // Extract the content value from the request body + // Extract the content value from the request body. String content = JsonPath.parse(serveEvent.getRequest().getBodyAsString()).read("$.content"); @@ -74,7 +74,7 @@ public Response transform(Response response, ServeEvent serveEvent) { if (matcher.find()) { String extractedOtp = matcher.group(); - // Store the content value for later use + // Store the content value for later use. otp.set(extractedOtp); } return response; @@ -93,7 +93,7 @@ public String getName() { wireMockServer.start(); - // Configure the mock OIDC endpoints + // Configure the mock OIDC endpoints. configureMockEndpoints(); } @@ -122,5 +122,4 @@ public String getOTP() { return otp.get(); } - } From 02882a8211732d5a95a5d9d2e59f306103135243 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Thu, 14 Nov 2024 13:45:52 +0530 Subject: [PATCH 22/32] Fix assertNotNull message --- .../test/auth/PasswordlessSMSOTPAuthTestCase.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java index c03f7387772..c7ca4b0d849 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/auth/PasswordlessSMSOTPAuthTestCase.java @@ -174,7 +174,7 @@ public void atEnd() throws Exception { mockSMSProvider.stop(); } - @Test(groups = "wso2.is", description = "Test passwordless autehtncation with SMS OTP") + @Test(groups = "wso2.is", description = "Test passwordless authentication with SMS OTP") public void testPasswordlessAuthentication() throws Exception { sendAuthorizeRequest(); @@ -198,7 +198,7 @@ private void sendAuthorizeRequest() throws Exception { getTenantQualifiedURL(AUTHORIZE_ENDPOINT_URL, tenantInfo.getDomain())); Header locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); - assertNotNull(locationHeader, "Location header expected for authorize request is not available."); + assertNotNull(locationHeader, "Location header for authorize request"); EntityUtils.consume(response.getEntity()); response = sendGetRequest(client, locationHeader.getValue()); @@ -206,10 +206,10 @@ private void sendAuthorizeRequest() throws Exception { Map keyPositionMap = new HashMap<>(1); keyPositionMap.put("name=\"sessionDataKey\"", 1); List keyValues = DataExtractUtil.extractDataFromResponse(response, keyPositionMap); - assertNotNull(keyValues, "SessionDataKey key value is null"); + assertNotNull(keyValues, "Session data key"); sessionDataKey = keyValues.get(0).getValue(); - assertNotNull(sessionDataKey, "Session data key is null."); + assertNotNull(sessionDataKey, "Session data key"); EntityUtils.consume(response.getEntity()); } @@ -219,12 +219,12 @@ private void performUserLogin() throws Exception { HttpResponse response = sendLoginPostForOtp(client, sessionDataKey, mockSMSProvider.getOTP()); Header locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); - assertNotNull(locationHeader, "Location header expected post login is not available."); + assertNotNull(locationHeader, "Location header"); EntityUtils.consume(response.getEntity()); response = sendGetRequest(client, locationHeader.getValue()); locationHeader = response.getFirstHeader(OAuth2Constant.HTTP_RESPONSE_HEADER_LOCATION); - assertNotNull(locationHeader, "Redirection URL to the application with authorization code is null."); + assertNotNull(locationHeader, "Redirection URL to the application with authorization code"); EntityUtils.consume(response.getEntity()); authorizationCode = getAuthorizationCodeFromURL(locationHeader.getValue()); From 82fd09b0a2fa5999a7f5a6ad6d43fdb38fa4f015 Mon Sep 17 00:00:00 2001 From: Malith-19 Date: Thu, 14 Nov 2024 21:05:54 +0530 Subject: [PATCH 23/32] Update tests to support multi-channel support for the username recovery. --- .../test/idp/mgt/PreferenceAPIIntegrationUITestCase.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/idp/mgt/PreferenceAPIIntegrationUITestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/idp/mgt/PreferenceAPIIntegrationUITestCase.java index d306d9c941b..08b5cc77f53 100644 --- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/idp/mgt/PreferenceAPIIntegrationUITestCase.java +++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/identity/integration/test/idp/mgt/PreferenceAPIIntegrationUITestCase.java @@ -53,6 +53,8 @@ public class PreferenceAPIIntegrationUITestCase extends OAuth2ServiceAbstractInt private static final String ENABLE_SELF_REGISTRATION_PROP_KEY = "SelfRegistration.Enable"; private static final String ENABLE_USERNAME_RECOVERY_PROP_KEY = "Recovery.Notification.Username.Enable"; + private static final String ENABLE_USERNAME_EMAIL_RECOVERY_PROP_KEY = "Recovery.Notification.Username.Email.Enable"; + private static final String ENABLE_USERNAME_SMS_RECOVERY_PROP_KEY = "Recovery.Notification.Username.SMS.Enable"; private static final String ENABLE_PASSWORD_QS_RECOVERY_PROP_KEY = "Recovery.Question.Password.Enable"; private static final String ENABLE_PASSWORD_NOTIFICATION_RECOVERY_PROP_KEY = "Recovery.Notification.Password.Enable"; @@ -129,6 +131,8 @@ public void resetResidentIDP() throws Exception { updateResidentIDPProperties(superTenantResidentIDP, Map.of( ENABLE_SELF_REGISTRATION_PROP_KEY, "false", ENABLE_USERNAME_RECOVERY_PROP_KEY, "false", + ENABLE_USERNAME_EMAIL_RECOVERY_PROP_KEY, "false", + ENABLE_USERNAME_SMS_RECOVERY_PROP_KEY, "false", ENABLE_PASSWORD_QS_RECOVERY_PROP_KEY, "false", ENABLE_PASSWORD_NOTIFICATION_RECOVERY_PROP_KEY, "false", ENABLE_PASSWORD_EMAIL_LINK_RECOVERY_PROP_KEY, "false", @@ -155,7 +159,10 @@ public void testSelfRegistration() throws Exception { @Test(groups = "wso2.is", description = "Check Username recovery Login Page") public void testUsernameRecovery() throws Exception { - updateResidentIDPProperty(superTenantResidentIDP, ENABLE_USERNAME_RECOVERY_PROP_KEY, "true"); + updateResidentIDPProperties(superTenantResidentIDP, Map.of( + ENABLE_USERNAME_EMAIL_RECOVERY_PROP_KEY, "true", + ENABLE_USERNAME_RECOVERY_PROP_KEY, "true" + )); String content = sendAuthorizeRequest(); Assert.assertTrue(content.contains(RECOVERY_USERNAME_CONTENT)); } From 172a1ad37f107447b54b3888d1ecf3f5a4600770 Mon Sep 17 00:00:00 2001 From: Malith-19 Date: Thu, 14 Nov 2024 22:04:01 +0530 Subject: [PATCH 24/32] Bump the identity governance version. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ff9e03e5402..1d595a78720 100755 --- a/pom.xml +++ b/pom.xml @@ -2376,7 +2376,7 @@ 2.6.4 - 1.11.14 + 1.11.15 5.9.5 From 516aafc81692f3a30a2ded9ecddfa61fe62a396b Mon Sep 17 00:00:00 2001 From: Malith-19 Date: Fri, 15 Nov 2024 18:21:40 +0530 Subject: [PATCH 25/32] Bump the identity framework version. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1d595a78720..980c328e09e 100755 --- a/pom.xml +++ b/pom.xml @@ -2365,7 +2365,7 @@ - 7.6.7 + 7.6.9 [5.14.67, 8.0.0) From 5f4fcd3984ffcf0b7170a0088026cb0cb0de4691 Mon Sep 17 00:00:00 2001 From: jenkins-is-staging Date: Fri, 15 Nov 2024 17:02:04 +0000 Subject: [PATCH 26/32] Bump dependencies from IS_dependency_updater_github_action/11858549891 --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 980c328e09e..cd7f1e9414c 100755 --- a/pom.xml +++ b/pom.xml @@ -2464,7 +2464,7 @@ 1.0.19 1.0.7 - 1.4.53 + 1.4.54 1.1.17 1.1.39 1.1.26 @@ -2488,9 +2488,9 @@ 1.2.66 - 2.34.25 - 2.13.1 - 2.7.4 + 2.34.28 + 2.13.5 + 2.7.8 1.6.378 From d54fa95e558ddea1573c85f098bb752bd332173c Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri <47152272+mpmadhavig@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:06:43 +0530 Subject: [PATCH 27/32] Update java 11 distribution value. --- .github/workflows/oidc-conformance-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/oidc-conformance-test.yml b/.github/workflows/oidc-conformance-test.yml index 99b593f09ae..bd4d328dbfa 100644 --- a/.github/workflows/oidc-conformance-test.yml +++ b/.github/workflows/oidc-conformance-test.yml @@ -44,6 +44,7 @@ jobs: uses: actions/setup-java@v4 with: java-version: 11.0.18+10 + distribution: temurin - name: Setup Python run: | From b415ea4ef68f33c3d3c4d72a98baf3429053931e Mon Sep 17 00:00:00 2001 From: Madhavi Gayathri <47152272+mpmadhavig@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:08:55 +0530 Subject: [PATCH 28/32] Add missing dist for java 11 fapi-oidc-conformance-test.yml. --- .github/workflows/fapi-oidc-conformance-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/fapi-oidc-conformance-test.yml b/.github/workflows/fapi-oidc-conformance-test.yml index 42a499256ae..36829d3aec2 100644 --- a/.github/workflows/fapi-oidc-conformance-test.yml +++ b/.github/workflows/fapi-oidc-conformance-test.yml @@ -40,6 +40,7 @@ jobs: uses: actions/setup-java@v4 with: java-version: 11.0.18+10 + distribution: temurin - name: Setup Python run: | From c96aa383fe9e3ac7bbda7e8dc811d9fdd198216f Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Mon, 18 Nov 2024 20:49:14 +0530 Subject: [PATCH 29/32] HeapDumpOnOutOfMemoryError for maven build --- .github/workflows/dependency-updater.yml | 2 +- .github/workflows/pr-builder-test-JDK11.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dependency-updater.yml b/.github/workflows/dependency-updater.yml index 4f960e19e55..189939842b8 100644 --- a/.github/workflows/dependency-updater.yml +++ b/.github/workflows/dependency-updater.yml @@ -7,7 +7,7 @@ on: - cron: '0 15 * * *' env: - MAVEN_OPTS: -Xmx4g -Xms1g + MAVEN_OPTS: -Xmx4g -Xms1g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=heap-dump.hprof REPOSITORY: product-is GIT_USERNAME: jenkins-is-staging GIT_EMAIL: jenkins-is-staging@wso2.com diff --git a/.github/workflows/pr-builder-test-JDK11.yml b/.github/workflows/pr-builder-test-JDK11.yml index 944e27ac41b..a7de28f0785 100644 --- a/.github/workflows/pr-builder-test-JDK11.yml +++ b/.github/workflows/pr-builder-test-JDK11.yml @@ -13,7 +13,7 @@ on: required: true env: - MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Djdk.util.zip.disableZip64ExtraFieldValidation=true + MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Djdk.util.zip.disableZip64ExtraFieldValidation=true -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=heap-dump.hprof jobs: From 23614004b2c4a11dd0823ee80846524590935182 Mon Sep 17 00:00:00 2001 From: jenkins-is-staging Date: Mon, 18 Nov 2024 17:02:59 +0000 Subject: [PATCH 30/32] Bump dependencies from IS_dependency_updater_github_action/11895153660 --- pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index cd7f1e9414c..04601b9b5fa 100755 --- a/pom.xml +++ b/pom.xml @@ -2387,7 +2387,7 @@ 7.0.190 - 5.11.45 + 5.11.46 5.10.2 5.11.12 5.7.7 @@ -2407,7 +2407,7 @@ 1.9.12 - 1.9.18 + 1.9.19 @@ -2465,7 +2465,7 @@ 1.0.7 1.4.54 - 1.1.17 + 1.1.18 1.1.39 1.1.26 @@ -2482,15 +2482,15 @@ 5.5.9 5.5.9 - 2.3.2 + 2.4.0 2.5.18 1.1.13 1.2.66 - 2.34.28 - 2.13.5 - 2.7.8 + 2.35.0 + 2.13.6 + 2.8.0 1.6.378 From 4f1ba951098641450a9f8236c268cdf265b7d1d5 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Tue, 19 Nov 2024 09:38:54 +0530 Subject: [PATCH 31/32] Change heap dump path --- .github/workflows/dependency-updater.yml | 4 ++-- .github/workflows/pr-builder-test-JDK11.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dependency-updater.yml b/.github/workflows/dependency-updater.yml index 189939842b8..faf1b34b57b 100644 --- a/.github/workflows/dependency-updater.yml +++ b/.github/workflows/dependency-updater.yml @@ -7,7 +7,7 @@ on: - cron: '0 15 * * *' env: - MAVEN_OPTS: -Xmx4g -Xms1g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=heap-dump.hprof + MAVEN_OPTS: -Xmx4g -Xms1g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heap-dump.hprof REPOSITORY: product-is GIT_USERNAME: jenkins-is-staging GIT_EMAIL: jenkins-is-staging@wso2.com @@ -167,7 +167,7 @@ jobs: with: name: heap-dump path: | - product-is/**/heap-dump.hprof + **/**.hprof if-no-files-found: ignore - name: Google Chat Notification run: | diff --git a/.github/workflows/pr-builder-test-JDK11.yml b/.github/workflows/pr-builder-test-JDK11.yml index a7de28f0785..a650b81f065 100644 --- a/.github/workflows/pr-builder-test-JDK11.yml +++ b/.github/workflows/pr-builder-test-JDK11.yml @@ -13,7 +13,7 @@ on: required: true env: - MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Djdk.util.zip.disableZip64ExtraFieldValidation=true -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=heap-dump.hprof + MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Djdk.util.zip.disableZip64ExtraFieldValidation=true -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heap-dump.hprof jobs: @@ -123,7 +123,7 @@ jobs: with: name: heap-dump path: | - product-is/**/heap-dump.hprof + **/**.hprof if-no-files-found: ignore - name: Comment build status if: always() From c4be4d1cb54ec5170b03361a00626bf64a00aaeb Mon Sep 17 00:00:00 2001 From: Amanda Ariyaratne Date: Tue, 19 Nov 2024 14:28:16 +0530 Subject: [PATCH 32/32] bump api server version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 04601b9b5fa..28d2ea13354 100755 --- a/pom.xml +++ b/pom.xml @@ -2477,7 +2477,7 @@ 2.0.17 - 1.2.251 + 1.2.252 1.3.45 5.5.9