diff --git a/README.md b/README.md index 06e9810611b..0c6acc440f8 100644 --- a/README.md +++ b/README.md @@ -366,14 +366,14 @@ UserFactor userFactor = userFactorApi.getFactor("userId", "factorId"); [//]: # (method: enrollUserInFactor) ```java -UserFactorApiHelper userFactorApiHelper = new UserFactorApiHelper<>(new UserFactorApi(client)); +UserFactorApi userFactorApi = new UserFactorApi(client); SmsUserFactorProfile smsUserFactorProfile = new SmsUserFactorProfile(); smsUserFactorProfile.setPhoneNumber("555 867 5309"); SmsUserFactor smsUserFactor = new SmsUserFactor(); smsUserFactor.setProvider(FactorProvider.OKTA); smsUserFactor.setFactorType(FactorType.SMS); smsUserFactor.setProfile(smsUserFactorProfile); -userFactorApiHelper.enrollFactorOfType(SmsUserFactor.class, "userId", smsUserFactor, true, "templateId", 30, true); +userFactorApi.enrollFactor("userId", smsUserFactor, true, "templateId", 30, true); ``` [//]: # (end: enrollUserInFactor) @@ -381,11 +381,11 @@ userFactorApiHelper.enrollFactorOfType(SmsUserFactor.class, "userId", smsUserFac [//]: # (method: activateFactor) ```java -UserFactorApiHelper userFactorApiHelper = new UserFactorApiHelper<>(new UserFactorApi(client)); -CallUserFactor userFactor = (CallUserFactor) userFactorApiHelper.getFactor("userId", "factorId"); +UserFactorApi userFactorApi = new UserFactorApi(client); +CallUserFactor userFactor = (CallUserFactor) userFactorApi.getFactor("userId", "factorId"); ActivateFactorRequest activateFactorRequest = new ActivateFactorRequest(); activateFactorRequest.setPassCode("123456"); -userFactorApiHelper.activateFactorOfType(CallUserFactor.class, "userId", "factorId", activateFactorRequest); +userFactorApi.activateFactor("userId", "factorId", activateFactorRequest); ``` [//]: # (end: activateFactor) @@ -393,12 +393,12 @@ userFactorApiHelper.activateFactorOfType(CallUserFactor.class, "userId", "factor [//]: # (method: verifyFactor) ```java -UserFactorApiHelper userFactorApiHelper = new UserFactorApiHelper<>(new UserFactorApi(client)); -UserFactor userFactor = userFactorApiHelper.getFactor( "userId", "factorId"); +UserFactorApi userFactorApi = new UserFactorApi(client); +UserFactor userFactor = userFactorApi.getFactor( "userId", "factorId"); VerifyFactorRequest verifyFactorRequest = new VerifyFactorRequest(); verifyFactorRequest.setPassCode("123456"); VerifyUserFactorResponse verifyUserFactorResponse = - userFactorApiHelper.verifyFactor("userId", "factorId", "templateId", 10, "xForwardedFor", "userAgent", "acceptLanguage", verifyFactorRequest); + userFactorApi.verifyFactor("userId", "factorId", "templateId", 10, "xForwardedFor", "userAgent", "acceptLanguage", verifyFactorRequest); ``` [//]: # (end: verifyFactor) @@ -406,7 +406,7 @@ VerifyUserFactorResponse verifyUserFactorResponse = [//]: # (method: createSwaApplication) ```java -ApplicationApiHelper applicationApiHelper = new ApplicationApiHelper<>(new ApplicationApi(client)); +ApplicationApi applicationApi = new ApplicationApi(client); SwaApplicationSettingsApplication swaApplicationSettingsApplication = new SwaApplicationSettingsApplication(); swaApplicationSettingsApplication.buttonField("btn-login") .passwordField("txtbox-password") @@ -421,7 +421,7 @@ browserPluginApplication.settings(swaApplicationSettings); // create BrowserPluginApplication app type BrowserPluginApplication createdApp = - applicationApiHelper.createApplicationOfType(BrowserPluginApplication.class, browserPluginApplication, true, null); + (BrowserPluginApplication) applicationApi.createApplication(browserPluginApplication, true, null); ``` [//]: # (end: createSwaApplication) diff --git a/api/src/main/java/com/okta/sdk/helper/ApplicationApiHelper.java b/api/src/main/java/com/okta/sdk/helper/ApplicationApiHelper.java deleted file mode 100644 index 2a2357ceb8f..00000000000 --- a/api/src/main/java/com/okta/sdk/helper/ApplicationApiHelper.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2023-Present Okta, Inc. - * - * Licensed 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 com.okta.sdk.helper; - -import com.fasterxml.jackson.core.type.TypeReference; -import org.apache.hc.core5.http.HttpStatus; -import com.okta.sdk.resource.client.ApiClient; -import com.okta.sdk.resource.client.ApiException; -import com.okta.sdk.resource.client.Pair; -import com.okta.sdk.resource.api.ApplicationApi; -import com.okta.sdk.resource.model.*; - -import java.lang.reflect.Type; -import java.util.*; - -import static com.okta.sdk.helper.HelperConstants.*; -import static com.okta.sdk.helper.HelperUtil.getApplicationType; - -/** - * Helper class that enables working with subclassed {@link Application} references. - */ -public final class ApplicationApiHelper extends ApplicationApi { - - public ApplicationApiHelper(ApplicationApi applicationApi) { - super(applicationApi.getApiClient()); - } - - public ApplicationApiHelper(ApiClient apiClient) { - super(apiClient); - } - - public T createApplicationOfType(Class classType, - Application application, - Boolean activate, - String oktaAccessGatewayAgent) throws ApiException { - - ApiClient apiClient = getApiClient(); - - // verify the required parameter 'application' is set - if (application == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, - "Missing the required parameter 'application' when calling createApplication"); - } - - // create path and map variables - String localVarPath = "/api/v1/apps"; - - List localVarQueryParams = new ArrayList<>(apiClient.parameterToPair("activate", activate)); - Map localVarHeaderParams = new HashMap<>(); - - if (oktaAccessGatewayAgent != null) { - localVarHeaderParams.put("OktaAccessGateway-Agent", apiClient.parameterToString(oktaAccessGatewayAgent)); - } - - TypeReference localVarReturnType = new TypeReference() { - @Override - public Type getType() { - return classType; - } - }; - - return apiClient.invokeAPI( - localVarPath, - HttpMethod.POST.name(), - localVarQueryParams, - new ArrayList<>(), - QUERY_STRING_JOINER.toString(), - application, - localVarHeaderParams, - new HashMap<>(), - new HashMap<>(), - apiClient.selectHeaderAccept(MEDIA_TYPE), - apiClient.selectHeaderContentType(MEDIA_TYPE), - AUTH_NAMES, - localVarReturnType - ); - } - - public T replaceApplicationOfType(Class classType, - String appId, - Application application) throws ApiException { - - ApiClient apiClient = getApiClient(); - - // verify the required parameter 'appId' is set - if (appId == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'appId' when calling replaceApplication"); - } - - // verify the required parameter 'application' is set - if (application == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'application' when calling replaceApplication"); - } - - // create path and map variables - String localVarPath = "/api/v1/apps/{appId}" - .replaceAll("\\{" + "appId" + "\\}", apiClient.escapeString(appId)); - - TypeReference localVarReturnType = new TypeReference() { - @Override - public Type getType() { - return classType; - } - }; - - T app = apiClient.invokeAPI( - localVarPath, - HttpMethod.PUT.name(), - new ArrayList<>(), - new ArrayList<>(), - QUERY_STRING_JOINER.toString(), - application, - new HashMap<>(), - new HashMap<>(), - new HashMap<>(), - apiClient.selectHeaderAccept(MEDIA_TYPE), - apiClient.selectHeaderContentType(MEDIA_TYPE), - AUTH_NAMES, - localVarReturnType - ); - - return (T) getObjectMapper().convertValue(app, getApplicationType(app)); - } -} diff --git a/api/src/main/java/com/okta/sdk/helper/HelperUtil.java b/api/src/main/java/com/okta/sdk/helper/HelperUtil.java deleted file mode 100644 index 954539b9385..00000000000 --- a/api/src/main/java/com/okta/sdk/helper/HelperUtil.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2023-Present Okta, Inc. - * - * Licensed 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 com.okta.sdk.helper; - -import com.okta.commons.lang.Assert; -import com.okta.sdk.resource.model.*; - -import java.util.Objects; - -public class HelperUtil { - - public static Class getApplicationType(Application application) { - - Assert.notNull(application); - - if (Objects.isNull(application.getSignOnMode())) { - return Application.class; - } - - switch (application.getSignOnMode()) { - case AUTO_LOGIN: - return AutoLoginApplication.class; - case BASIC_AUTH: - return BasicAuthApplication.class; - case BOOKMARK: - return BookmarkApplication.class; - case BROWSER_PLUGIN: - return BrowserPluginApplication.class; - case OPENID_CONNECT: - return OpenIdConnectApplication.class; - case SAML_1_1: - case SAML_2_0: - return SamlApplication.class; - case SECURE_PASSWORD_STORE: - return SecurePasswordStoreApplication.class; - case WS_FEDERATION: - return WsFederationApplication.class; - default: - return Application.class; - } - } - - public static Class getPolicyType(Policy policy) { - - Assert.notNull(policy); - - if (Objects.isNull(policy.getType())) { - return Policy.class; - } - - switch (policy.getType()) { - case ACCESS_POLICY: - return AccessPolicy.class; - case IDP_DISCOVERY: - return IdentityProviderPolicy.class; - case MFA_ENROLL: - return MultifactorEnrollmentPolicy.class; - case OKTA_SIGN_ON: - return OktaSignOnPolicy.class; - case PASSWORD: - return PasswordPolicy.class; - case PROFILE_ENROLLMENT: - return ProfileEnrollmentPolicy.class; - } - - return Policy.class; - } - - public static Class getUserFactorType(UserFactor userFactor) { - - Assert.notNull(userFactor); - - if (Objects.isNull(userFactor.getFactorType())) { - return UserFactor.class; - } - - switch (userFactor.getFactorType()) { - case CALL: - return CallUserFactor.class; - - case EMAIL: - return EmailUserFactor.class; - - case PUSH: - return PushUserFactor.class; - - case SMS: - return SmsUserFactor.class; - - case QUESTION: - return SecurityQuestionUserFactor.class; - - case TOKEN: - return TokenUserFactor.class; - - case TOKEN_HARDWARE: - return HardwareUserFactor.class; - - case TOKEN_HOTP: - return CustomHotpUserFactor.class; - - case TOKEN_SOFTWARE_TOTP: - return TotpUserFactor.class; - - case U2F: - return U2fUserFactor.class; - - case WEB: - return WebUserFactor.class; - - case WEBAUTHN: - return WebAuthnUserFactor.class; - - default: - return UserFactor.class; - } - } - - public static Class getPolicyRuleType(PolicyRule policyRule) { - - Assert.notNull(policyRule); - - if (Objects.isNull(policyRule.getType())) { - return PolicyRule.class; - } - - switch (policyRule.getType()) { - case ACCESS_POLICY: - return AccessPolicyRule.class; - - case IDP_DISCOVERY: - return AuthorizationServerPolicyRule.class; - - case PASSWORD: - return PasswordPolicyRule.class; - - case PROFILE_ENROLLMENT: - return ProfileEnrollmentPolicyRule.class; - - case SIGN_ON: - return OktaSignOnPolicyRule.class; - - default: - return PolicyRule.class; - } - } -} diff --git a/api/src/main/java/com/okta/sdk/helper/PolicyApiHelper.java b/api/src/main/java/com/okta/sdk/helper/PolicyApiHelper.java deleted file mode 100644 index 255c973c79b..00000000000 --- a/api/src/main/java/com/okta/sdk/helper/PolicyApiHelper.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2023-Present Okta, Inc. - * - * Licensed 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 com.okta.sdk.helper; - -import com.fasterxml.jackson.core.type.TypeReference; -import org.apache.hc.core5.http.HttpStatus; -import com.okta.sdk.resource.client.ApiClient; -import com.okta.sdk.resource.client.ApiException; -import com.okta.sdk.resource.client.Pair; -import com.okta.sdk.resource.api.PolicyApi; -import com.okta.sdk.resource.model.HttpMethod; -import com.okta.sdk.resource.model.Policy; -import com.okta.sdk.resource.model.PolicyRule; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import static com.okta.sdk.helper.HelperConstants.*; - -/** - * Helper class that enables working with sub-typed {@link Policy} references. - */ -public class PolicyApiHelper extends PolicyApi { - - public PolicyApiHelper(PolicyApi policyApi) { - super(policyApi.getApiClient()); - } - - public PolicyApiHelper(ApiClient apiClient) { - super(apiClient); - } - - public T createPolicyOfType(Class classType, - Policy policy, - Boolean activate) throws ApiException { - - ApiClient apiClient = getApiClient(); - - // verify the required parameter 'policy' is set - if (policy == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'policy' when calling createPolicy"); - } - - // create path and map variables - String localVarPath = "/api/v1/policies"; - - List localVarQueryParams = new ArrayList<>(apiClient.parameterToPair("activate", activate)); - - final String localVarAccept = apiClient.selectHeaderAccept(MEDIA_TYPE); - final String localVarContentType = apiClient.selectHeaderContentType(MEDIA_TYPE); - - TypeReference localVarReturnType = new TypeReference() { - @Override - public Type getType() { - return classType; - } - }; - - return apiClient.invokeAPI( - localVarPath, - HttpMethod.POST.name(), - localVarQueryParams, - new ArrayList<>(), - QUERY_STRING_JOINER.toString(), - policy, - new HashMap<>(), - new HashMap<>(), - new HashMap<>(), - localVarAccept, - localVarContentType, - AUTH_NAMES, - localVarReturnType - ); - } - - public T createPolicyRuleOfType(Class classType, - String policyId, - PolicyRule policyRule) throws ApiException { - - ApiClient apiClient = getApiClient(); - - // verify the required parameter 'policyId' is set - if (policyId == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'policyId' when calling createPolicyRule"); - } - - // verify the required parameter 'policyRule' is set - if (policyRule == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'policyRule' when calling createPolicyRule"); - } - - // create path and map variables - String localVarPath = "/api/v1/policies/{policyId}/rules" - .replaceAll("\\{" + "policyId" + "\\}", apiClient.escapeString(policyId)); - - final String localVarAccept = apiClient.selectHeaderAccept(MEDIA_TYPE); - final String localVarContentType = apiClient.selectHeaderContentType(MEDIA_TYPE); - - TypeReference localVarReturnType = new TypeReference() { - @Override - public Type getType() { - return classType; - } - }; - - return apiClient.invokeAPI( - localVarPath, - HttpMethod.POST.name(), - new ArrayList<>(), - new ArrayList<>(), - QUERY_STRING_JOINER.toString(), - policyRule, - new HashMap<>(), - new HashMap<>(), - new HashMap<>(), - localVarAccept, - localVarContentType, - AUTH_NAMES, - localVarReturnType - ); - } -} \ No newline at end of file diff --git a/api/src/main/java/com/okta/sdk/helper/UserFactorApiHelper.java b/api/src/main/java/com/okta/sdk/helper/UserFactorApiHelper.java deleted file mode 100644 index 626bbb566f5..00000000000 --- a/api/src/main/java/com/okta/sdk/helper/UserFactorApiHelper.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright 2023-Present Okta, Inc. - * - * Licensed 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 com.okta.sdk.helper; - -import com.fasterxml.jackson.core.type.TypeReference; -import org.apache.hc.core5.http.HttpStatus; -import com.okta.sdk.resource.client.ApiClient; -import com.okta.sdk.resource.client.ApiException; -import com.okta.sdk.resource.client.Pair; -import com.okta.sdk.resource.api.UserFactorApi; -import com.okta.sdk.resource.model.*; - -import java.lang.reflect.Type; -import java.util.*; - -import static com.okta.sdk.helper.HelperConstants.*; -import static com.okta.sdk.helper.HelperUtil.*; - -/** - * Helper class that enables working with sub-typed {@link UserFactor} references. - */ -public class UserFactorApiHelper extends UserFactorApi { - - public UserFactorApiHelper(UserFactorApi userFactorApi) { - super(userFactorApi.getApiClient()); - } - - public UserFactorApiHelper(ApiClient apiClient) { - super(apiClient); - } - public T activateFactorOfType(Class classType, - String userId, - String factorId, - ActivateFactorRequest activateFactorRequest) throws ApiException { - - ApiClient apiClient = getApiClient(); - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'userId' when calling activateFactor"); - } - - // verify the required parameter 'factorId' is set - if (factorId == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'factorId' when calling activateFactor"); - } - - // create path and map variables - String localVarPath = "/api/v1/users/{userId}/factors/{factorId}/lifecycle/activate" - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId)) - .replaceAll("\\{" + "factorId" + "\\}", apiClient.escapeString(factorId)); - - TypeReference localVarReturnType = new TypeReference() { - @Override - public Type getType() { - return classType; - } - }; - - return apiClient.invokeAPI( - localVarPath, - HttpMethod.POST.name(), - new ArrayList<>(), - new ArrayList<>(), - QUERY_STRING_JOINER.toString(), - activateFactorRequest, - new HashMap<>(), - new HashMap<>(), - new HashMap<>(), - apiClient.selectHeaderAccept(MEDIA_TYPE), - apiClient.selectHeaderContentType(MEDIA_TYPE), - AUTH_NAMES, - localVarReturnType - ); - } - - public T enrollFactorOfType(Class classType, String userId, UserFactor userFactor, - Boolean updatePhone, String templateId, - Integer tokenLifetimeSeconds, Boolean activate) throws ApiException { - - ApiClient apiClient = getApiClient(); - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'userId' when calling enrollFactor"); - } - - // verify the required parameter 'body' is set - if (userFactor == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'body' when calling enrollFactor"); - } - - // create path and map variables - String localVarPath = "/api/v1/users/{userId}/factors" - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId)); - - List localVarQueryParams = new ArrayList<>(); - localVarQueryParams.addAll(apiClient.parameterToPair("updatePhone", updatePhone)); - localVarQueryParams.addAll(apiClient.parameterToPair("templateId", templateId)); - localVarQueryParams.addAll(apiClient.parameterToPair("tokenLifetimeSeconds", tokenLifetimeSeconds)); - localVarQueryParams.addAll(apiClient.parameterToPair("activate", activate)); - - TypeReference localVarReturnType = new TypeReference() { - @Override - public Type getType() { - return classType; - } - }; - - T usrFactor = apiClient.invokeAPI( - localVarPath, - HttpMethod.POST.name(), - localVarQueryParams, - new ArrayList<>(), - QUERY_STRING_JOINER.toString(), - userFactor, - new HashMap<>(), - new HashMap<>(), - new HashMap<>(), - apiClient.selectHeaderAccept(MEDIA_TYPE), - apiClient.selectHeaderContentType(MEDIA_TYPE), - AUTH_NAMES, - localVarReturnType - ); - - return (T) getObjectMapper().convertValue(usrFactor, getUserFactorType(userFactor)); - } - - public T resendEnrollFactorOfType(Class classType, String userId, String factorId, - UserFactor userFactor, String templateId) throws ApiException { - - ApiClient apiClient = getApiClient(); - - // verify the required parameter 'userId' is set - if (userId == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'userId' when calling resendEnrollFactor"); - } - - // verify the required parameter 'factorId' is set - if (factorId == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'factorId' when calling resendEnrollFactor"); - } - - // verify the required parameter 'userFactor' is set - if (userFactor == null) { - throw new ApiException(HttpStatus.SC_BAD_REQUEST, "Missing the required parameter 'userFactor' when calling resendEnrollFactor"); - } - - // create path and map variables - String localVarPath = "/api/v1/users/{userId}/factors/{factorId}/resend" - .replaceAll("\\{" + "userId" + "\\}", apiClient.escapeString(userId)) - .replaceAll("\\{" + "factorId" + "\\}", apiClient.escapeString(factorId)); - - List localVarQueryParams = new ArrayList<>(apiClient.parameterToPair("templateId", templateId)); - - TypeReference localVarReturnType = new TypeReference() { - @Override - public Type getType() { - return classType; - } - }; - - T usrFactor = apiClient.invokeAPI( - localVarPath, - HttpMethod.POST.name(), - localVarQueryParams, - new ArrayList<>(), - QUERY_STRING_JOINER.toString(), - userFactor, - new HashMap<>(), - new HashMap<>(), - new HashMap<>(), - apiClient.selectHeaderAccept(MEDIA_TYPE), - apiClient.selectHeaderContentType(MEDIA_TYPE), - AUTH_NAMES, - localVarReturnType - ); - - return (T) getObjectMapper().convertValue(usrFactor, getUserFactorType(usrFactor)); - } -} \ No newline at end of file diff --git a/api/src/main/resources/custom_templates/pojo.mustache b/api/src/main/resources/custom_templates/pojo.mustache index 4eaf3124cbb..181d7cab482 100644 --- a/api/src/main/resources/custom_templates/pojo.mustache +++ b/api/src/main/resources/custom_templates/pojo.mustache @@ -29,7 +29,7 @@ @JsonTypeName("{{name}}") {{/isClassnameSanitized}} {{/jackson}} -{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{>xmlAnnotation}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} {{#vendorExtensions.x-class-extra-annotation}} {{{vendorExtensions.x-class-extra-annotation}}} {{/vendorExtensions.x-class-extra-annotation}} diff --git a/examples/quickstart/src/main/java/quickstart/ReadmeSnippets.java b/examples/quickstart/src/main/java/quickstart/ReadmeSnippets.java index f7fefc56f16..f04011deae4 100644 --- a/examples/quickstart/src/main/java/quickstart/ReadmeSnippets.java +++ b/examples/quickstart/src/main/java/quickstart/ReadmeSnippets.java @@ -22,8 +22,6 @@ import com.okta.sdk.client.AuthenticationScheme; import com.okta.sdk.client.AuthorizationMode; import com.okta.sdk.client.Clients; -import com.okta.sdk.helper.ApplicationApiHelper; -import com.okta.sdk.helper.UserFactorApiHelper; import com.okta.sdk.resource.common.PagedList; import com.okta.sdk.resource.group.GroupBuilder; import com.okta.sdk.resource.user.UserBuilder; @@ -208,7 +206,7 @@ private void getUserFactor() throws ApiException { } private void enrollUserInFactor() throws ApiException { - UserFactorApiHelper userFactorApiHelper = new UserFactorApiHelper<>(new UserFactorApi(client)); + UserFactorApi userFactorApi = new UserFactorApi(client); SmsUserFactorProfile smsUserFactorProfile = new SmsUserFactorProfile(); smsUserFactorProfile.setPhoneNumber("555 867 5309"); @@ -218,28 +216,28 @@ private void enrollUserInFactor() throws ApiException { smsUserFactor.setFactorType(FactorType.SMS); smsUserFactor.setProfile(smsUserFactorProfile); - userFactorApiHelper.enrollFactorOfType(SmsUserFactor.class, "userId", smsUserFactor, true, "templateId", 30, true); + userFactorApi.enrollFactor("userId", smsUserFactor, true, "templateId", 30, true); } private void activateFactor() throws ApiException { - UserFactorApiHelper userFactorApiHelper = new UserFactorApiHelper<>(new UserFactorApi(client)); + UserFactorApi userFactorApi = new UserFactorApi(client); - CallUserFactor userFactor = (CallUserFactor) userFactorApiHelper.getFactor("userId", "factorId"); + CallUserFactor userFactor = (CallUserFactor) userFactorApi.getFactor("userId", "factorId"); ActivateFactorRequest activateFactorRequest = new ActivateFactorRequest(); activateFactorRequest.setPassCode("123456"); - userFactorApiHelper.activateFactorOfType(CallUserFactor.class, "userId", "factorId", activateFactorRequest); + userFactorApi.activateFactor("userId", "factorId", activateFactorRequest); } private void verifyFactor() throws ApiException { - UserFactorApiHelper userFactorApiHelper = new UserFactorApiHelper<>(new UserFactorApi(client)); + UserFactorApi userFactorApi = new UserFactorApi(client); - UserFactor userFactor = userFactorApiHelper.getFactor( "userId", "factorId"); + UserFactor userFactor = userFactorApi.getFactor( "userId", "factorId"); VerifyFactorRequest verifyFactorRequest = new VerifyFactorRequest(); verifyFactorRequest.setPassCode("123456"); VerifyUserFactorResponse verifyUserFactorResponse = - userFactorApiHelper.verifyFactor("userId", "factorId", "templateId", 10, "xForwardedFor", "userAgent", "acceptLanguage", verifyFactorRequest); + userFactorApi.verifyFactor("userId", "factorId", "templateId", 10, "xForwardedFor", "userAgent", "acceptLanguage", verifyFactorRequest); } private void listApplications() throws ApiException { @@ -255,7 +253,7 @@ private void getApplication() throws ApiException { } private void createSwaApplication() throws ApiException { - ApplicationApiHelper applicationApiHelper = new ApplicationApiHelper<>(new ApplicationApi(client)); + ApplicationApi applicationApi = new ApplicationApi(client); SwaApplicationSettingsApplication swaApplicationSettingsApplication = new SwaApplicationSettingsApplication(); swaApplicationSettingsApplication.buttonField("btn-login") @@ -271,7 +269,7 @@ private void createSwaApplication() throws ApiException { // create BrowserPluginApplication app type BrowserPluginApplication createdApp = - applicationApiHelper.createApplicationOfType(BrowserPluginApplication.class, browserPluginApplication, true, null); + (BrowserPluginApplication) applicationApi.createApplication(browserPluginApplication, true, null); } private void listPolicies() throws ApiException { diff --git a/impl/src/main/java/com/okta/sdk/impl/client/DefaultClientBuilder.java b/impl/src/main/java/com/okta/sdk/impl/client/DefaultClientBuilder.java index 1c135461ab9..86ed7402d54 100644 --- a/impl/src/main/java/com/okta/sdk/impl/client/DefaultClientBuilder.java +++ b/impl/src/main/java/com/okta/sdk/impl/client/DefaultClientBuilder.java @@ -34,12 +34,7 @@ import com.okta.sdk.client.ClientBuilder; import com.okta.sdk.impl.api.DefaultClientCredentialsResolver; import com.okta.sdk.impl.config.*; -import com.okta.sdk.impl.deserializer.ApplicationDeserializer; -import com.okta.sdk.impl.deserializer.PolicyDeserializer; -import com.okta.sdk.impl.deserializer.UserFactorDeserializer; import com.okta.sdk.impl.deserializer.UserProfileDeserializer; -import com.okta.sdk.impl.deserializer.PolicyRuleDeserializer; -import com.okta.sdk.impl.deserializer.PolymorphicMixIns; import com.okta.sdk.impl.io.ClasspathResource; import com.okta.sdk.impl.io.DefaultResourceFactory; import com.okta.sdk.impl.io.Resource; @@ -72,10 +67,6 @@ import com.okta.sdk.resource.client.ApiClient; -import com.okta.sdk.resource.model.Application; -import com.okta.sdk.resource.model.Policy; -import com.okta.sdk.resource.model.PolicyRule; -import com.okta.sdk.resource.model.UserFactor; import com.okta.sdk.resource.model.UserProfile; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -469,11 +460,6 @@ private void addCustomSerializerAndDeserializers(ApiClient apiClient) { SimpleModule module = new SimpleModule(); module.addSerializer(UserProfile.class, new UserProfileSerializer()); module.addDeserializer(UserProfile.class, new UserProfileDeserializer()); - module.addDeserializer(Application.class, new ApplicationDeserializer()); - module.addDeserializer(Policy.class, new PolicyDeserializer()); - module.addDeserializer(PolicyRule.class, new PolicyRuleDeserializer()); - module.addDeserializer(UserFactor.class, new UserFactorDeserializer()); - PolymorphicMixIns.MIX_INS.forEach(module::setMixInAnnotation); mapper.registerModule(module); } diff --git a/impl/src/main/java/com/okta/sdk/impl/deserializer/ApplicationDeserializer.java b/impl/src/main/java/com/okta/sdk/impl/deserializer/ApplicationDeserializer.java deleted file mode 100644 index 3673e232a08..00000000000 --- a/impl/src/main/java/com/okta/sdk/impl/deserializer/ApplicationDeserializer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2023-Present Okta, Inc. - * - * Licensed 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 com.okta.sdk.impl.deserializer; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.okta.sdk.helper.HelperUtil; -import com.okta.sdk.resource.client.ApiClient; -import com.okta.sdk.resource.model.Application; -import org.openapitools.jackson.nullable.JsonNullableModule; - -import java.io.IOException; - -public class ApplicationDeserializer extends StdDeserializer { - - private static final long serialVersionUID = 7913792877251441849L; - - private ObjectMapper objectMapper; - - public ApplicationDeserializer() { - this(null); - objectMapper = new ObjectMapper(); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); - objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); - objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - objectMapper.registerModule(new JavaTimeModule()); - objectMapper.registerModule(new JsonNullableModule()); - objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat()); - } - - public ApplicationDeserializer(Class vc) { - super(vc); - } - - @Override - public Application deserialize(JsonParser jp, DeserializationContext deserializationContext) throws IOException { - - JsonNode node = jp.getCodec().readTree(jp); - Application application = objectMapper.convertValue(node, Application.class); - return objectMapper.convertValue(node, HelperUtil.getApplicationType(application)); - } -} diff --git a/impl/src/main/java/com/okta/sdk/impl/deserializer/PolicyDeserializer.java b/impl/src/main/java/com/okta/sdk/impl/deserializer/PolicyDeserializer.java deleted file mode 100644 index 8758cbd22ca..00000000000 --- a/impl/src/main/java/com/okta/sdk/impl/deserializer/PolicyDeserializer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2023-Present Okta, Inc. - * - * Licensed 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 com.okta.sdk.impl.deserializer; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.okta.sdk.helper.HelperUtil; -import com.okta.sdk.resource.client.ApiClient; -import com.okta.sdk.resource.model.Policy; -import org.openapitools.jackson.nullable.JsonNullableModule; - -import java.io.IOException; - -public class PolicyDeserializer extends StdDeserializer { - - private static final long serialVersionUID = -5853722162964413892L; - - private ObjectMapper objectMapper; - - public PolicyDeserializer() { - this(null); - objectMapper = new ObjectMapper(); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); - objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); - objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - objectMapper.registerModule(new JavaTimeModule()); - objectMapper.registerModule(new JsonNullableModule()); - objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat()); - } - - public PolicyDeserializer(Class vc) { - super(vc); - } - - @Override - public Policy deserialize(JsonParser jp, DeserializationContext deserializationContext) throws IOException { - - JsonNode node = jp.getCodec().readTree(jp); - Policy policy = objectMapper.convertValue(node, Policy.class); - return objectMapper.convertValue(node, HelperUtil.getPolicyType(policy)); - } -} diff --git a/impl/src/main/java/com/okta/sdk/impl/deserializer/PolicyRuleDeserializer.java b/impl/src/main/java/com/okta/sdk/impl/deserializer/PolicyRuleDeserializer.java deleted file mode 100644 index 027a9af8457..00000000000 --- a/impl/src/main/java/com/okta/sdk/impl/deserializer/PolicyRuleDeserializer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2023-Present Okta, Inc. - * - * Licensed 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 com.okta.sdk.impl.deserializer; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.okta.sdk.helper.HelperUtil; -import com.okta.sdk.resource.client.ApiClient; -import com.okta.sdk.resource.model.PolicyRule; -import org.openapitools.jackson.nullable.JsonNullableModule; - -import java.io.IOException; - -public class PolicyRuleDeserializer extends StdDeserializer { - - private static final long serialVersionUID = -7597037760239971599L; - - private ObjectMapper objectMapper; - - public PolicyRuleDeserializer() { - this(null); - objectMapper = new ObjectMapper(); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); - objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); - objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - objectMapper.registerModule(new JavaTimeModule()); - objectMapper.registerModule(new JsonNullableModule()); - objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat()); - } - - public PolicyRuleDeserializer(Class vc) { - super(vc); - } - - @Override - public PolicyRule deserialize(JsonParser jp, DeserializationContext deserializationContext) throws IOException { - - JsonNode node = jp.getCodec().readTree(jp); - PolicyRule policyRule = objectMapper.convertValue(node, PolicyRule.class); - return objectMapper.convertValue(node, HelperUtil.getPolicyRuleType(policyRule)); - } -} diff --git a/impl/src/main/java/com/okta/sdk/impl/deserializer/UserFactorDeserializer.java b/impl/src/main/java/com/okta/sdk/impl/deserializer/UserFactorDeserializer.java deleted file mode 100644 index 4f91f776de8..00000000000 --- a/impl/src/main/java/com/okta/sdk/impl/deserializer/UserFactorDeserializer.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2023-Present Okta, Inc. - * - * Licensed 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 com.okta.sdk.impl.deserializer; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.okta.sdk.helper.HelperUtil; -import com.okta.sdk.resource.client.ApiClient; -import com.okta.sdk.resource.model.UserFactor; -import org.openapitools.jackson.nullable.JsonNullableModule; - -import java.io.IOException; - -public class UserFactorDeserializer extends StdDeserializer { - - private static final long serialVersionUID = -3329187612911501989L; - - private ObjectMapper objectMapper; - - public UserFactorDeserializer() { - this(null); - objectMapper = new ObjectMapper(); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); - objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true); - objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); - objectMapper.registerModule(new JavaTimeModule()); - objectMapper.registerModule(new JsonNullableModule()); - objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat()); - } - - public UserFactorDeserializer(Class vc) { - super(vc); - } - - @Override - public UserFactor deserialize(JsonParser jp, DeserializationContext deserializationContext) throws IOException { - - JsonNode node = jp.getCodec().readTree(jp); - UserFactor userFactor = objectMapper.convertValue(node, UserFactor.class); - return objectMapper.convertValue(node, HelperUtil.getUserFactorType(userFactor)); - } -} diff --git a/impl/src/main/java/com/okta/sdk/impl/resource/DefaultOIDCApplicationBuilder.java b/impl/src/main/java/com/okta/sdk/impl/resource/DefaultOIDCApplicationBuilder.java index 3f6d1c21883..cb52bc07670 100644 --- a/impl/src/main/java/com/okta/sdk/impl/resource/DefaultOIDCApplicationBuilder.java +++ b/impl/src/main/java/com/okta/sdk/impl/resource/DefaultOIDCApplicationBuilder.java @@ -20,7 +20,6 @@ import com.okta.sdk.resource.client.ApiException; import com.okta.sdk.resource.api.ApplicationApi; import com.okta.sdk.resource.model.*; -import com.okta.sdk.helper.ApplicationApiHelper; import java.util.ArrayList; import java.util.List; @@ -167,8 +166,8 @@ public OIDCApplicationBuilder setInlineHookId(String inlineHookId) { @Override public OpenIdConnectApplication buildAndCreate(ApplicationApi client) throws ApiException { - return new ApplicationApiHelper<>(new ApplicationApi(client.getApiClient())) - .createApplicationOfType(OpenIdConnectApplication.class, build(), false, null); + return (OpenIdConnectApplication) new ApplicationApi(client.getApiClient()) + .createApplication(build(), false, null); } private OpenIdConnectApplication build(){ diff --git a/impl/src/main/java/com/okta/sdk/impl/resource/DefaultOktaSignOnPolicyBuilder.java b/impl/src/main/java/com/okta/sdk/impl/resource/DefaultOktaSignOnPolicyBuilder.java index 726bfe362ff..0e082ba84f4 100644 --- a/impl/src/main/java/com/okta/sdk/impl/resource/DefaultOktaSignOnPolicyBuilder.java +++ b/impl/src/main/java/com/okta/sdk/impl/resource/DefaultOktaSignOnPolicyBuilder.java @@ -17,7 +17,6 @@ import com.okta.commons.lang.Collections; import com.okta.commons.lang.Strings; -import com.okta.sdk.helper.PolicyApiHelper; import com.okta.sdk.resource.client.ApiException; import com.okta.sdk.resource.api.PolicyApi; import com.okta.sdk.resource.model.*; @@ -58,8 +57,7 @@ public OktaSignOnPolicyBuilder addUser(String userId) { @Override public OktaSignOnPolicy buildAndCreate(PolicyApi client) throws ApiException { - return new PolicyApiHelper<>(new PolicyApiHelper<>(client.getApiClient())) - .createPolicyOfType(OktaSignOnPolicy.class, build(), isActive); + return (OktaSignOnPolicy) new PolicyApi(client.getApiClient()).createPolicy(build(), isActive); } private OktaSignOnPolicy build() { diff --git a/impl/src/main/java/com/okta/sdk/impl/resource/DefaultPasswordPolicyBuilder.java b/impl/src/main/java/com/okta/sdk/impl/resource/DefaultPasswordPolicyBuilder.java index eb75c7d8e06..e0757b23df4 100644 --- a/impl/src/main/java/com/okta/sdk/impl/resource/DefaultPasswordPolicyBuilder.java +++ b/impl/src/main/java/com/okta/sdk/impl/resource/DefaultPasswordPolicyBuilder.java @@ -17,7 +17,6 @@ import com.okta.commons.lang.Collections; import com.okta.commons.lang.Strings; -import com.okta.sdk.helper.PolicyApiHelper; import com.okta.sdk.resource.policy.PasswordPolicyBuilder; import com.okta.sdk.resource.client.ApiException; import com.okta.sdk.resource.api.PolicyApi; @@ -202,8 +201,7 @@ public PasswordPolicyBuilder setPasswordRecoveryTokenLifeMinutes(Integer pwdReco @Override public PasswordPolicy buildAndCreate(PolicyApi client) throws ApiException { - return new PolicyApiHelper<>(new PolicyApiHelper<>(client.getApiClient())) - .createPolicyOfType(PasswordPolicy.class, build(), false); + return (PasswordPolicy) new PolicyApi(client.getApiClient()).createPolicy(build(), false); } private PasswordPolicy build() { diff --git a/integration-tests/src/test/groovy/com/okta/sdk/tests/it/AppsIT.groovy b/integration-tests/src/test/groovy/com/okta/sdk/tests/it/AppsIT.groovy index dc27deb775a..c5f30c92e02 100644 --- a/integration-tests/src/test/groovy/com/okta/sdk/tests/it/AppsIT.groovy +++ b/integration-tests/src/test/groovy/com/okta/sdk/tests/it/AppsIT.groovy @@ -16,7 +16,7 @@ package com.okta.sdk.tests.it import com.google.common.net.HttpHeaders -import com.okta.sdk.helper.ApplicationApiHelper + import com.okta.sdk.tests.it.util.ITSupport import com.okta.sdk.resource.api.ApplicationApi import com.okta.sdk.resource.api.InlineHookApi @@ -38,7 +38,6 @@ class AppsIT extends ITSupport { String prefix = "java-sdk-it-" ApplicationApi applicationApi = new ApplicationApi(getClient()) - ApplicationApiHelper applicationApiHelper = new ApplicationApiHelper<>(applicationApi) @Test void basicAuthAppTest() { @@ -56,7 +55,7 @@ class AppsIT extends ITSupport { basicAuthApplication.settings(basicApplicationSettings) BasicAuthApplication createdApp = - applicationApiHelper.createApplicationOfType(BasicAuthApplication.class, basicAuthApplication, true, null) + applicationApi.createApplication(basicAuthApplication, true, null) as BasicAuthApplication registerForCleanup(createdApp) assertThat(createdApp, notNullValue()) @@ -83,7 +82,7 @@ class AppsIT extends ITSupport { // create BookmarkApplication createdApp = - applicationApiHelper.createApplicationOfType(BookmarkApplication.class, bookmarkApplication, true, null) + applicationApi.createApplication(bookmarkApplication, true, null) registerForCleanup(createdApp) assertThat(createdApp, notNullValue()) @@ -95,7 +94,7 @@ class AppsIT extends ITSupport { // update Application toBeUpdatedApp = bookmarkApplication.label("updated-" + bookmarkApplication.getLabel()) BookmarkApplication updatedApp = - applicationApiHelper.replaceApplicationOfType(BookmarkApplication.class, createdApp.getId(), toBeUpdatedApp) as BookmarkApplication + applicationApi.replaceApplication(createdApp.getId(), toBeUpdatedApp) as BookmarkApplication assertThat(updatedApp.getId(), equalTo(createdApp.getId())) @@ -126,7 +125,7 @@ class AppsIT extends ITSupport { // create BrowserPluginApplication createdApp = - applicationApiHelper.createApplicationOfType(BrowserPluginApplication.class, browserPluginApplication, true, null) + applicationApi.createApplication(browserPluginApplication, true, null) as BrowserPluginApplication registerForCleanup(createdApp) assertThat(createdApp, notNullValue()) @@ -138,7 +137,7 @@ class AppsIT extends ITSupport { // update Application toBeUpdatedApp = browserPluginApplication.label("updated-" + browserPluginApplication.getLabel()) BrowserPluginApplication updatedApp = - applicationApiHelper.replaceApplicationOfType(BrowserPluginApplication.class, createdApp.getId(), toBeUpdatedApp) as BrowserPluginApplication + applicationApi.replaceApplication(createdApp.getId(), toBeUpdatedApp) as BrowserPluginApplication assertThat(updatedApp.getId(), equalTo(createdApp.getId())) @@ -189,7 +188,7 @@ class AppsIT extends ITSupport { // create OpenIdConnectApplication createdApp = - applicationApiHelper.createApplicationOfType(OpenIdConnectApplication.class, openIdConnectApplication, true, null) + applicationApi.createApplication(openIdConnectApplication, true, null) as OpenIdConnectApplication registerForCleanup(createdApp) assertThat(createdApp, notNullValue()) @@ -201,12 +200,12 @@ class AppsIT extends ITSupport { // update Application toBeUpdatedApp = openIdConnectApplication.label("updated-" + openIdConnectApplication.getLabel()) OpenIdConnectApplication updatedApp = - applicationApiHelper.replaceApplicationOfType(OpenIdConnectApplication.class, createdApp.getId(), toBeUpdatedApp) as OpenIdConnectApplication + applicationApi.replaceApplication(createdApp.getId(), toBeUpdatedApp) as OpenIdConnectApplication assertThat(updatedApp.getId(), equalTo(createdApp.getId())) // retrieve - OpenIdConnectApplication retrievedApp = (OpenIdConnectApplication) applicationApiHelper.getApplication(createdApp.getId(), null) + OpenIdConnectApplication retrievedApp = (OpenIdConnectApplication) applicationApi.getApplication(createdApp.getId(), null) assertThat(retrievedApp, notNullValue()) assertThat(retrievedApp.getId(), equalTo(updatedApp.getId())) @@ -302,7 +301,7 @@ class AppsIT extends ITSupport { // create SamlApplication createdApp = - applicationApiHelper.createApplicationOfType(SamlApplication.class, samlApplication, true, null) + applicationApi.createApplication(samlApplication, true, null) as SamlApplication registerForCleanup(createdApp) assertThat(createdApp, notNullValue()) @@ -314,7 +313,7 @@ class AppsIT extends ITSupport { // update Application toBeUpdatedApp = samlApplication.label("updated-" + samlApplication.getLabel()) SamlApplication updatedApp = - applicationApiHelper.replaceApplicationOfType(SamlApplication.class, createdApp.getId(), toBeUpdatedApp) as SamlApplication + applicationApi.replaceApplication(createdApp.getId(), toBeUpdatedApp) as SamlApplication assertThat(updatedApp.getId(), equalTo(createdApp.getId())) @@ -349,7 +348,7 @@ class AppsIT extends ITSupport { samlApplicationSettings.app(samlApplicationSettingsApplication) org2OrgApplication.settings(samlApplicationSettings) - SamlApplication createdApp = applicationApiHelper.createApplicationOfType(SamlApplication.class, org2OrgApplication, true, null) + Application createdApp = applicationApi.createApplication(org2OrgApplication, true, null) registerForCleanup(createdApp) // File file = new File("/tmp/okta_logo_favicon.png") @@ -358,6 +357,7 @@ class AppsIT extends ITSupport { // applicationApi.uploadApplicationLogo(createdApp.getId(), file) } + //TODO: this test is unnecessary (helper is no more), remove it @Test void testApplicationApiHelper() { @@ -375,7 +375,7 @@ class AppsIT extends ITSupport { // create BookmarkApplication createdApp = - applicationApiHelper.createApplicationOfType(BookmarkApplication.class, bookmarkApplication, true, null) + applicationApi.createApplication(bookmarkApplication, true, null) as BookmarkApplication registerForCleanup(createdApp) assertThat(createdApp, notNullValue()) diff --git a/integration-tests/src/test/groovy/com/okta/sdk/tests/it/PoliciesIT.groovy b/integration-tests/src/test/groovy/com/okta/sdk/tests/it/PoliciesIT.groovy index a6e861093b0..a9c8bc6f6a3 100644 --- a/integration-tests/src/test/groovy/com/okta/sdk/tests/it/PoliciesIT.groovy +++ b/integration-tests/src/test/groovy/com/okta/sdk/tests/it/PoliciesIT.groovy @@ -15,7 +15,7 @@ */ package com.okta.sdk.tests.it -import com.okta.sdk.helper.PolicyApiHelper + import com.okta.sdk.resource.application.OIDCApplicationBuilder import com.okta.sdk.resource.group.GroupBuilder import com.okta.sdk.resource.policy.OktaSignOnPolicyBuilder @@ -40,7 +40,6 @@ class PoliciesIT extends ITSupport { GroupApi groupApi = new GroupApi(getClient()) PolicyApi policyApi = new PolicyApi(getClient()) - PolicyApiHelper policyApiHelper = new PolicyApiHelper<>(policyApi) @Test (groups = "group2") void signOnPolicyWithGroupConditions() { @@ -56,7 +55,7 @@ class PoliciesIT extends ITSupport { .setDescription("IT created Policy - signOnPolicyWithGroupConditions") .setType(PolicyType.OKTA_SIGN_ON) .addGroup(group.getId()) - .buildAndCreate(policyApiHelper) as OktaSignOnPolicy + .buildAndCreate(policyApi) as OktaSignOnPolicy registerForCleanup(policy) assertThat(policy, notNullValue()) @@ -85,7 +84,7 @@ class PoliciesIT extends ITSupport { .description("IT created Policy - createProfileEnrollmentPolicy") ProfileEnrollmentPolicy createdProfileEnrollmentPolicy = - policyApiHelper.createPolicyOfType(ProfileEnrollmentPolicy.class, profileEnrollmentPolicy, false) + policyApi.createPolicy(profileEnrollmentPolicy, false) registerForCleanup(createdProfileEnrollmentPolicy) @@ -157,7 +156,7 @@ class PoliciesIT extends ITSupport { accessPolicyRule.actions(accessPolicyRuleActions) AccessPolicyRule createdAccessPolicyRule = - policyApiHelper.createPolicyRuleOfType(AccessPolicyRule.class, accessPolicy.getId(), accessPolicyRule) + policyApi.createPolicyRule(accessPolicy.getId(), accessPolicyRule) as AccessPolicyRule assertThat(createdAccessPolicyRule, notNullValue()) assertThat(createdAccessPolicyRule.getName(), is(name)) @@ -174,7 +173,7 @@ class PoliciesIT extends ITSupport { Thread.sleep(testOperationDelay) - // get policyrule expect 404 + // get policy rule expect 404 expect(ApiException) { policyApi.getPolicyRule(accessPolicy.getId(), createdAccessPolicyRule.getId()) } @@ -188,7 +187,7 @@ class PoliciesIT extends ITSupport { .setDescription("IT created Policy - signOnActionsTest") .setType(PolicyType.OKTA_SIGN_ON) .setStatus(LifecycleStatus.ACTIVE) - .buildAndCreate(policyApiHelper) as OktaSignOnPolicy + .buildAndCreate(policyApi) as OktaSignOnPolicy registerForCleanup(policy) def policyRuleName = "policyRule+" + UUID.randomUUID().toString() @@ -204,14 +203,14 @@ class PoliciesIT extends ITSupport { oktaSignOnPolicyRule.actions(oktaSignOnPolicyRuleActions) OktaSignOnPolicyRule createdPolicyRule = - policyApiHelper.createPolicyRuleOfType(OktaSignOnPolicyRule.class, policy.getId(), oktaSignOnPolicyRule) + policyApi.createPolicyRule(policy.getId(), oktaSignOnPolicyRule) as OktaSignOnPolicyRule assertThat(createdPolicyRule.getId(), notNullValue()) assertThat(createdPolicyRule.getName(), is(policyRuleName)) assertThat(createdPolicyRule.getType(), is(PolicyRuleType.SIGN_ON)) - policyApiHelper.deactivatePolicyRule(policy.getId(), createdPolicyRule.getId()) - policyApiHelper.deletePolicyRule(policy.getId(), createdPolicyRule.getId()) + policyApi.deactivatePolicyRule(policy.getId(), createdPolicyRule.getId()) + policyApi.deletePolicyRule(policy.getId(), createdPolicyRule.getId()) } @Test @@ -255,7 +254,7 @@ class PoliciesIT extends ITSupport { .setDescription("IT created Policy - expandTest") .setType(PolicyType.OKTA_SIGN_ON) .setStatus(LifecycleStatus.INACTIVE) - .buildAndCreate(policyApiHelper) + .buildAndCreate(policyApi) registerForCleanup(policy) // verify a regular get does NOT return the embedded map with "rules" @@ -274,7 +273,7 @@ class PoliciesIT extends ITSupport { .setDescription("IT created Policy - listPoliciesWithParams") .setType(PolicyType.OKTA_SIGN_ON) .setStatus(LifecycleStatus.INACTIVE) - .buildAndCreate(policyApiHelper) + .buildAndCreate(policyApi) registerForCleanup(policy) def policies= @@ -293,6 +292,7 @@ class PoliciesIT extends ITSupport { .forEach { assertRulesExpanded(it) } } + //TODO: this test is unnecessary (helper is no more), remove it @Test void testPolicyApiHelper() { @@ -326,7 +326,7 @@ class PoliciesIT extends ITSupport { .setPriority(1) .setDescription("Dummy policy for Java SDK IT") .setName("SDK policy "+ UUID.randomUUID().toString()) - .buildAndCreate(policyApiHelper) as PasswordPolicy + .buildAndCreate(policyApi) as PasswordPolicy registerForCleanup(policy) // get policy diff --git a/integration-tests/src/test/groovy/com/okta/sdk/tests/it/UsersIT.groovy b/integration-tests/src/test/groovy/com/okta/sdk/tests/it/UsersIT.groovy index 37465ad8251..0befaec87c8 100644 --- a/integration-tests/src/test/groovy/com/okta/sdk/tests/it/UsersIT.groovy +++ b/integration-tests/src/test/groovy/com/okta/sdk/tests/it/UsersIT.groovy @@ -15,8 +15,7 @@ */ package com.okta.sdk.tests.it -import com.okta.sdk.helper.ApplicationApiHelper -import com.okta.sdk.helper.PolicyApiHelper + import com.okta.sdk.impl.resource.DefaultGroupBuilder import com.okta.sdk.resource.common.PagedList import com.okta.sdk.resource.group.GroupBuilder @@ -43,10 +42,10 @@ import static org.hamcrest.Matchers.* */ class UsersIT extends ITSupport { + ApplicationApi applicationApi = new ApplicationApi(getClient()) GroupApi groupApi = new GroupApi(getClient()) - ApplicationApiHelper applicationApiHelper = new ApplicationApiHelper<>(new ApplicationApi(getClient())) ApplicationGroupsApi applicationGroupsApi = new ApplicationGroupsApi(getClient()) - PolicyApiHelper policyApiHelper = new PolicyApiHelper<>(new PolicyApi(getClient())) + PolicyApi policyApi = new PolicyApi(getClient()) UserApi userApi = new UserApi(getClient()) RoleAssignmentApi roleAssignmentApi = new RoleAssignmentApi(getClient()) @@ -330,7 +329,7 @@ class UsersIT extends ITSupport { policy.setSettings(passwordPolicySettings) - policy = policyApiHelper.replacePolicy(policy.getId(), policy) + policy = policyApi.replacePolicy(policy.getId(), policy) def policyRuleName = "policyRule+" + UUID.randomUUID().toString() @@ -360,7 +359,7 @@ class UsersIT extends ITSupport { passwordPolicyRule.setActions(passwordPolicyRuleActions) passwordPolicyRule.setName(policyRuleName) - policyApiHelper.createPolicyRuleOfType(PasswordPolicyRule.class, policy.getId(), passwordPolicyRule) + policyApi.createPolicyRule(policy.getId(), passwordPolicyRule) // 1. Create a user User user = UserBuilder.instance() @@ -864,7 +863,7 @@ class UsersIT extends ITSupport { def expandParameter = "group" List applicationList = - applicationApiHelper.listApplications( null, null, null, null, null, null) + applicationApi.listApplications( null, null, null, null, null, null) Application application = applicationList.first() diff --git a/src/swagger/api.yaml b/src/swagger/api.yaml index 63a67caf859..a64a2535275 100644 --- a/src/swagger/api.yaml +++ b/src/swagger/api.yaml @@ -22901,7 +22901,6 @@ components: BOOKMARK: '#/components/schemas/BookmarkApplication' BROWSER_PLUGIN: '#/components/schemas/BrowserPluginApplication' OPENID_CONNECT: '#/components/schemas/OpenIdConnectApplication' - SAML_1_1: '#/components/schemas/SamlApplication' SAML_2_0: '#/components/schemas/SamlApplication' SECURE_PASSWORD_STORE: '#/components/schemas/SecurePasswordStoreApplication' WS_FEDERATION: '#/components/schemas/WsFederationApplication' @@ -28804,6 +28803,7 @@ components: - IDP_DISCOVERY - MFA_ENROLL - OKTA_SIGN_ON + - OAUTH_AUTHORIZATION_POLICY - PASSWORD - PROFILE_ENROLLMENT PolicyUserNameTemplate: