diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 14652100a..0f75d3360 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -22,3 +22,11 @@ updates: labels: - "npm" - "dependencies" + - package-ecosystem: "github-actions" + # Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.) + directory: "/" + schedule: + interval: "weekly" + labels: + - "github-actions" + - "dependencies" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b6773472f..3b49a137e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -4,9 +4,6 @@ on: workflow_dispatch: push: branches: [ 'develop', 'master', 'releases/**' ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ 'develop', 'master', 'releases/**' ] schedule: - cron: '0 2 * * 4' diff --git a/docs/Deploying-Wildfly.md b/docs/Deploying-Wildfly.md index f9bc26b9c..8497b3a41 100644 --- a/docs/Deploying-Wildfly.md +++ b/docs/Deploying-Wildfly.md @@ -12,7 +12,7 @@ Web Flow contains the following configuration in `jboss-deployment-structure.xml ``` - + @@ -23,11 +23,6 @@ Web Flow contains the following configuration in `jboss-deployment-structure.xml - - - - - @@ -36,7 +31,7 @@ Web Flow contains the following configuration in `jboss-deployment-structure.xml Similarly, Next Step contains the following configuration in `jboss-deployment-structure.xml` file for JBoss / Wildfly: ``` - + @@ -47,11 +42,6 @@ Similarly, Next Step contains the following configuration in `jboss-deployment-s - - - - - @@ -60,7 +50,7 @@ Similarly, Next Step contains the following configuration in `jboss-deployment-s Optionally, TPP engine contains the following configuration in `jboss-deployment-structure.xml` file for JBoss / Wildfly: ``` - + @@ -79,7 +69,7 @@ Optionally, Web Flow Client contains the following configuration in `jboss-deplo ``` - + @@ -91,23 +91,23 @@ UTF-8 17 17 - 1.77 + 1.78.1 3.5.3 1.6.4 - 2.5.0 - 2.2.21 + 2.6.0 + 2.2.22 1.4.4 20240325.1 7.4 - 1.9.0 - 1.7.0 - 1.7.0 - 1.7.0 + 1.10.0 + 1.8.0 + 1.8.0 + 1.8.0 diff --git a/powerauth-data-adapter-client/pom.xml b/powerauth-data-adapter-client/pom.xml index 15d55bbfb..2c117cbb8 100644 --- a/powerauth-data-adapter-client/pom.xml +++ b/powerauth-data-adapter-client/pom.xml @@ -28,7 +28,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 diff --git a/powerauth-data-adapter-model/pom.xml b/powerauth-data-adapter-model/pom.xml index 722c14d5a..7eba0a47c 100644 --- a/powerauth-data-adapter-model/pom.xml +++ b/powerauth-data-adapter-model/pom.xml @@ -28,7 +28,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 diff --git a/powerauth-mtoken-model/pom.xml b/powerauth-mtoken-model/pom.xml index e3f2e3f7b..07e8279fb 100644 --- a/powerauth-mtoken-model/pom.xml +++ b/powerauth-mtoken-model/pom.xml @@ -27,7 +27,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 diff --git a/powerauth-nextstep-client/pom.xml b/powerauth-nextstep-client/pom.xml index 7484c9312..89d0978ae 100644 --- a/powerauth-nextstep-client/pom.xml +++ b/powerauth-nextstep-client/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-nextstep-client diff --git a/powerauth-nextstep-client/src/main/java/io/getlime/security/powerauth/lib/nextstep/client/NextStepClient.java b/powerauth-nextstep-client/src/main/java/io/getlime/security/powerauth/lib/nextstep/client/NextStepClient.java index 8dc2477b2..4843122c4 100644 --- a/powerauth-nextstep-client/src/main/java/io/getlime/security/powerauth/lib/nextstep/client/NextStepClient.java +++ b/powerauth-nextstep-client/src/main/java/io/getlime/security/powerauth/lib/nextstep/client/NextStepClient.java @@ -100,6 +100,7 @@ public NextStepClient(RestClientConfiguration restClientConfiguration) throws Ne * @param params List of generic parameters. * @return A Response with CreateOperationResponse. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createOperation(CreateOperationRequest) */ public ObjectResponse createOperation(@NotNull String operationName, @NotNull String operationData, List params) throws NextStepClientException { return createOperation(operationName, null, operationData, null, null, null, params, null); @@ -115,7 +116,8 @@ public ObjectResponse createOperation(@NotNull String o * @param applicationContext Context of application requesting the OAuth 2.1 consent. * @return A Response with CreateOperationResponse. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. - */ + * @see #createOperation(CreateOperationRequest) + */ public ObjectResponse createOperation(@NotNull String operationName, String operationId, @NotNull String operationData, List params, ApplicationContext applicationContext) throws NextStepClientException { return createOperation(operationName, operationId, operationData, null, null, null, params, applicationContext); } @@ -130,6 +132,7 @@ public ObjectResponse createOperation(@NotNull String o * @param applicationContext Context of application requesting the OAuth 2.1 consent. * @return A Response with CreateOperationResponse. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createOperation(CreateOperationRequest) */ public ObjectResponse createOperation(@NotNull String operationName, @NotNull String operationData, OperationFormData formData, List params, ApplicationContext applicationContext) throws NextStepClientException { return createOperation(operationName, null, operationData, null, null, formData, params, applicationContext); @@ -148,6 +151,7 @@ public ObjectResponse createOperation(@NotNull String o * @param applicationContext Context of application requesting the OAuth 2.1 consent. * @return A Response with CreateOperationResponse. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createOperation(CreateOperationRequest) */ public ObjectResponse createOperation(@NotNull String operationName, String operationId, @NotNull String operationData, String organizationId, String externalTransactionId, OperationFormData formData, List params, ApplicationContext applicationContext) throws NextStepClientException { final CreateOperationRequest request = new CreateOperationRequest(); @@ -161,7 +165,7 @@ public ObjectResponse createOperation(@NotNull String o request.getParams().addAll(params); } request.setApplicationContext(applicationContext); - return postObjectImpl("/operation", new ObjectRequest<>(request), CreateOperationResponse.class); + return createOperation(request); } /** @@ -175,11 +179,23 @@ public ObjectResponse createOperation(@NotNull String o * @param applicationContext Context of application requesting the OAuth 2.1 consent. * @return A Response with CreateOperationResponse object. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createOperation(CreateOperationRequest) */ public ObjectResponse createOperation(@NotNull String operationName, @NotNull String operationData, OperationFormData formData, String organizationId, List params, ApplicationContext applicationContext) throws NextStepClientException { return createOperation(operationName, null, operationData, organizationId, null, formData, params, applicationContext); } + /** + * Calls the create operation endpoint via POST method to create a new operation. + * + * @param request Create operation request. + * @return A Response with CreateOperationResponse object. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createOperation(@NotNull final CreateOperationRequest request) throws NextStepClientException { + return postObjectImpl("/operation", new ObjectRequest<>(request), CreateOperationResponse.class); + } + /** * Calls the update operation endpoint via PUT method to update an existing operation. * @@ -194,6 +210,7 @@ public ObjectResponse createOperation(@NotNull String o * @param applicationContext Context of application requesting the OAuth 2.1 consent. * @return A Response with UpdateOperationResponse object. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateOperation(UpdateOperationRequest) */ public ObjectResponse updateOperation(@NotNull String operationId, String userId, String organizationId, @NotNull AuthMethod authMethod, List authInstruments, @NotNull AuthStepResult authStepResult, String authStepResultDescription, List params, ApplicationContext applicationContext, PAAuthenticationContext authenticationContext) throws NextStepClientException { final UpdateOperationRequest request = new UpdateOperationRequest(); @@ -209,6 +226,17 @@ public ObjectResponse updateOperation(@NotNull String o } request.setApplicationContext(applicationContext); request.setAuthenticationContext(authenticationContext); + return updateOperation(request); + } + + /** + * Calls the update operation endpoint via PUT method to update an existing operation. + * + * @param request Update operation request. + * @return A Response with UpdateOperationResponse object. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateOperation(@NotNull final UpdateOperationRequest request) throws NextStepClientException { return putObjectImpl("/operation", new ObjectRequest<>(request), UpdateOperationResponse.class); } @@ -226,6 +254,7 @@ public ObjectResponse updateOperation(@NotNull String o * @param applicationContext Context of application requesting the OAuth 2.1 consent. * @return A Response with UpdateOperationResponse object. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateOperationPost(UpdateOperationRequest) */ public ObjectResponse updateOperationPost(@NotNull String operationId, String userId, String organizationId, @NotNull AuthMethod authMethod, List authInstruments, @NotNull AuthStepResult authStepResult, String authStepResultDescription, List params, ApplicationContext applicationContext, PAAuthenticationContext authenticationContext) throws NextStepClientException { final UpdateOperationRequest request = new UpdateOperationRequest(); @@ -241,6 +270,17 @@ public ObjectResponse updateOperationPost(@NotNull Stri } request.setApplicationContext(applicationContext); request.setAuthenticationContext(authenticationContext); + return updateOperationPost(request); + } + + /** + * Calls the update operation endpoint via POST method to update an existing operation. + * + * @param request Update operation request. + * @return A Response with UpdateOperationResponse object. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateOperationPost(@NotNull final UpdateOperationRequest request) throws NextStepClientException { return postObjectImpl("/operation/update", new ObjectRequest<>(request), UpdateOperationResponse.class); } @@ -253,6 +293,7 @@ public ObjectResponse updateOperationPost(@NotNull Stri * @param accountStatus User account status. * @return Response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateOperationUser(UpdateOperationUserRequest) */ public Response updateOperationUser(@NotNull String operationId, @NotNull String userId, String organizationId, UserAccountStatus accountStatus) throws NextStepClientException { final UpdateOperationUserRequest request = new UpdateOperationUserRequest(); @@ -260,11 +301,22 @@ public Response updateOperationUser(@NotNull String operationId, @NotNull String request.setUserId(userId); request.setOrganizationId(organizationId); request.setAccountStatus(accountStatus); + return updateOperationUser(request); + } + + /** + * Update user, organization and account status for an operation via PUT method. + * + * @param request Update operation user request. + * @return Response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response updateOperationUser(@NotNull final UpdateOperationUserRequest request) throws NextStepClientException { return putObjectImpl("/operation/user", new ObjectRequest<>(request)); } /** - * UUpdate user, organization and account status for an operation via POST method. + * Update user, organization and account status for an operation via POST method. * * @param operationId Operation ID. * @param userId User ID. @@ -272,6 +324,7 @@ public Response updateOperationUser(@NotNull String operationId, @NotNull String * @param accountStatus User account status. * @return Response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateOperationUserPost(UpdateOperationUserRequest) */ public Response updateOperationUserPost(@NotNull String operationId, @NotNull String userId, String organizationId, UserAccountStatus accountStatus) throws NextStepClientException { final UpdateOperationUserRequest request = new UpdateOperationUserRequest(); @@ -279,6 +332,17 @@ public Response updateOperationUserPost(@NotNull String operationId, @NotNull St request.setUserId(userId); request.setOrganizationId(organizationId); request.setAccountStatus(accountStatus); + return updateOperationUserPost(request); + } + + /** + * Update user, organization and account status for an operation via POST method. + * + * @param request Update operation user request. + * @return Response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response updateOperationUserPost(@NotNull final UpdateOperationUserRequest request) throws NextStepClientException { return postObjectImpl("/operation/user/update", new ObjectRequest<>(request)); } @@ -289,11 +353,23 @@ public Response updateOperationUserPost(@NotNull String operationId, @NotNull St * @param formData Form data. * @return Object response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateOperationFormData(UpdateFormDataRequest) */ public Response updateOperationFormData(@NotNull String operationId, @NotNull OperationFormData formData) throws NextStepClientException { final UpdateFormDataRequest request = new UpdateFormDataRequest(); request.setOperationId(operationId); request.setFormData(formData); + return updateOperationFormData(request); + } + + /** + * Update operation form data via PUT method. + * + * @param request Update form data request. + * @return Object response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response updateOperationFormData(@NotNull final UpdateFormDataRequest request) throws NextStepClientException { return putObjectImpl("/operation/formData", new ObjectRequest<>(request)); } @@ -304,11 +380,23 @@ public Response updateOperationFormData(@NotNull String operationId, @NotNull Op * @param formData Form data. * @return Object response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateOperationFormDataPost(UpdateFormDataRequest) */ public Response updateOperationFormDataPost(@NotNull String operationId, @NotNull OperationFormData formData) throws NextStepClientException { final UpdateFormDataRequest request = new UpdateFormDataRequest(); request.setOperationId(operationId); request.setFormData(formData); + return updateOperationFormDataPost(request); + } + + /** + * Update operation form data via POST method. + * + * @param request Update form data request. + * @return Object response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response updateOperationFormDataPost(@NotNull final UpdateFormDataRequest request) throws NextStepClientException { return postObjectImpl("/operation/formData/update", new ObjectRequest<>(request)); } @@ -319,11 +407,23 @@ public Response updateOperationFormDataPost(@NotNull String operationId, @NotNul * @param chosenAuthMethod Chosen authentication method. * @return Object response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateChosenAuthMethod(UpdateChosenAuthMethodRequest) */ public Response updateChosenAuthMethod(@NotNull String operationId, @NotNull AuthMethod chosenAuthMethod) throws NextStepClientException { final UpdateChosenAuthMethodRequest request = new UpdateChosenAuthMethodRequest(); request.setOperationId(operationId); request.setChosenAuthMethod(chosenAuthMethod); + return updateChosenAuthMethod(request); + } + + /** + * Update chosen authentication method for current operation step via PUT method. + * + * @param request Update chosen auth method request. + * @return Object response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response updateChosenAuthMethod(@NotNull final UpdateChosenAuthMethodRequest request) throws NextStepClientException { return putObjectImpl("/operation/chosenAuthMethod", new ObjectRequest<>(request)); } @@ -334,11 +434,23 @@ public Response updateChosenAuthMethod(@NotNull String operationId, @NotNull Aut * @param chosenAuthMethod Chosen authentication method. * @return Object response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateChosenAuthMethodPost(UpdateChosenAuthMethodRequest) */ public Response updateChosenAuthMethodPost(@NotNull String operationId, @NotNull AuthMethod chosenAuthMethod) throws NextStepClientException { final UpdateChosenAuthMethodRequest request = new UpdateChosenAuthMethodRequest(); request.setOperationId(operationId); request.setChosenAuthMethod(chosenAuthMethod); + return updateChosenAuthMethodPost(request); + } + + /** + * Update chosen authentication method for current operation step via POST method. + * + * @param request Update chosen auth method request. + * @return Object response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response updateChosenAuthMethodPost(@NotNull final UpdateChosenAuthMethodRequest request) throws NextStepClientException { return postObjectImpl("/operation/chosenAuthMethod/update", new ObjectRequest<>(request)); } @@ -349,11 +461,23 @@ public Response updateChosenAuthMethodPost(@NotNull String operationId, @NotNull * @param applicationContext Application context. * @return Object response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateApplicationContext(UpdateApplicationContextRequest) */ public Response updateApplicationContext(@NotNull String operationId, @NotNull ApplicationContext applicationContext) throws NextStepClientException { final UpdateApplicationContextRequest request = new UpdateApplicationContextRequest(); request.setOperationId(operationId); request.setApplicationContext(applicationContext); + return updateApplicationContext(request); + } + + /** + * Update application context for current operation step via PUT method. + * + * @param request Update application context request. + * @return Object response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response updateApplicationContext(@NotNull final UpdateApplicationContextRequest request) throws NextStepClientException { return putObjectImpl("/operation/application", new ObjectRequest<>(request)); } @@ -364,11 +488,23 @@ public Response updateApplicationContext(@NotNull String operationId, @NotNull A * @param applicationContext Application context. * @return Object response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateApplicationContextPost(UpdateApplicationContextRequest) */ public Response updateApplicationContextPost(@NotNull String operationId, @NotNull ApplicationContext applicationContext) throws NextStepClientException { final UpdateApplicationContextRequest request = new UpdateApplicationContextRequest(); request.setOperationId(operationId); request.setApplicationContext(applicationContext); + return updateApplicationContextPost(request); + } + + /** + * Update application context for current operation step via POST method. + * + * @param request Update application context request. + * @return Object response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response updateApplicationContextPost(@NotNull final UpdateApplicationContextRequest request) throws NextStepClientException { return postObjectImpl("/operation/application/update", new ObjectRequest<>(request)); } @@ -379,11 +515,23 @@ public Response updateApplicationContextPost(@NotNull String operationId, @NotNu * @param mobileTokenActive Whether mobile token is active. * @return Object response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateMobileToken(UpdateMobileTokenRequest) */ public Response updateMobileToken(@NotNull String operationId, boolean mobileTokenActive) throws NextStepClientException { final UpdateMobileTokenRequest request = new UpdateMobileTokenRequest(); request.setOperationId(operationId); request.setMobileTokenActive(mobileTokenActive); + return updateMobileToken(request); + } + + /** + * Update mobile token status for current operation step via PUT method. + * + * @param request Update mobile token request. + * @return Object response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response updateMobileToken(@NotNull final UpdateMobileTokenRequest request) throws NextStepClientException { return putObjectImpl("/operation/mobileToken/status", new ObjectRequest<>(request)); } @@ -394,16 +542,28 @@ public Response updateMobileToken(@NotNull String operationId, boolean mobileTok * @param mobileTokenActive Whether mobile token is active. * @return Object response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateMobileTokenPost(UpdateMobileTokenRequest) */ public Response updateMobileTokenPost(@NotNull String operationId, boolean mobileTokenActive) throws NextStepClientException { final UpdateMobileTokenRequest request = new UpdateMobileTokenRequest(); request.setOperationId(operationId); request.setMobileTokenActive(mobileTokenActive); + return updateMobileTokenPost(request); + } + + /** + * Update mobile token status for current operation step via POST method. + * + * @param request Update mobile token request. + * @return Object response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response updateMobileTokenPost(@NotNull final UpdateMobileTokenRequest request) throws NextStepClientException { return postObjectImpl("/operation/mobileToken/status/update", new ObjectRequest<>(request)); } /** - * Get mobile token configuration configuration. + * Get mobile token configuration using GET method. * * @param userId User ID. * @param operationName Operation name. @@ -422,24 +582,36 @@ public ObjectResponse getMobileTokenConfig(@NotNul } /** - * Get mobile token configuration configuration using POST method. + * Get mobile token configuration using POST method. * * @param userId User ID. * @param operationName Operation name. * @param authMethod Authentication method. * @return Mobile token configuration. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #getMobileTokenConfigPost(GetMobileTokenConfigRequest) */ public ObjectResponse getMobileTokenConfigPost(@NotNull String userId, @NotNull String operationName, @NotNull AuthMethod authMethod) throws NextStepClientException { final GetMobileTokenConfigRequest request = new GetMobileTokenConfigRequest(); request.setUserId(userId); request.setOperationName(operationName); request.setAuthMethod(authMethod); + return getMobileTokenConfigPost(request); + } + + /** + * Get mobile token configuration using POST method. + * + * @param request Get mobile token config request. + * @return Mobile token configuration. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse getMobileTokenConfigPost(@NotNull final GetMobileTokenConfigRequest request) throws NextStepClientException { return postObjectImpl("/operation/mobileToken/config/detail", new ObjectRequest<>(request), GetMobileTokenConfigResponse.class); } /** - * Calls the operation details endpoint via POST method to get operation details. + * Calls the operation details endpoint via GET method to get operation details. * * @param operationId Operation ID. * @return A Response with {@link GetOperationDetailResponse} object. @@ -489,6 +661,7 @@ public ObjectResponse lookupOperationByExt * @param responseAfsExtras AFS response extras. * @return Response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createAfsAction(CreateAfsActionRequest) */ public Response createAfsAction(@NotNull String operationId, @NotNull String afsAction, int stepIndex, String requestAfsExtras, String afsLabel, boolean afsResponseApplied, String responseAfsExtras) throws NextStepClientException { @@ -501,6 +674,17 @@ public Response createAfsAction(@NotNull String operationId, @NotNull String afs request.setAfsResponseApplied(afsResponseApplied); request.setResponseAfsExtras(responseAfsExtras); request.setTimestampCreated(new Date()); + return createAfsAction(request); + } + + /** + * Create an AFS action in Next Step and log its request and response parameters. + * + * @param request Create AFS action request. + * @return Response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public Response createAfsAction(@NotNull final CreateAfsActionRequest request) throws NextStepClientException { return postObjectImpl("/operation/afs/action", new ObjectRequest<>(request)); } @@ -627,6 +811,7 @@ public ObjectResponse> getPendingOperationsPost * @param orderNumber Order number. * @return Create organization response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createOrganization(CreateOrganizationRequest) */ public ObjectResponse createOrganization(@NotNull String organizationId, String displayNameKey, boolean isDefault, @NotNull Integer orderNumber) throws NextStepClientException { @@ -635,6 +820,17 @@ public ObjectResponse createOrganization(@NotNull St request.setDisplayNameKey(displayNameKey); request.setDefault(isDefault); request.setOrderNumber(orderNumber); + return createOrganization(request); + } + + /** + * Create an organization. + * + * @param request Create organization request. + * @return Create organization response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createOrganization(@NotNull final CreateOrganizationRequest request) throws NextStepClientException { return postObjectImpl("/organization", new ObjectRequest<>(request), CreateOrganizationResponse.class); } @@ -844,6 +1040,7 @@ public ObjectResponse getAuthMethodsEnabledForUser * @param config Authentication method configuration. * @return List of enabled authentication methods for given user wrapped in GetAuthMethodsResponse. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #enableAuthMethodForUser(UpdateAuthMethodRequest) */ public ObjectResponse enableAuthMethodForUser(@NotNull String userId, @NotNull AuthMethod authMethod, Map config) throws NextStepClientException { final UpdateAuthMethodRequest request = new UpdateAuthMethodRequest(); @@ -852,6 +1049,17 @@ public ObjectResponse enableAuthMethodForUser(@NotNull S if (config != null) { request.getConfig().putAll(config); } + return enableAuthMethodForUser(request); + } + + /** + * Enable an authentication method for given user. + * + * @param request Update auth method request. + * @return List of enabled authentication methods for given user wrapped in GetAuthMethodsResponse. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse enableAuthMethodForUser(@NotNull final UpdateAuthMethodRequest request) throws NextStepClientException { return postObjectImpl("/user/auth-method", new ObjectRequest<>(request), GetAuthMethodsResponse.class); } @@ -863,6 +1071,7 @@ public ObjectResponse enableAuthMethodForUser(@NotNull S * @param config Authentication method configuration. * @return List of enabled authentication methods for given user wrapped in GetAuthMethodsResponse. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #disableAuthMethodForUser(UpdateAuthMethodRequest) */ public ObjectResponse disableAuthMethodForUser(@NotNull String userId, @NotNull AuthMethod authMethod, Map config) throws NextStepClientException { final UpdateAuthMethodRequest request = new UpdateAuthMethodRequest(); @@ -871,6 +1080,17 @@ public ObjectResponse disableAuthMethodForUser(@NotNull if (config != null) { request.getConfig().putAll(config); } + return disableAuthMethodForUser(request); + } + + /** + * Disable an authentication method for given user. + * + * @param request Update auth method request. + * @return List of enabled authentication methods for given user wrapped in GetAuthMethodsResponse. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse disableAuthMethodForUser(@NotNull final UpdateAuthMethodRequest request) throws NextStepClientException { return postObjectImpl("/user/auth-method/delete", new ObjectRequest<>(request), GetAuthMethodsResponse.class); } @@ -883,11 +1103,23 @@ public ObjectResponse disableAuthMethodForUser(@NotNull * @param description Application description. * @return Create application response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createApplication(CreateApplicationRequest) */ public ObjectResponse createApplication(@NotNull String applicationName, String description) throws NextStepClientException { final CreateApplicationRequest request = new CreateApplicationRequest(); request.setApplicationName(applicationName); request.setDescription(description); + return createApplication(request); + } + + /** + * Create a Next Step application. + * + * @param request Createa application request. + * @return Create application response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createApplication(@NotNull final CreateApplicationRequest request) throws NextStepClientException { return postObjectImpl("/application", new ObjectRequest<>(request), CreateApplicationResponse.class); } @@ -899,12 +1131,24 @@ public ObjectResponse createApplication(@NotNull Stri * @param status Application status. * @return Update application response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateApplication(UpdateApplicationRequest) */ public ObjectResponse updateApplication(@NotNull String applicationName, String description, ApplicationStatus status) throws NextStepClientException { final UpdateApplicationRequest request = new UpdateApplicationRequest(); request.setApplicationName(applicationName); request.setDescription(description); request.setApplicationStatus(status); + return updateApplication(request); + } + + /** + * Update a Next Step application via PUT method. + * + * @param request Update application request. + * @return Update application response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateApplication(@NotNull final UpdateApplicationRequest request) throws NextStepClientException { return putObjectImpl("/application", new ObjectRequest<>(request), UpdateApplicationResponse.class); } @@ -916,12 +1160,24 @@ public ObjectResponse updateApplication(@NotNull Stri * @param status Application status. * @return Update application response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateApplicationPost(UpdateApplicationRequest) */ public ObjectResponse updateApplicationPost(@NotNull String applicationName, String description, ApplicationStatus status) throws NextStepClientException { final UpdateApplicationRequest request = new UpdateApplicationRequest(); request.setApplicationName(applicationName); request.setDescription(description); request.setApplicationStatus(status); + return updateApplicationPost(request); + } + + /** + * Update a Next Step application via POST method. + * + * @param request Update application request. + * @return Update application response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateApplicationPost(@NotNull final UpdateApplicationRequest request) throws NextStepClientException { return postObjectImpl("/application/update", new ObjectRequest<>(request), UpdateApplicationResponse.class); } @@ -973,11 +1229,23 @@ public ObjectResponse deleteApplication(@NotNull Stri * @param description Role description. * @return Create user role response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createRole(CreateRoleRequest) */ public ObjectResponse createRole(@NotNull String roleName, String description) throws NextStepClientException { final CreateRoleRequest request = new CreateRoleRequest(); request.setRoleName(roleName); request.setDescription(description); + return createRole(request); + } + + /** + * Create a user role. + * + * @param request Create role request. + * @return Create user role response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createRole(@NotNull final CreateRoleRequest request) throws NextStepClientException { return postObjectImpl("/role", new ObjectRequest<>(request), CreateRoleResponse.class); } @@ -1025,6 +1293,7 @@ public ObjectResponse deleteRole(@NotNull String roleName) t * @param parameters Hashing algorithm parameters. * @return Create hashing configuration response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createHashConfig(CreateHashConfigRequest) */ public ObjectResponse createHashConfig(@NotNull String hashConfigName, @NotNull HashAlgorithm algorithm, Map parameters) throws NextStepClientException { final CreateHashConfigRequest request = new CreateHashConfigRequest(); @@ -1033,6 +1302,17 @@ public ObjectResponse createHashConfig(@NotNull String if (parameters != null) { request.getParameters().putAll(parameters); } + return createHashConfig(request); + } + + /** + * Create a hashing configuration. + * + * @param request Create hash config request. + * @return Create hashing configuration response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createHashConfig(@NotNull final CreateHashConfigRequest request) throws NextStepClientException { return postObjectImpl("/hashconfig", new ObjectRequest<>(request), CreateHashConfigResponse.class); } @@ -1045,6 +1325,7 @@ public ObjectResponse createHashConfig(@NotNull String * @param status Hashing configuration status. * @return Update hashing configuration response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateHashConfig(UpdateHashConfigRequest) */ public ObjectResponse updateHashConfig(@NotNull String hashConfigName, @NotNull HashAlgorithm algorithm, Map parameters, HashConfigStatus status) throws NextStepClientException { final UpdateHashConfigRequest request = new UpdateHashConfigRequest(); @@ -1054,6 +1335,17 @@ public ObjectResponse updateHashConfig(@NotNull String request.getParameters().putAll(parameters); } request.setHashConfigStatus(status); + return updateHashConfig(request); + } + + /** + * Update a hashing configuration via PUT method. + * + * @param request Update hash config request. + * @return Update hashing configuration response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateHashConfig(@NotNull final UpdateHashConfigRequest request) throws NextStepClientException { return putObjectImpl("/hashconfig", new ObjectRequest<>(request), UpdateHashConfigResponse.class); } @@ -1066,6 +1358,7 @@ public ObjectResponse updateHashConfig(@NotNull String * @param status Hashing configuration status. * @return Update hashing configuration response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateHashConfigPost(UpdateHashConfigRequest) */ public ObjectResponse updateHashConfigPost(@NotNull String hashConfigName, @NotNull HashAlgorithm algorithm, Map parameters, HashConfigStatus status) throws NextStepClientException { final UpdateHashConfigRequest request = new UpdateHashConfigRequest(); @@ -1075,6 +1368,17 @@ public ObjectResponse updateHashConfigPost(@NotNull St request.getParameters().putAll(parameters); } request.setHashConfigStatus(status); + return updateHashConfigPost(request); + } + + /** + * Update a hashing configuration via POST method. + * + * @param request Update hash config request. + * @return Update hashing configuration response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateHashConfigPost(@NotNull final UpdateHashConfigRequest request) throws NextStepClientException { return postObjectImpl("/hashconfig/update", new ObjectRequest<>(request), UpdateHashConfigResponse.class); } @@ -1455,11 +1759,23 @@ public ObjectResponse updateUserPost(@NotNull UpdateUserRequ * @param status Status to use. * @return Update users response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateUsers(UpdateUsersRequest) */ public ObjectResponse updateUsers(@NotNull List userIds, @NotNull UserIdentityStatus status) throws NextStepClientException { final UpdateUsersRequest request = new UpdateUsersRequest(); request.getUserIds().addAll(userIds); request.setUserIdentityStatus(status); + return updateUsers(request); + } + + /** + * Update statuses of multiple user identities. + * + * @param request Update users request. + * @return Update users response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateUsers(@NotNull final UpdateUsersRequest request) throws NextStepClientException { return postObjectImpl("/user/update/multi", new ObjectRequest<>(request), UpdateUsersResponse.class); } @@ -1511,12 +1827,13 @@ public ObjectResponse lookupUsers(@NotNull LookupUsersReque * @param credentialName Credential name. * @return Lookup user response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #lookupUser(LookupUserRequest) */ public ObjectResponse lookupUser(@NotNull String username, @NotNull String credentialName) throws NextStepClientException { final LookupUserRequest request = new LookupUserRequest(); request.setUsername(username); request.setCredentialName(credentialName); - return postObjectImpl("/user/lookup/single", new ObjectRequest<>(request), LookupUserResponse.class); + return lookupUser(request); } /** @@ -1527,12 +1844,24 @@ public ObjectResponse lookupUser(@NotNull String username, @ * @param operationId Operation ID. * @return Lookup user response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #lookupUser(LookupUserRequest) */ public ObjectResponse lookupUser(@NotNull String username, @NotNull String credentialName, String operationId) throws NextStepClientException { final LookupUserRequest request = new LookupUserRequest(); request.setUsername(username); request.setCredentialName(credentialName); request.setOperationId(operationId); + return lookupUser(request); + } + + /** + * Lookup a single user identity. + * + * @param request Lookup user request. + * @return Lookup user response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse lookupUser(@NotNull final LookupUserRequest request) throws NextStepClientException { return postObjectImpl("/user/lookup/single", new ObjectRequest<>(request), LookupUserResponse.class); } @@ -1582,11 +1911,23 @@ public ObjectResponse deleteUser(@NotNull String userId) thr * @param roleName Role name. * @return Add user role response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #addUserRole(AddUserRoleRequest) */ public ObjectResponse addUserRole(@NotNull String userId, @NotNull String roleName) throws NextStepClientException { final AddUserRoleRequest request = new AddUserRoleRequest(); request.setUserId(userId); request.setRoleName(roleName); + return addUserRole(request); + } + + /** + * Add a role to a user. + * + * @param request Add user role request. + * @return Add user role response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse addUserRole(@NotNull final AddUserRoleRequest request) throws NextStepClientException { return postObjectImpl("/user/role", new ObjectRequest<>(request), AddUserRoleResponse.class); } @@ -1597,11 +1938,23 @@ public ObjectResponse addUserRole(@NotNull String userId, @ * @param roleName Role name. * @return Remove user role response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #removeUserRole(RemoveUserRoleRequest) */ public ObjectResponse removeUserRole(@NotNull String userId, @NotNull String roleName) throws NextStepClientException { final RemoveUserRoleRequest request = new RemoveUserRoleRequest(); request.setUserId(userId); request.setRoleName(roleName); + return removeUserRole(request); + } + + /** + * Remove a role to a user. + * + * @param request Remove user role request. + * @return Remove user role response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse removeUserRole(@NotNull final RemoveUserRoleRequest request) throws NextStepClientException { return postObjectImpl("/user/role/remove", new ObjectRequest<>(request), RemoveUserRoleResponse.class); } @@ -1615,6 +1968,7 @@ public ObjectResponse removeUserRole(@NotNull String use * @param primary Whether contact is primary. * @return Create user contact response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createUserContact(CreateUserContactRequest) */ public ObjectResponse createUserContact(@NotNull String userId, @NotNull String contactName, @NotNull ContactType contactType, @NotNull String contactValue, boolean primary) throws NextStepClientException { @@ -1624,6 +1978,17 @@ public ObjectResponse createUserContact(@NotNull Stri request.setContactType(contactType); request.setContactValue(contactValue); request.setPrimary(primary); + return createUserContact(request); + } + + /** + * Create a user contact. + * + * @param request Create user contact request. + * @return Create user contact response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createUserContact(@NotNull final CreateUserContactRequest request) throws NextStepClientException { return postObjectImpl("/user/contact", new ObjectRequest<>(request), CreateUserContactResponse.class); } @@ -1637,6 +2002,7 @@ public ObjectResponse createUserContact(@NotNull Stri * @param primary Whether contact is primary. * @return Update user contact response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateUserContact(UpdateUserContactRequest) */ public ObjectResponse updateUserContact(@NotNull String userId, @NotNull String contactName, @NotNull ContactType contactType, @NotNull String contactValue, boolean primary) throws NextStepClientException { @@ -1646,6 +2012,17 @@ public ObjectResponse updateUserContact(@NotNull Stri request.setContactType(contactType); request.setContactValue(contactValue); request.setPrimary(primary); + return updateUserContact(request); + } + + /** + * Update a user contact via PUT method. + * + * @param request Update user contact request. + * @return Update user contact response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateUserContact(@NotNull final UpdateUserContactRequest request) throws NextStepClientException { return putObjectImpl("/user/contact", new ObjectRequest<>(request), UpdateUserContactResponse.class); } @@ -1659,6 +2036,7 @@ public ObjectResponse updateUserContact(@NotNull Stri * @param primary Whether contact is primary. * @return Update user contact response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateUserContactPost(UpdateUserContactRequest) */ public ObjectResponse updateUserContactPost(@NotNull String userId, @NotNull String contactName, @NotNull ContactType contactType, @NotNull String contactValue, boolean primary) throws NextStepClientException { @@ -1668,6 +2046,17 @@ public ObjectResponse updateUserContactPost(@NotNull request.setContactType(contactType); request.setContactValue(contactValue); request.setPrimary(primary); + return updateUserContactPost(request); + } + + /** + * Update a user contact via POST method. + * + * @param request Update user contact request. + * @return Update user contact response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateUserContactPost(@NotNull final UpdateUserContactRequest request) throws NextStepClientException { return postObjectImpl("/user/contact/update", new ObjectRequest<>(request), UpdateUserContactResponse.class); } @@ -1705,12 +2094,24 @@ public ObjectResponse getUserContactListPost(@NotNul * @param contactType Contact type. * @return Delete user contact response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #deleteUserContact(DeleteUserContactRequest) */ public ObjectResponse deleteUserContact(@NotNull String userId, @NotNull String contactName, @NotNull ContactType contactType) throws NextStepClientException { final DeleteUserContactRequest request = new DeleteUserContactRequest(); request.setUserId(userId); request.setContactName(contactName); request.setContactType(contactType); + return deleteUserContact(request); + } + + /** + * Delete a user contact. + * + * @param request Delete user contact request. + * @return Delete user contact response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse deleteUserContact(@NotNull final DeleteUserContactRequest request) throws NextStepClientException { return postObjectImpl("/user/contact/delete", new ObjectRequest<>(request), DeleteUserContactResponse.class); } @@ -1723,6 +2124,7 @@ public ObjectResponse deleteUserContact(@NotNull Stri * @param extras Extra information related to the alias. * @return Create user alias response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createUserAlias(CreateUserAliasRequest) */ public ObjectResponse createUserAlias(@NotNull String userId, @NotNull String aliasName, @NotNull String aliasValue, Map extras) throws NextStepClientException { @@ -1733,6 +2135,17 @@ public ObjectResponse createUserAlias(@NotNull String u if (extras != null) { request.getExtras().putAll(extras); } + return createUserAlias(request); + } + + /** + * Create a user alias. + * + * @param request Create user alias request. + * @return Create user alias response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createUserAlias(@NotNull final CreateUserAliasRequest request) throws NextStepClientException { return postObjectImpl("/user/alias", new ObjectRequest<>(request), CreateUserAliasResponse.class); } @@ -1745,6 +2158,7 @@ public ObjectResponse createUserAlias(@NotNull String u * @param extras Extra information related to the alias. * @return Update user alias response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateUserAlias(UpdateUserAliasRequest) */ public ObjectResponse updateUserAlias(@NotNull String userId, @NotNull String aliasName, @NotNull String aliasValue, Map extras) throws NextStepClientException { @@ -1755,6 +2169,17 @@ public ObjectResponse updateUserAlias(@NotNull String u if (extras != null) { request.getExtras().putAll(extras); } + return updateUserAlias(request); + } + + /** + * Update a user alias via PUT method. + * + * @param request Update user alias request. + * @return Update user alias response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateUserAlias(@NotNull final UpdateUserAliasRequest request) throws NextStepClientException { return putObjectImpl("/user/alias", new ObjectRequest<>(request), UpdateUserAliasResponse.class); } @@ -1767,6 +2192,7 @@ public ObjectResponse updateUserAlias(@NotNull String u * @param extras Extra information related to the alias. * @return Update user alias response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateUserAliasPost(UpdateUserAliasRequest) */ public ObjectResponse updateUserAliasPost(@NotNull String userId, @NotNull String aliasName, @NotNull String aliasValue, Map extras) throws NextStepClientException { @@ -1777,6 +2203,17 @@ public ObjectResponse updateUserAliasPost(@NotNull Stri if (extras != null) { request.getExtras().putAll(extras); } + return updateUserAliasPost(request); + } + + /** + * Update a user alias via POST method. + * + * @param request Update user alias request. + * @return Update user alias response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateUserAliasPost(@NotNull final UpdateUserAliasRequest request) throws NextStepClientException { return postObjectImpl("/user/alias/update", new ObjectRequest<>(request), UpdateUserAliasResponse.class); } @@ -1817,11 +2254,23 @@ public ObjectResponse getUserAliasListPost(@NotNull St * @param aliasName Alias name. * @return Delete user alias response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #deleteUserAlias(DeleteUserAliasRequest) */ public ObjectResponse deleteUserAlias(@NotNull String userId, @NotNull String aliasName) throws NextStepClientException { final DeleteUserAliasRequest request = new DeleteUserAliasRequest(); request.setUserId(userId); request.setAliasName(aliasName); + return deleteUserAlias(request); + } + + /** + * Delete a user alias. + * + * @param request Delete user alias request. + * @return Delete user alias response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse deleteUserAlias(@NotNull final DeleteUserAliasRequest request) throws NextStepClientException { return postObjectImpl("/user/alias/delete", new ObjectRequest<>(request), DeleteUserAliasResponse.class); } @@ -1905,6 +2354,7 @@ public ObjectResponse getUserAuthenticationLi * @param credentialValue Credential value. * @return Create credential response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createCredential(CreateCredentialRequest) */ public ObjectResponse createCredential(@NotNull String userId, @NotNull String credentialName, @NotNull CredentialType credentialType, String username, String credentialValue) throws NextStepClientException { @@ -1914,7 +2364,7 @@ public ObjectResponse createCredential(@NotNull String request.setCredentialType(credentialType); request.setUsername(username); request.setCredentialValue(credentialValue); - return postObjectImpl("/credential", new ObjectRequest<>(request), CreateCredentialResponse.class); + return createCredential(request); } /** @@ -1929,6 +2379,7 @@ public ObjectResponse createCredential(@NotNull String * @param credentialHistory List with pairs of username : credentialValue for credential history. * @return Create credential response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createCredential(CreateCredentialRequest) */ public ObjectResponse createCredential(@NotNull String userId, @NotNull String credentialName, @NotNull CredentialType credentialType, String username, String credentialValue, CredentialValidationMode validationMode, @@ -1948,6 +2399,17 @@ public ObjectResponse createCredential(@NotNull String request.getCredentialHistory().add(h); }); } + return createCredential(request); + } + + /** + * Create a credential. + * + * @param request Create credential request. + * @return Create credential response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createCredential(@NotNull final CreateCredentialRequest request) throws NextStepClientException { return postObjectImpl("/credential", new ObjectRequest<>(request), CreateCredentialResponse.class); } @@ -1962,6 +2424,7 @@ public ObjectResponse createCredential(@NotNull String * @param credentialStatus Credential status. * @return Update credential response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateCredential(UpdateCredentialRequest) */ public ObjectResponse updateCredential(@NotNull String userId, @NotNull String credentialName, CredentialType credentialType, String username, String credentialValue, CredentialStatus credentialStatus) throws NextStepClientException { @@ -1972,6 +2435,17 @@ public ObjectResponse updateCredential(@NotNull String request.setUsername(username); request.setCredentialValue(credentialValue); request.setCredentialStatus(credentialStatus); + return updateCredential(request); + } + + /** + * Update a credential via PUT method. + * + * @param request Update credential request. + * @return Update credential response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateCredential(@NotNull final UpdateCredentialRequest request) throws NextStepClientException { return putObjectImpl("/credential", new ObjectRequest<>(request), UpdateCredentialResponse.class); } @@ -1986,6 +2460,7 @@ public ObjectResponse updateCredential(@NotNull String * @param credentialStatus Credential status. * @return Update credential response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateCredentialPost(UpdateCredentialRequest) */ public ObjectResponse updateCredentialPost(@NotNull String userId, @NotNull String credentialName, CredentialType credentialType, String username, String credentialValue, CredentialStatus credentialStatus) throws NextStepClientException { @@ -1996,6 +2471,17 @@ public ObjectResponse updateCredentialPost(@NotNull St request.setUsername(username); request.setCredentialValue(credentialValue); request.setCredentialStatus(credentialStatus); + return updateCredentialPost(request); + } + + /** + * Update a credential via POST method. + * + * @param request Update credential request. + * @return Update credential response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateCredentialPost(@NotNull final UpdateCredentialRequest request) throws NextStepClientException { return postObjectImpl("/credential/update", new ObjectRequest<>(request), UpdateCredentialResponse.class); } @@ -2009,6 +2495,7 @@ public ObjectResponse updateCredentialPost(@NotNull St * @param validationMode Credential validation mode. * @return Validate credential response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #validateCredential(ValidateCredentialRequest) */ public ObjectResponse validateCredential(@NotNull String userId, @NotNull String credentialName, String username, String credentialValue, @NotNull CredentialValidationMode validationMode) throws NextStepClientException { @@ -2018,6 +2505,17 @@ public ObjectResponse validateCredential(@NotNull St request.setUsername(username); request.setCredentialValue(credentialValue); request.setValidationMode(validationMode); + return validateCredential(request); + } + + /** + * Validate a credential. + * + * @param request Validate credential request. + * @return Validate credential response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse validateCredential(@NotNull final ValidateCredentialRequest request) throws NextStepClientException { return postObjectImpl("/credential/validate", new ObjectRequest<>(request), ValidateCredentialResponse.class); } @@ -2029,12 +2527,24 @@ public ObjectResponse validateCredential(@NotNull St * @param credentialType Credential type. * @return Reset credential response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #resetCredential(ResetCredentialRequest) */ public ObjectResponse resetCredential(@NotNull String userId, @NotNull String credentialName, CredentialType credentialType) throws NextStepClientException { final ResetCredentialRequest request = new ResetCredentialRequest(); request.setUserId(userId); request.setCredentialName(credentialName); request.setCredentialType(credentialType); + return resetCredential(request); + } + + /** + * Reset a credential. + * + * @param request Reset credential request. + * @return Reset credential response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse resetCredential(@NotNull final ResetCredentialRequest request) throws NextStepClientException { return postObjectImpl("/credential/reset", new ObjectRequest<>(request), ResetCredentialResponse.class); } @@ -2045,11 +2555,23 @@ public ObjectResponse resetCredential(@NotNull String u * @param credentialName Credential name. * @return Block credential response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #blockCredential(BlockCredentialRequest) */ public ObjectResponse blockCredential(@NotNull String userId, @NotNull String credentialName) throws NextStepClientException { final BlockCredentialRequest request = new BlockCredentialRequest(); request.setUserId(userId); request.setCredentialName(credentialName); + return blockCredential(request); + } + + /** + * Block a credential. + * + * @param request Block credential request. + * @return Block credential response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse blockCredential(@NotNull final BlockCredentialRequest request) throws NextStepClientException { return postObjectImpl("/credential/block", new ObjectRequest<>(request), BlockCredentialResponse.class); } @@ -2060,11 +2582,23 @@ public ObjectResponse blockCredential(@NotNull String u * @param credentialName Credential name. * @return Unblock credential response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #unblockCredential(UnblockCredentialRequest) */ public ObjectResponse unblockCredential(@NotNull String userId, @NotNull String credentialName) throws NextStepClientException { final UnblockCredentialRequest request = new UnblockCredentialRequest(); request.setUserId(userId); request.setCredentialName(credentialName); + return unblockCredential(request); + } + + /** + * Unblock a credential. + * + * @param request Unblock credential request. + * @return Unblock credential response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse unblockCredential(@NotNull final UnblockCredentialRequest request) throws NextStepClientException { return postObjectImpl("/credential/unblock", new ObjectRequest<>(request), UnblockCredentialResponse.class); } @@ -2075,11 +2609,23 @@ public ObjectResponse unblockCredential(@NotNull Stri * @param credentialName Credential name. * @return Delete credential response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #deleteCredential(DeleteCredentialRequest) */ public ObjectResponse deleteCredential(@NotNull String userId, @NotNull String credentialName) throws NextStepClientException { final DeleteCredentialRequest request = new DeleteCredentialRequest(); request.setUserId(userId); request.setCredentialName(credentialName); + return deleteCredential(request); + } + + /** + * Delete a credential. + * + * @param request Delete credential request. + * @return Delete credential response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse deleteCredential(@NotNull final DeleteCredentialRequest request) throws NextStepClientException { return postObjectImpl("/credential/delete", new ObjectRequest<>(request), DeleteCredentialResponse.class); } @@ -2093,12 +2639,24 @@ public ObjectResponse deleteCredential(@NotNull String * @param authenticationResult Authentication result. * @return Update credential counter response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #updateCredentialCounter(UpdateCounterRequest) */ public ObjectResponse updateCredentialCounter(@NotNull String userId, @NotNull String credentialName, @NotNull AuthenticationResult authenticationResult) throws NextStepClientException { final UpdateCounterRequest request = new UpdateCounterRequest(); request.setUserId(userId); request.setCredentialName(credentialName); request.setAuthenticationResult(authenticationResult); + return updateCredentialCounter(request); + } + + /** + * Update a credential counter. + * + * @param request Update counter request. + * @return Update credential counter response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse updateCredentialCounter(@NotNull final UpdateCounterRequest request) throws NextStepClientException { return postObjectImpl("/credential/counter/update", new ObjectRequest<>(request), UpdateCounterResponse.class); } @@ -2125,6 +2683,7 @@ public ObjectResponse resetAllCounters(ResetCountersReque * @param operationId Operation ID. * @return Create OTP response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createOtp(CreateOtpRequest) */ public ObjectResponse createOtp(String userId, @NotNull String otpName, String credentialName, String otpData, String operationId) throws NextStepClientException { final CreateOtpRequest request = new CreateOtpRequest(); @@ -2133,7 +2692,7 @@ public ObjectResponse createOtp(String userId, @NotNull Strin request.setCredentialName(credentialName); request.setOtpData(otpData); request.setOperationId(operationId); - return postObjectImpl("/otp", new ObjectRequest<>(request), CreateOtpResponse.class); + return createOtp(request); } /** @@ -2145,6 +2704,7 @@ public ObjectResponse createOtp(String userId, @NotNull Strin * @param otpData OTP data. * @return Create OTP response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createOtp(CreateOtpRequest) */ public ObjectResponse createOtp(String userId, @NotNull String otpName, String credentialName, String otpData) throws NextStepClientException { final CreateOtpRequest request = new CreateOtpRequest(); @@ -2152,6 +2712,17 @@ public ObjectResponse createOtp(String userId, @NotNull Strin request.setOtpName(otpName); request.setCredentialName(credentialName); request.setOtpData(otpData); + return createOtp(request); + } + + /** + * Create an OTP. + * + * @param request Create OTP request. + * @return Create OTP response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createOtp(final CreateOtpRequest request) throws NextStepClientException { return postObjectImpl("/otp", new ObjectRequest<>(request), CreateOtpResponse.class); } @@ -2166,6 +2737,7 @@ public ObjectResponse createOtp(String userId, @NotNull Strin * @param language Language as defined in ISO-639 with 2 characters. * @return Create and send OTP response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createAndSendOtp(CreateAndSendOtpRequest) */ public ObjectResponse createAndSendOtp(String userId, @NotNull String otpName, String credentialName, String otpData, String operationId, String language) throws NextStepClientException { final CreateAndSendOtpRequest request = new CreateAndSendOtpRequest(); @@ -2175,6 +2747,17 @@ public ObjectResponse createAndSendOtp(String userId, request.setOtpData(otpData); request.setOperationId(operationId); request.setLanguage(language); + return createAndSendOtp(request); + } + + /** + * Create an OTP with operation and send it. + * + * @param request Create and send OTP request. + * @return Create and send OTP response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createAndSendOtp(final CreateAndSendOtpRequest request) throws NextStepClientException { return postObjectImpl("/otp/send", new ObjectRequest<>(request), CreateAndSendOtpResponse.class); } @@ -2249,11 +2832,23 @@ public ObjectResponse getOtpDetailPost(String otpId, Strin * @param operationId Operation ID. * @return Delete OTP response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #deleteOtp(DeleteOtpRequest) */ public ObjectResponse deleteOtp(String otpId, String operationId) throws NextStepClientException { final DeleteOtpRequest request = new DeleteOtpRequest(); request.setOtpId(otpId); request.setOperationId(operationId); + return deleteOtp(request); + } + + /** + * Delete an OTP. + * + * @param request Delete OTP request. + * @return Delete OTP response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse deleteOtp(@NotNull final DeleteOtpRequest request) throws NextStepClientException { return postObjectImpl("/otp/delete", new ObjectRequest<>(request), DeleteOtpResponse.class); } @@ -2266,12 +2861,13 @@ public ObjectResponse deleteOtp(String otpId, String operatio * @param otpValue OTP value. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateWithOtp(OtpAuthenticationRequest) */ public ObjectResponse authenticateWithOtp(String otpId, @NotNull String otpValue) throws NextStepClientException { final OtpAuthenticationRequest request = new OtpAuthenticationRequest(); request.setOtpId(otpId); request.setOtpValue(otpValue); - return postObjectImpl("/auth/otp", new ObjectRequest<>(request), OtpAuthenticationResponse.class); + return authenticateWithOtp(request); } /** @@ -2284,6 +2880,7 @@ public ObjectResponse authenticateWithOtp(String otpI * @param authMethod Authentication method used for operation update. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateWithOtp(OtpAuthenticationRequest) */ public ObjectResponse authenticateWithOtp(String otpId, String operationId, @NotNull String otpValue, boolean updateOperation, AuthMethod authMethod) throws NextStepClientException { @@ -2293,7 +2890,7 @@ public ObjectResponse authenticateWithOtp(String otpI request.setOtpValue(otpValue); request.setUpdateOperation(updateOperation); request.setAuthMethod(authMethod); - return postObjectImpl("/auth/otp", new ObjectRequest<>(request), OtpAuthenticationResponse.class); + return authenticateWithOtp(request); } /** @@ -2307,6 +2904,7 @@ public ObjectResponse authenticateWithOtp(String otpI * @param authMethod Authentication method used for operation update. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateWithOtp(OtpAuthenticationRequest) */ public ObjectResponse authenticateWithOtp(String otpId, String operationId, @NotNull String otpValue, boolean checkOnly, boolean updateOperation, AuthMethod authMethod) throws NextStepClientException { @@ -2317,6 +2915,17 @@ public ObjectResponse authenticateWithOtp(String otpI request.setCheckOnly(checkOnly); request.setUpdateOperation(updateOperation); request.setAuthMethod(authMethod); + return authenticateWithOtp(request); + } + + /** + * Authenticate using OTP with operation. + * + * @param request OTP authentication request. + * @return OTP authentication response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse authenticateWithOtp(@NotNull final OtpAuthenticationRequest request) throws NextStepClientException { return postObjectImpl("/auth/otp", new ObjectRequest<>(request), OtpAuthenticationResponse.class); } @@ -2328,13 +2937,14 @@ public ObjectResponse authenticateWithOtp(String otpI * @param credentialValue Credential value. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateWithCredential(CredentialAuthenticationRequest) */ public ObjectResponse authenticateWithCredential(@NotNull String credentialName, @NotNull String userId, @NotNull String credentialValue) throws NextStepClientException { final CredentialAuthenticationRequest request = new CredentialAuthenticationRequest(); request.setCredentialName(credentialName); request.setUserId(userId); request.setCredentialValue(credentialValue); - return postObjectImpl("/auth/credential", new ObjectRequest<>(request), CredentialAuthenticationResponse.class); + return authenticateWithCredential(request); } /** @@ -2347,6 +2957,7 @@ public ObjectResponse authenticateWithCredenti * @param credentialPositionsToVerify Credential positions to verify. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateWithCredential(CredentialAuthenticationRequest) */ public ObjectResponse authenticateWithCredential(@NotNull String credentialName, @NotNull String userId, @NotNull String credentialValue, CredentialAuthenticationMode authenticationMode, List credentialPositionsToVerify) throws NextStepClientException { @@ -2356,7 +2967,7 @@ public ObjectResponse authenticateWithCredenti request.setCredentialValue(credentialValue); request.setAuthenticationMode(authenticationMode); request.setCredentialPositionsToVerify(credentialPositionsToVerify); - return postObjectImpl("/auth/credential", new ObjectRequest<>(request), CredentialAuthenticationResponse.class); + return authenticateWithCredential(request); } /** @@ -2370,6 +2981,7 @@ public ObjectResponse authenticateWithCredenti * @param authMethod Authentication method used for operation update. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateWithCredential(CredentialAuthenticationRequest) */ public ObjectResponse authenticateWithCredential(@NotNull String credentialName, @NotNull String userId, @NotNull String credentialValue, String operationId, boolean updateOperation, AuthMethod authMethod) throws NextStepClientException { @@ -2380,7 +2992,7 @@ public ObjectResponse authenticateWithCredenti request.setOperationId(operationId); request.setUpdateOperation(updateOperation); request.setAuthMethod(authMethod); - return postObjectImpl("/auth/credential", new ObjectRequest<>(request), CredentialAuthenticationResponse.class); + return authenticateWithCredential(request); } /** @@ -2396,6 +3008,7 @@ public ObjectResponse authenticateWithCredenti * @param authMethod Authentication method used for operation update. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateWithCredential(CredentialAuthenticationRequest) */ public ObjectResponse authenticateWithCredential(@NotNull String credentialName, @NotNull String userId, @NotNull String credentialValue, CredentialAuthenticationMode authenticationMode, List credentialPositionsToVerify, @@ -2409,36 +3022,44 @@ public ObjectResponse authenticateWithCredenti request.setOperationId(operationId); request.setUpdateOperation(updateOperation); request.setAuthMethod(authMethod); - return postObjectImpl("/auth/credential", new ObjectRequest<>(request), CredentialAuthenticationResponse.class); + return authenticateWithCredential(request); } + /** + * Authenticate using credential. + * + * @param request Credential authentication request. + * @return OTP authentication response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse authenticateWithCredential(@NotNull final CredentialAuthenticationRequest request) throws NextStepClientException { + return postObjectImpl("/auth/credential", new ObjectRequest<>(request), CredentialAuthenticationResponse.class); + } /** * Authenticate using credential and OTP without operation. * - * @param credentialName Credential name. * @param userId User ID. * @param credentialValue Credential value. * @param otpId OTP ID. * @param otpValue OTP value. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateCombined(CombinedAuthenticationRequest) */ - public ObjectResponse authenticateCombined(@NotNull String credentialName, @NotNull String userId, @NotNull String credentialValue, + public ObjectResponse authenticateCombined(@NotNull String userId, @NotNull String credentialValue, String otpId, @NotNull String otpValue) throws NextStepClientException { final CombinedAuthenticationRequest request = new CombinedAuthenticationRequest(); - request.setCredentialName(credentialName); request.setUserId(userId); request.setCredentialValue(credentialValue); request.setOtpId(otpId); request.setOtpValue(otpValue); - return postObjectImpl("/auth/combined", new ObjectRequest<>(request), CombinedAuthenticationResponse.class); + return authenticateCombined(request); } /** * Authenticate using credential and OTP without operation and with additional details. * - * @param credentialName Credential name. * @param userId User ID. * @param credentialValue Credential value. * @param authenticationMode Authentication mode. @@ -2447,25 +3068,24 @@ public ObjectResponse authenticateCombined(@NotN * @param otpValue OTP value. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateCombined(CombinedAuthenticationRequest) */ - public ObjectResponse authenticateCombined(@NotNull String credentialName, @NotNull String userId, @NotNull String credentialValue, + public ObjectResponse authenticateCombined(@NotNull String userId, @NotNull String credentialValue, CredentialAuthenticationMode authenticationMode, List credentialPositionsToVerify, String otpId, @NotNull String otpValue) throws NextStepClientException { final CombinedAuthenticationRequest request = new CombinedAuthenticationRequest(); - request.setCredentialName(credentialName); request.setUserId(userId); request.setCredentialValue(credentialValue); request.setAuthenticationMode(authenticationMode); request.setCredentialPositionsToVerify(credentialPositionsToVerify); request.setOtpId(otpId); request.setOtpValue(otpValue); - return postObjectImpl("/auth/combined", new ObjectRequest<>(request), CombinedAuthenticationResponse.class); + return authenticateCombined(request); } /** * Authenticate using credential and OTP with operation. * - * @param credentialName Credential name. * @param userId User ID. * @param credentialValue Credential value. * @param otpId OTP ID. @@ -2475,12 +3095,12 @@ public ObjectResponse authenticateCombined(@NotN * @param authMethod Authentication method used for operation update. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateCombined(CombinedAuthenticationRequest) */ - public ObjectResponse authenticateCombined(@NotNull String credentialName, @NotNull String userId, @NotNull String credentialValue, + public ObjectResponse authenticateCombined(@NotNull String userId, @NotNull String credentialValue, String otpId, String operationId, @NotNull String otpValue, boolean updateOperation, AuthMethod authMethod) throws NextStepClientException { final CombinedAuthenticationRequest request = new CombinedAuthenticationRequest(); - request.setCredentialName(credentialName); request.setUserId(userId); request.setCredentialValue(credentialValue); request.setOtpId(otpId); @@ -2488,13 +3108,12 @@ public ObjectResponse authenticateCombined(@NotN request.setOtpValue(otpValue); request.setUpdateOperation(updateOperation); request.setAuthMethod(authMethod); - return postObjectImpl("/auth/combined", new ObjectRequest<>(request), CombinedAuthenticationResponse.class); + return authenticateCombined(request); } /** * Authenticate using credential and OTP with operation and with additional details. * - * @param credentialName Credential name. * @param userId User ID. * @param credentialValue Credential value. * @param authenticationMode Authentication mode. @@ -2506,13 +3125,13 @@ public ObjectResponse authenticateCombined(@NotN * @param authMethod Authentication method used for operation update. * @return OTP authentication response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #authenticateCombined(CombinedAuthenticationRequest) */ - public ObjectResponse authenticateCombined(@NotNull String credentialName, @NotNull String userId, @NotNull String credentialValue, + public ObjectResponse authenticateCombined(@NotNull String userId, @NotNull String credentialValue, CredentialAuthenticationMode authenticationMode, List credentialPositionsToVerify, String otpId, String operationId, @NotNull String otpValue, boolean updateOperation, AuthMethod authMethod) throws NextStepClientException { final CombinedAuthenticationRequest request = new CombinedAuthenticationRequest(); - request.setCredentialName(credentialName); request.setUserId(userId); request.setCredentialValue(credentialValue); request.setAuthenticationMode(authenticationMode); @@ -2522,6 +3141,17 @@ public ObjectResponse authenticateCombined(@NotN request.setOtpValue(otpValue); request.setUpdateOperation(updateOperation); request.setAuthMethod(authMethod); + return authenticateCombined(request); + } + + /** + * Authenticate using credential and OTP. + * + * @param request Combined authentication request. + * @return OTP authentication response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse authenticateCombined(@NotNull final CombinedAuthenticationRequest request) throws NextStepClientException { return postObjectImpl("/auth/combined", new ObjectRequest<>(request), CombinedAuthenticationResponse.class); } @@ -2534,11 +3164,23 @@ public ObjectResponse authenticateCombined(@NotN * @param data Audit log data. * @return Create audit log response. * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + * @see #createAudit(CreateAuditRequest) */ public ObjectResponse createAudit(@NotNull String action, String data) throws NextStepClientException { final CreateAuditRequest request = new CreateAuditRequest(); request.setAction(action); request.setData(data); + return createAudit(request); + } + + /** + * Create an audit log. + * + * @param request Create audit request. + * @return Create audit log response. + * @throws NextStepClientException Thrown when REST API call fails, including {@link ErrorResponse} with error code. + */ + public ObjectResponse createAudit(@NotNull final CreateAuditRequest request) throws NextStepClientException { return postObjectImpl("/audit", new ObjectRequest<>(request), CreateAuditResponse.class); } diff --git a/powerauth-nextstep-model/pom.xml b/powerauth-nextstep-model/pom.xml index dd1742ad6..5519b7197 100644 --- a/powerauth-nextstep-model/pom.xml +++ b/powerauth-nextstep-model/pom.xml @@ -29,7 +29,7 @@ io.getlime.security powerauth-webflow-parent - 1.7.0 + 1.8.0 diff --git a/powerauth-nextstep-model/src/main/java/io/getlime/security/powerauth/lib/nextstep/model/request/CombinedAuthenticationRequest.java b/powerauth-nextstep-model/src/main/java/io/getlime/security/powerauth/lib/nextstep/model/request/CombinedAuthenticationRequest.java index 6cd478b20..1e5c4ce6e 100644 --- a/powerauth-nextstep-model/src/main/java/io/getlime/security/powerauth/lib/nextstep/model/request/CombinedAuthenticationRequest.java +++ b/powerauth-nextstep-model/src/main/java/io/getlime/security/powerauth/lib/nextstep/model/request/CombinedAuthenticationRequest.java @@ -34,9 +34,6 @@ @Data public class CombinedAuthenticationRequest { - @NotBlank - @Size(min = 2, max = 256) - private String credentialName; @NotBlank @Size(min = 1, max = 256) private String userId; diff --git a/powerauth-nextstep/pom.xml b/powerauth-nextstep/pom.xml index 25d1051ef..c7ef55d63 100644 --- a/powerauth-nextstep/pom.xml +++ b/powerauth-nextstep/pom.xml @@ -28,7 +28,7 @@ io.getlime.security powerauth-webflow-parent - 1.7.0 + 1.8.0 @@ -194,19 +194,6 @@ - - org.apache.maven.plugins - maven-war-plugin - - - - src/main/webapp/WEB-INF - WEB-INF - true - - - - diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/configuration/NextStepServerConfiguration.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/configuration/NextStepServerConfiguration.java index 7a982a758..223db6db9 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/configuration/NextStepServerConfiguration.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/configuration/NextStepServerConfiguration.java @@ -29,8 +29,7 @@ import com.wultra.security.powerauth.rest.client.PowerAuthRestClientConfiguration; import io.getlime.security.powerauth.lib.dataadapter.client.DataAdapterClient; import io.getlime.security.powerauth.lib.dataadapter.client.DataAdapterClientErrorException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -38,6 +37,8 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import java.time.Duration; + /** * Configuration of Next Step server. * @@ -46,9 +47,9 @@ @Configuration @ConfigurationProperties("ext") @ComponentScan(basePackages = {"io.getlime.security.powerauth"}) +@Slf4j public class NextStepServerConfiguration { - private static final Logger logger = LoggerFactory.getLogger(NextStepServerConfiguration.class); private final AuditFactory auditFactory; /** @@ -60,6 +61,12 @@ public class NextStepServerConfiguration { @Value("${powerauth.service.url}") private String powerAuthRestUrl; + @Value("${powerauth.service.restClientConfig.responseTimeout}") + private Duration powerAuthServiceTimeout; + + @Value("${powerauth.service.restClientConfig.maxIdleTime}") + private Duration powerAuthServiceMaxIdleTime; + @Value("${powerauth.service.security.clientToken}") private String powerAuthClientToken; @@ -211,18 +218,14 @@ public DataAdapterClient defaultDataAdapterClient() { * @return PowerAuth REST client. */ @Bean - public PowerAuthClient powerAuthClient() { + public PowerAuthClient powerAuthClient() throws PowerAuthClientException { final PowerAuthRestClientConfiguration config = new PowerAuthRestClientConfiguration(); config.setPowerAuthClientToken(powerAuthClientToken); config.setPowerAuthClientSecret(powerAuthClientSecret); config.setAcceptInvalidSslCertificate(powerAuthAcceptInvalidSslCertificate); - try { - return new PowerAuthRestClient(powerAuthRestUrl, config); - } catch (PowerAuthClientException ex) { - logger.error(ex.getMessage(), ex); - audit().error(ex.getMessage(), ex); - return null; - } + config.setResponseTimeout(powerAuthServiceTimeout); + config.setMaxIdleTime(powerAuthServiceMaxIdleTime); + return new PowerAuthRestClient(powerAuthRestUrl, config); } /** diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/configuration/OpenApiConfiguration.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/configuration/OpenApiConfiguration.java index 5aaa053f9..2494a5b86 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/configuration/OpenApiConfiguration.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/configuration/OpenApiConfiguration.java @@ -21,6 +21,7 @@ import io.swagger.v3.oas.annotations.info.Contact; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.info.License; +import io.swagger.v3.oas.annotations.servers.Server; import org.springdoc.core.models.GroupedOpenApi; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -32,6 +33,7 @@ */ @Configuration @OpenAPIDefinition( + servers = @Server(url="/powerauth-nextstep"), info = @Info( title = "PowerAuth Next Step RESTful API Documentation", version = "1.0", diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/service/AuthenticationService.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/service/AuthenticationService.java index 49fb6bed0..0aa9f478e 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/service/AuthenticationService.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/service/AuthenticationService.java @@ -42,6 +42,7 @@ import io.getlime.security.powerauth.lib.nextstep.model.exception.*; import io.getlime.security.powerauth.lib.nextstep.model.request.*; import io.getlime.security.powerauth.lib.nextstep.model.response.*; +import jakarta.validation.constraints.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -421,19 +422,12 @@ public OtpAuthenticationResponse authenticateWithOtp(OtpAuthenticationRequest re } } - final Integer remainingAttempts = resolveRemainingAttempts(credential, otp, operation); - if (Integer.valueOf(0).equals(remainingAttempts) && otp.getStatus() == OtpStatus.ACTIVE) { - logger.debug("OTP was blocked because there are no remaining attempts left, OTP ID: {}", otp.getOtpId()); - otp.setStatus(OtpStatus.BLOCKED); - otp.setTimestampBlocked(new Date()); - // OTP was updated, save authentication with OTP - authenticationRepository.save(authentication); - } + final Integer remainingAttempts = resolveRemainingAttemptsAndBlockOtpIfNeeded(credential, otp, operation, authentication); final String mode = checkOnly ? "check" : "authentication"; - logger.info("OTP " + mode + " result: {}, remaining attempts: {}, user ID: {}, user identity status: {}, OTP status: {}, credential status: {}, operation failed: {}", - authenticationResult, remainingAttempts, user == null ? null : user.getUserId(), user == null ? null : user.getStatus(), otp.getStatus(), credential == null ? null : credential.getStatus(), operationFailed); + logger.info("OTP {} result: {}, remaining attempts: {}, user ID: {}, user identity status: {}, OTP status: {}, credential status: {}, operation failed: {}", + mode, authenticationResult, remainingAttempts, user == null ? null : user.getUserId(), user == null ? null : user.getStatus(), otp.getStatus(), credential == null ? null : credential.getStatus(), operationFailed); audit.info("OTP authentication result", AuditDetail.builder() .type(AUDIT_TYPE_AUTHENTICATION) .param("userId", user != null ? user.getUserId() : null) @@ -551,6 +545,9 @@ public CombinedAuthenticationResponse authenticateCombined(CombinedAuthenticatio final IdGeneratorService idGeneratorService = serviceCatalogue.getIdGeneratorService(); final OtpEntity otp = otpService.findOtp(request.getOtpId(), request.getOperationId()); + if (otp.getCredentialDefinition() == null || otp.getCredentialDefinition().getName() == null) { + throw new InvalidRequestException("Credential definition is not set for operation with OTP Id and Operation Id: " + request.getOtpId() + ", " + request.getOperationId()); + } if (otp.getOtpDefinition().isDataAdapterProxyEnabled()) { logger.info("Combined authentication proxied through Data Adapter, OTP ID: {}", request.getOtpId()); return authenticateCombinedCustom(otp.getCredentialDefinition(), otp.getOtpId(), request.getOtpValue(), request.getCredentialValue(), otp.getOperation().getOperationId(), otp.getUserId(), request.getAuthMethod()); @@ -577,10 +574,10 @@ public CombinedAuthenticationResponse authenticateCombined(CombinedAuthenticatio operation = operationPersistenceService.getOperation(request.getOperationId()); } if (request.isUpdateOperation() && operation == null) { - throw new InvalidRequestException("Operation not found, however operation update requested for credential and OTP: " + request.getCredentialName() + ", " + otp.getOtpDefinition().getName()); + throw new InvalidRequestException("Operation not found, however operation update requested for credential and OTP: " + otp.getCredentialDefinition().getName() + ", " + otp.getOtpDefinition().getName()); } if (request.getOperationId() != null && !request.getOperationId().equals(otp.getOperation().getOperationId())) { - throw new InvalidRequestException("Operation ID mismatch for credential and OTP: " + request.getCredentialName() + ", " + otp.getOtpDefinition().getName()); + throw new InvalidRequestException("Operation ID mismatch for credential and OTP: " + otp.getCredentialDefinition().getName() + ", " + otp.getOtpDefinition().getName()); } final CredentialEntity credential = credentialService.findCredential(otp.getCredentialDefinition(), user); final CredentialDefinitionEntity credentialDefinition = credential.getCredentialDefinition(); @@ -666,14 +663,7 @@ public CombinedAuthenticationResponse authenticateCombined(CombinedAuthenticatio } } - final Integer remainingAttempts = resolveRemainingAttempts(credential, otp, operation); - if (Integer.valueOf(0).equals(remainingAttempts) && otp.getStatus() == OtpStatus.ACTIVE) { - logger.debug("OTP was blocked because there are no remaining attempts left, OTP ID: {}", otp.getOtpId()); - otp.setStatus(OtpStatus.BLOCKED); - otp.setTimestampBlocked(new Date()); - // OTP was updated, save authentication with OTP - authenticationRepository.save(authentication); - } + final Integer remainingAttempts = resolveRemainingAttemptsAndBlockOtpIfNeeded(credential, otp, operation, authentication); logger.info("Combined authentication result: {}, credential authentication result: {}, OTP authentication result: {}, remaining attempts: {}, user ID: {}, user identity status: {}, OTP status: {}, credential status: {}, operation failed: {}", authenticationResult, credentialAuthenticationResult, otpAuthenticationResult, remainingAttempts, user.getUserId(), user.getStatus(), otp.getStatus(), credential.getStatus(), operationFailed); @@ -978,6 +968,18 @@ private UpdateOperationResponse updateOperation(String userId, OperationEntity o } } + private Integer resolveRemainingAttemptsAndBlockOtpIfNeeded(final CredentialEntity credential, final @NotNull OtpEntity otp, final OperationEntity operation, final AuthenticationEntity authentication) { + final Integer remainingAttempts = resolveRemainingAttempts(credential, otp, operation); + if (Integer.valueOf(0).equals(remainingAttempts) && otp.getStatus() == OtpStatus.ACTIVE) { + logger.debug("OTP was blocked because there are no remaining attempts left, OTP ID: {}", otp.getOtpId()); + otp.setStatus(OtpStatus.BLOCKED); + otp.setTimestampBlocked(new Date()); + // OTP was updated, save authentication with OTP + authenticationRepository.save(authentication); + } + return remainingAttempts; + } + /** * Resolve remaining attempts for a credential entity, OTP entity and operation. * @param credential Credential entity or null for no credential. diff --git a/powerauth-nextstep/src/main/resources/application.properties b/powerauth-nextstep/src/main/resources/application.properties index 9eade1abb..0f24fd4c6 100644 --- a/powerauth-nextstep/src/main/resources/application.properties +++ b/powerauth-nextstep/src/main/resources/application.properties @@ -6,6 +6,7 @@ spring.datasource.url=jdbc:postgresql://localhost:5432/powerauth spring.datasource.username=powerauth spring.datasource.password= spring.datasource.hikari.auto-commit=false +spring.datasource.hikari.pool-name=HikariPool-NextStep spring.jpa.properties.hibernate.connection.characterEncoding=utf8 spring.jpa.properties.hibernate.connection.useUnicode=true @@ -19,6 +20,8 @@ powerauth.dataAdapter.service.url=http://localhost:8080/powerauth-data-adapter # PowerAuth Server URL powerauth.service.url=http://localhost:8080/powerauth-java-server/rest +powerauth.service.restClientConfig.responseTimeout=60s +powerauth.service.restClientConfig.maxIdleTime=200s powerauth.service.security.clientToken= powerauth.service.security.clientSecret= # Whether invalid SSL certificates should be accepted @@ -77,3 +80,6 @@ spring.security.oauth2.resource-server.jwt.audiences= # Monitoring management.tracing.sampling.probability=1.0 + +spring.autoconfigure.exclude=\ + org.springframework.boot.actuate.autoconfigure.metrics.jersey.JerseyServerMetricsAutoConfiguration diff --git a/powerauth-nextstep/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/powerauth-nextstep/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index d2b08aaf6..8ecc00e61 100644 --- a/powerauth-nextstep/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/powerauth-nextstep/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -1,5 +1,5 @@ - + @@ -10,11 +10,6 @@ - - - - - diff --git a/powerauth-nextstep/src/test/java/io/getlime/security/powerauth/app/nextstep/NextStepAuthenticationTest.java b/powerauth-nextstep/src/test/java/io/getlime/security/powerauth/app/nextstep/NextStepAuthenticationTest.java index 216ca1bf8..774fd626a 100644 --- a/powerauth-nextstep/src/test/java/io/getlime/security/powerauth/app/nextstep/NextStepAuthenticationTest.java +++ b/powerauth-nextstep/src/test/java/io/getlime/security/powerauth/app/nextstep/NextStepAuthenticationTest.java @@ -283,7 +283,7 @@ public void testCredentialFailUnknownUser() { @Test public void testCredentialAndOtpSuccessNoOperation() throws NextStepClientException { CreateOtpResponse r1 = nextStepClient.createOtp("test_user_1", "TEST_OTP", "TEST_CREDENTIAL", "TEST_DATA").getResponseObject(); - CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("TEST_CREDENTIAL", "test_user_1", "s3cret", r1.getOtpId(), r1.getOtpValue()).getResponseObject(); + CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("test_user_1", "s3cret", r1.getOtpId(), r1.getOtpValue()).getResponseObject(); assertEquals(AuthenticationResult.SUCCEEDED, r2.getAuthenticationResult()); } @@ -291,7 +291,7 @@ public void testCredentialAndOtpSuccessNoOperation() throws NextStepClientExcept public void testCredentialAndOtpSuccessWithOperation() throws NextStepClientException { nextStepClient.createOperation("auth_otp", "test_operation_8", "A1", null, null); CreateOtpResponse r1 = nextStepClient.createOtp("test_user_1", "TEST_OTP", "TEST_CREDENTIAL", "TEST_DATA", "test_operation_8").getResponseObject(); - CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("TEST_CREDENTIAL", "test_user_1", "s3cret", r1.getOtpId(), "test_operation_8", r1.getOtpValue(), true, null).getResponseObject(); + CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("test_user_1", "s3cret", r1.getOtpId(), "test_operation_8", r1.getOtpValue(), true, null).getResponseObject(); assertEquals(AuthenticationResult.SUCCEEDED, r2.getAuthenticationResult()); GetOperationDetailResponse r3 = nextStepClient.getOperationDetail("test_operation_8").getResponseObject(); assertEquals(AuthResult.DONE, r3.getResult()); @@ -300,7 +300,7 @@ public void testCredentialAndOtpSuccessWithOperation() throws NextStepClientExce @Test public void testCredentialAndOtpFailNoOperation1() throws NextStepClientException { CreateOtpResponse r1 = nextStepClient.createOtp("test_user_1", "TEST_OTP", "TEST_CREDENTIAL", "TEST_DATA").getResponseObject(); - CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("TEST_CREDENTIAL", "test_user_1", "secret", r1.getOtpId(), r1.getOtpValue()).getResponseObject(); + CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("test_user_1", "secret", r1.getOtpId(), r1.getOtpValue()).getResponseObject(); assertEquals(AuthenticationResult.FAILED, r2.getAuthenticationResult()); assertEquals(AuthenticationResult.FAILED, r2.getCredentialAuthenticationResult()); assertEquals(AuthenticationResult.SUCCEEDED, r2.getOtpAuthenticationResult()); @@ -309,7 +309,7 @@ public void testCredentialAndOtpFailNoOperation1() throws NextStepClientExceptio @Test public void testCredentialAndOtpFailNoOperation2() throws NextStepClientException { CreateOtpResponse r1 = nextStepClient.createOtp("test_user_1", "TEST_OTP", "TEST_CREDENTIAL", "TEST_DATA").getResponseObject(); - CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("TEST_CREDENTIAL", "test_user_1", "s3cret", r1.getOtpId(), "0000000000").getResponseObject(); + CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("test_user_1", "s3cret", r1.getOtpId(), "0000000000").getResponseObject(); assertEquals(AuthenticationResult.FAILED, r2.getAuthenticationResult()); assertEquals(AuthenticationResult.SUCCEEDED, r2.getCredentialAuthenticationResult()); assertEquals(AuthenticationResult.FAILED, r2.getOtpAuthenticationResult()); @@ -319,7 +319,7 @@ public void testCredentialAndOtpFailNoOperation2() throws NextStepClientExceptio public void testCredentialAndOtpFailWithOperation1() throws NextStepClientException { nextStepClient.createOperation("auth_otp", "test_operation_9a", "A1", null, null); CreateOtpResponse r1 = nextStepClient.createOtp("test_user_1", "TEST_OTP", "TEST_CREDENTIAL", "TEST_DATA", "test_operation_9a").getResponseObject(); - CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("TEST_CREDENTIAL", "test_user_1", "secret", r1.getOtpId(), "test_operation_9a", r1.getOtpValue(), true, null).getResponseObject(); + CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("test_user_1", "secret", r1.getOtpId(), "test_operation_9a", r1.getOtpValue(), true, null).getResponseObject(); assertEquals(AuthenticationResult.FAILED, r2.getAuthenticationResult()); assertEquals(AuthenticationResult.FAILED, r2.getCredentialAuthenticationResult()); assertEquals(AuthenticationResult.SUCCEEDED, r2.getOtpAuthenticationResult()); @@ -331,7 +331,7 @@ public void testCredentialAndOtpFailWithOperation1() throws NextStepClientExcept public void testCredentialAndOtpFailWithOperation2() throws NextStepClientException { nextStepClient.createOperation("auth_otp", "test_operation_9b", "A1", null, null); CreateOtpResponse r1 = nextStepClient.createOtp("test_user_1", "TEST_OTP", "TEST_CREDENTIAL", "TEST_DATA", "test_operation_9b").getResponseObject(); - CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("TEST_CREDENTIAL", "test_user_1", "s3cret", r1.getOtpId(), "test_operation_9b", "0000000000", true, null).getResponseObject(); + CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("test_user_1", "s3cret", r1.getOtpId(), "test_operation_9b", "0000000000", true, null).getResponseObject(); assertEquals(AuthenticationResult.FAILED, r2.getAuthenticationResult()); assertEquals(AuthenticationResult.SUCCEEDED, r2.getCredentialAuthenticationResult()); assertEquals(AuthenticationResult.FAILED, r2.getOtpAuthenticationResult()); @@ -416,9 +416,9 @@ public void testCredentialVerifyBlockedUser() throws NextStepClientException { @Test public void testOtpAndCredentialVerifyBlockedUser() throws NextStepClientException { - CreateOtpResponse r1 = nextStepClient.createOtp("test_user_1", "TEST_OTP", null, "TEST_DATA").getResponseObject(); + CreateOtpResponse r1 = nextStepClient.createOtp("test_user_1", "TEST_OTP", "TEST_CREDENTIAL", "TEST_DATA").getResponseObject(); nextStepClient.blockUser("test_user_1"); - CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("TEST_CREDENTIAL", "test_user_1", "s3cret", r1.getOtpId(), r1.getOtpValue()).getResponseObject(); + CombinedAuthenticationResponse r2 = nextStepClient.authenticateCombined("test_user_1", "s3cret", r1.getOtpId(), r1.getOtpValue()).getResponseObject(); assertEquals(UserIdentityStatus.BLOCKED, r2.getUserIdentityStatus()); assertEquals(AuthenticationResult.FAILED, r2.getAuthenticationResult()); assertEquals(AuthenticationResult.FAILED, r2.getOtpAuthenticationResult()); @@ -534,7 +534,7 @@ public void testOperationMaxAuthFailsCombined() throws NextStepClientException { nextStepClient.createOperation("auth_otp", "test_operation_11", "A1", null, null); for (int i = 0; i < 4; i++) { nextStepClient.createOtp("test_user_1", "TEST_OTP", "TEST_CREDENTIAL", "TEST_DATA", "test_operation_11"); - CombinedAuthenticationResponse r1 = nextStepClient.authenticateCombined("TEST_CREDENTIAL", "test_user_1", "secret", null, "test_operation_11", "0000000000", true, null).getResponseObject(); + CombinedAuthenticationResponse r1 = nextStepClient.authenticateCombined("test_user_1", "secret", null, "test_operation_11", "0000000000", true, null).getResponseObject(); assertEquals(AuthenticationResult.FAILED, r1.getAuthenticationResult()); if (i < 3) { // 2 attempts for OTP, 2 attempts for credential @@ -549,7 +549,7 @@ public void testOperationMaxAuthFailsCombined() throws NextStepClientException { nextStepClient.updateCredentialCounter("test_user_1", "TEST_CREDENTIAL", AuthenticationResult.SUCCEEDED); } // Operation status changes to FAILED due to 5th failed attempt - CombinedAuthenticationResponse r1 = nextStepClient.authenticateCombined("TEST_CREDENTIAL", "test_user_1", "secret", null, "test_operation_11", "0000000000", true, null).getResponseObject(); + CombinedAuthenticationResponse r1 = nextStepClient.authenticateCombined("test_user_1", "secret", null, "test_operation_11", "0000000000", true, null).getResponseObject(); assertEquals(0, (int) r1.getRemainingAttempts()); assertTrue(r1.isOperationFailed()); assertEquals(AuthenticationResult.FAILED, r1.getAuthenticationResult()); diff --git a/powerauth-tpp-engine-client/pom.xml b/powerauth-tpp-engine-client/pom.xml index b0a837ae2..50e5472c3 100644 --- a/powerauth-tpp-engine-client/pom.xml +++ b/powerauth-tpp-engine-client/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-tpp-engine-client diff --git a/powerauth-tpp-engine-model/pom.xml b/powerauth-tpp-engine-model/pom.xml index 1d9479a6a..9eadfebc3 100644 --- a/powerauth-tpp-engine-model/pom.xml +++ b/powerauth-tpp-engine-model/pom.xml @@ -24,7 +24,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-tpp-engine-model diff --git a/powerauth-tpp-engine/pom.xml b/powerauth-tpp-engine/pom.xml index f1a29dee6..259ef8fa3 100644 --- a/powerauth-tpp-engine/pom.xml +++ b/powerauth-tpp-engine/pom.xml @@ -28,7 +28,7 @@ io.getlime.security powerauth-webflow-parent - 1.7.0 + 1.8.0 diff --git a/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/configuration/OpenApiConfiguration.java b/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/configuration/OpenApiConfiguration.java index 1c61bcb32..6bcb7f00c 100644 --- a/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/configuration/OpenApiConfiguration.java +++ b/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/configuration/OpenApiConfiguration.java @@ -22,6 +22,7 @@ import io.swagger.v3.oas.annotations.info.Contact; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.info.License; +import io.swagger.v3.oas.annotations.servers.Server; import org.springdoc.core.models.GroupedOpenApi; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -33,6 +34,7 @@ */ @Configuration @OpenAPIDefinition( + servers = @Server(url="/powerauth-tpp-engine"), info = @Info( title = "PowerAuth TPP Engine RESTful API Documentation", version = "1.0", diff --git a/powerauth-tpp-engine/src/main/resources/application.properties b/powerauth-tpp-engine/src/main/resources/application.properties index ce153d664..ef04eb9e9 100644 --- a/powerauth-tpp-engine/src/main/resources/application.properties +++ b/powerauth-tpp-engine/src/main/resources/application.properties @@ -6,6 +6,7 @@ spring.datasource.url=jdbc:postgresql://localhost:5432/powerauth spring.datasource.username=powerauth spring.datasource.password= spring.datasource.hikari.auto-commit=false +spring.datasource.hikari.pool-name=HikariPool-TPP-Engine spring.jpa.properties.hibernate.connection.characterEncoding=utf8 spring.jpa.properties.hibernate.connection.useUnicode=true @@ -45,3 +46,6 @@ logging.config=${POWERAUTH_TPP_ENGINE_LOGGING:} # Monitoring management.tracing.sampling.probability=1.0 + +spring.autoconfigure.exclude=\ + org.springframework.boot.actuate.autoconfigure.metrics.jersey.JerseyServerMetricsAutoConfiguration diff --git a/powerauth-tpp-engine/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/powerauth-tpp-engine/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index 9d77e6675..dfc6f1a59 100644 --- a/powerauth-tpp-engine/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/powerauth-tpp-engine/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -1,5 +1,5 @@ - + diff --git a/powerauth-webflow-authentication-approval-sca/pom.xml b/powerauth-webflow-authentication-approval-sca/pom.xml index fd298e3d5..448f641fd 100644 --- a/powerauth-webflow-authentication-approval-sca/pom.xml +++ b/powerauth-webflow-authentication-approval-sca/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-webflow-authentication-approval-sca diff --git a/powerauth-webflow-authentication-consent/pom.xml b/powerauth-webflow-authentication-consent/pom.xml index 8c60a7d4f..3390ece85 100644 --- a/powerauth-webflow-authentication-consent/pom.xml +++ b/powerauth-webflow-authentication-consent/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-webflow-authentication-consent diff --git a/powerauth-webflow-authentication-form/pom.xml b/powerauth-webflow-authentication-form/pom.xml index 221dfbd35..e93b3dc18 100644 --- a/powerauth-webflow-authentication-form/pom.xml +++ b/powerauth-webflow-authentication-form/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-webflow-authentication-form diff --git a/powerauth-webflow-authentication-init/pom.xml b/powerauth-webflow-authentication-init/pom.xml index edee55a98..a85824923 100644 --- a/powerauth-webflow-authentication-init/pom.xml +++ b/powerauth-webflow-authentication-init/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-webflow-authentication-init diff --git a/powerauth-webflow-authentication-login-sca/pom.xml b/powerauth-webflow-authentication-login-sca/pom.xml index b46e7e2e9..fa0f331b4 100644 --- a/powerauth-webflow-authentication-login-sca/pom.xml +++ b/powerauth-webflow-authentication-login-sca/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-webflow-authentication-login-sca diff --git a/powerauth-webflow-authentication-mtoken/pom.xml b/powerauth-webflow-authentication-mtoken/pom.xml index cd5f8b846..0b0f8be1b 100644 --- a/powerauth-webflow-authentication-mtoken/pom.xml +++ b/powerauth-webflow-authentication-mtoken/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-webflow-authentication-mtoken diff --git a/powerauth-webflow-authentication-operation-review/pom.xml b/powerauth-webflow-authentication-operation-review/pom.xml index b5152a16d..fb8d2cdf2 100644 --- a/powerauth-webflow-authentication-operation-review/pom.xml +++ b/powerauth-webflow-authentication-operation-review/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-webflow-authentication-operation-review diff --git a/powerauth-webflow-authentication-sms/pom.xml b/powerauth-webflow-authentication-sms/pom.xml index 2d1336e71..d51dda749 100644 --- a/powerauth-webflow-authentication-sms/pom.xml +++ b/powerauth-webflow-authentication-sms/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 powerauth-webflow-authentication-sms diff --git a/powerauth-webflow-authentication-sms/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/sms/controller/SmsAuthorizationController.java b/powerauth-webflow-authentication-sms/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/sms/controller/SmsAuthorizationController.java index 6b42c46f6..5012b8c89 100644 --- a/powerauth-webflow-authentication-sms/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/sms/controller/SmsAuthorizationController.java +++ b/powerauth-webflow-authentication-sms/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/sms/controller/SmsAuthorizationController.java @@ -137,7 +137,6 @@ protected AuthResultDetail authenticate(SmsAuthorizationRequest request) throws final String otpId = getOtpIdFromHttpSession(); GetOrganizationDetailResponse organization = nextStepClient.getOrganizationDetail(operation.getOrganizationId()).getResponseObject(); String otpName = organization.getDefaultOtpName(); - String credentialName = organization.getDefaultCredentialName(); if (otpName == null) { logger.warn("Default OTP name is not configured for organization: " + operation.getOrganizationId()); throw new AuthStepException("SMS delivery failed", "error.communication"); @@ -217,7 +216,7 @@ protected AuthResultDetail authenticate(SmsAuthorizationRequest request) throws } String protectedPassword = passwordProtection.protect(request.getPassword()); - CombinedAuthenticationResponse authResponse = nextStepClient.authenticateCombined(credentialName, userId, protectedPassword, otpId, operationId, authCode, true, authMethod).getResponseObject(); + CombinedAuthenticationResponse authResponse = nextStepClient.authenticateCombined(userId, protectedPassword, otpId, operationId, authCode, true, authMethod).getResponseObject(); if (authResponse.isOperationFailed()) { logger.info("Step authentication maximum attempts reached for credential and OTP verification (2FA) due to failed operation, operation ID: {}, authentication method: {}", operation.getOperationId(), authMethod); throw new MaxAttemptsExceededException("Maximum number of authentication attempts exceeded"); diff --git a/powerauth-webflow-authentication/pom.xml b/powerauth-webflow-authentication/pom.xml index b2446702d..063b582f1 100644 --- a/powerauth-webflow-authentication/pom.xml +++ b/powerauth-webflow-authentication/pom.xml @@ -25,7 +25,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 io.getlime.security diff --git a/powerauth-webflow-client/pom.xml b/powerauth-webflow-client/pom.xml index 056546a0c..eb1da0096 100644 --- a/powerauth-webflow-client/pom.xml +++ b/powerauth-webflow-client/pom.xml @@ -30,7 +30,7 @@ powerauth-webflow-parent io.getlime.security - 1.7.0 + 1.8.0 diff --git a/powerauth-webflow-client/src/main/resources/application.properties b/powerauth-webflow-client/src/main/resources/application.properties index 9eb804cbf..69a78c1f3 100644 --- a/powerauth-webflow-client/src/main/resources/application.properties +++ b/powerauth-webflow-client/src/main/resources/application.properties @@ -41,3 +41,6 @@ logging.config=${POWERAUTH_WEBFLOW_CLIENT_LOGGING:} # Monitoring management.tracing.sampling.probability=1.0 + +spring.autoconfigure.exclude=\ + org.springframework.boot.actuate.autoconfigure.metrics.jersey.JerseyServerMetricsAutoConfiguration diff --git a/powerauth-webflow-client/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/powerauth-webflow-client/src/main/webapp/WEB-INF/jboss-deployment-structure.xml index c051d0ad5..4a5b99ae5 100644 --- a/powerauth-webflow-client/src/main/webapp/WEB-INF/jboss-deployment-structure.xml +++ b/powerauth-webflow-client/src/main/webapp/WEB-INF/jboss-deployment-structure.xml @@ -1,5 +1,5 @@ - + @@ -10,11 +10,6 @@ - - - - -