diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/ApplicationController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/ApplicationController.java index a92c02158..df0e86792 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/ApplicationController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/ApplicationController.java @@ -75,7 +75,7 @@ public ApplicationController(ApplicationService applicationService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, APPLICATION_ALREADY_EXISTS"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createApplication(@Valid @RequestBody ObjectRequest request) throws ApplicationAlreadyExistsException { logger.info("Received createApplication request, application name: {}", request.getRequestObject().getApplicationName()); final CreateApplicationResponse response = applicationService.createApplication(request.getRequestObject()); @@ -95,7 +95,7 @@ public ObjectResponse createApplication(@Valid @Reque @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, APPLICATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.PUT) + @PutMapping public ObjectResponse updateApplication(@Valid @RequestBody ObjectRequest request) throws ApplicationNotFoundException { logger.info("Received updateApplication request, application name: {}", request.getRequestObject().getApplicationName()); final UpdateApplicationResponse response = applicationService.updateApplication(request.getRequestObject()); @@ -115,7 +115,7 @@ public ObjectResponse updateApplication(@Valid @Reque @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, APPLICATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "update", method = RequestMethod.POST) + @PostMapping("update") public ObjectResponse updateApplicationPost(@Valid @RequestBody ObjectRequest request) throws ApplicationNotFoundException { logger.info("Received updateApplicationPost request, application name: {}", request.getRequestObject().getApplicationName()); final UpdateApplicationResponse response = applicationService.updateApplication(request.getRequestObject()); @@ -134,7 +134,7 @@ public ObjectResponse updateApplicationPost(@Valid @R @ApiResponse(responseCode = "400", description = "Invalid request"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ObjectResponse getApplicationList(@RequestParam boolean includeRemoved) { logger.info("Received getApplicationList request"); GetApplicationListRequest request = new GetApplicationListRequest(); @@ -155,7 +155,7 @@ public ObjectResponse getApplicationList(@RequestPar @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "list", method = RequestMethod.POST) + @PostMapping("list") public ObjectResponse getApplicationListPost(@Valid @RequestBody ObjectRequest request) { logger.info("Received getApplicationListPost request"); final GetApplicationListResponse response = applicationService.getApplicationList(request.getRequestObject()); @@ -175,7 +175,7 @@ public ObjectResponse getApplicationListPost(@Valid @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, APPLICATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteApplication(@Valid @RequestBody ObjectRequest request) throws ApplicationNotFoundException { logger.info("Received deleteApplication request, application name: {}", request.getRequestObject().getApplicationName()); final DeleteApplicationResponse response = applicationService.deleteApplication(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/AuthMethodController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/AuthMethodController.java index 4a1dd1dae..113e363b3 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/AuthMethodController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/AuthMethodController.java @@ -77,7 +77,7 @@ public AuthMethodController(AuthMethodService authMethodService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, AUTH_METHOD_ALREADY_EXISTS"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "auth-method", method = RequestMethod.POST) + @PostMapping("auth-method") public ObjectResponse createAuthMethod(@Valid @RequestBody ObjectRequest request) throws AuthMethodAlreadyExistsException { logger.info("Received createAuthMethod request, authentication method: {}", request.getRequestObject().getAuthMethod()); final CreateAuthMethodResponse response = authMethodService.createAuthMethod(request.getRequestObject()); @@ -97,7 +97,7 @@ public ObjectResponse createAuthMethod(@Valid @Request @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "auth-method", method = RequestMethod.GET) + @GetMapping("auth-method") public ObjectResponse getAuthMethodList() throws InvalidConfigurationException { logger.info("Received getAuthMethodList request"); final List authMethods = authMethodService.listAuthMethods(); @@ -124,7 +124,7 @@ public ObjectResponse getAuthMethodList() throws Invalid @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "auth-method/list", method = RequestMethod.POST) + @PostMapping("auth-method/list") public ObjectResponse getAuthMethodListPost(@Valid @RequestBody ObjectRequest request) throws InvalidConfigurationException { logger.info("Received getAuthMethodListPost request"); final List authMethods = authMethodService.listAuthMethods(); @@ -151,7 +151,7 @@ public ObjectResponse getAuthMethodListPost(@Valid @Requ @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "user/auth-method", method = RequestMethod.GET) + @GetMapping("user/auth-method") public ObjectResponse getAuthMethodsEnabledForUser(@RequestParam @Nullable @Size(min = 1, max = 256) String userId) throws InvalidConfigurationException { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received getAuthMethodsEnabledForUser request, user ID: {}", userId); @@ -176,7 +176,7 @@ public ObjectResponse getAuthMethodsEnabledForUser(@ @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "user/auth-method/list", method = RequestMethod.POST) + @PostMapping("user/auth-method/list") public ObjectResponse getAuthMethodsEnabledForUserPost(@Valid @RequestBody ObjectRequest request) throws InvalidConfigurationException { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received getAuthMethodsEnabledForUserPost request, user ID: {}", request.getRequestObject().getUserId()); @@ -204,7 +204,7 @@ public ObjectResponse getAuthMethodsEnabledForUserPo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "user/auth-method", method = RequestMethod.POST) + @PostMapping("user/auth-method") public ObjectResponse enableAuthMethodForUser(@Valid @RequestBody ObjectRequest request) throws InvalidRequestException, InvalidConfigurationException { logger.info("Received enableAuthMethodForUser request, user ID: {}, authentication method: {}", request.getRequestObject().getUserId(), request.getRequestObject().getAuthMethod().toString()); final UpdateAuthMethodRequest requestObject = request.getRequestObject(); @@ -241,7 +241,7 @@ public ObjectResponse enableAuthMethodForUser(@Valid @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "user/auth-method/delete", method = RequestMethod.POST) + @PostMapping("user/auth-method/delete") public ObjectResponse disableAuthMethodForUser(@Valid @RequestBody ObjectRequest request) throws InvalidRequestException, InvalidConfigurationException { return disableAuthMethodForUserImpl(request); } @@ -281,7 +281,7 @@ private ObjectResponse disableAuthMethodForUserImpl( @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "user/auth-method/enabled", method = RequestMethod.GET) + @GetMapping("user/auth-method/enabled") public ObjectResponse getEnabledMethodList(@RequestParam @NotBlank @Size(min = 1, max = 256) String userId, @RequestParam @NotBlank @Size(min = 2, max = 256) String operationName) throws InvalidConfigurationException { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received getEnabledMethodList request, user ID: {}", userId); @@ -305,7 +305,7 @@ public ObjectResponse getEnabledMethodList(@Reques @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "user/auth-method/enabled/list", method = RequestMethod.POST) + @PostMapping("user/auth-method/enabled/list") public ObjectResponse getEnabledMethodListPost(@Valid @RequestBody ObjectRequest request) throws InvalidConfigurationException { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received getEnabledMethodListPost request, user ID: {}", request.getRequestObject().getUserId()); @@ -327,7 +327,7 @@ public ObjectResponse getEnabledMethodListPost(@Va @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, AUTH_METHOD_NOT_FOUND, DELETE_NOT_ALLOWED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "auth-method/delete", method = RequestMethod.POST) + @PostMapping("auth-method/delete") public ObjectResponse deleteAuthMethod(@Valid @RequestBody ObjectRequest request) throws AuthMethodNotFoundException, DeleteNotAllowedException { logger.info("Received deleteAuthMethod request, authentication method: {}", request.getRequestObject().getAuthMethod()); final DeleteAuthMethodResponse response = authMethodService.deleteAuthMethod(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/AuthenticationController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/AuthenticationController.java index a702ba54a..b22146c78 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/AuthenticationController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/AuthenticationController.java @@ -36,9 +36,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; /** @@ -87,7 +87,7 @@ public AuthenticationController(AuthenticationService authenticationService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, USER_IDENTITY_NOT_FOUND, OPERATION_NOT_FOUND, CREDENTIAL_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, INVALID_CONFIGURATION, OPERATION_ALREADY_FINISHED, OPERATION_ALREADY_CANCELED, OPERATION_ALREADY_FAILED, OPERATION_NOT_VALID, AUTH_METHOD_NOT_FOUND, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "credential", method = RequestMethod.POST) + @PostMapping("credential") public ObjectResponse authenticateWithCredential(@Valid @RequestBody ObjectRequest request) throws InvalidRequestException, UserNotFoundException, OperationNotFoundException, CredentialNotFoundException, CredentialDefinitionNotFoundException, InvalidConfigurationException, OperationAlreadyFinishedException, OperationAlreadyCanceledException, OperationAlreadyFailedException, OperationNotValidException, AuthMethodNotFoundException, EncryptionException { logger.info("Received authenticateWithCredential request, user ID: {}, operation ID: {}", request.getRequestObject().getUserId(), request.getRequestObject().getOperationId()); final CredentialAuthenticationResponse response = authenticationService.authenticateWithCredential(request.getRequestObject()); @@ -117,7 +117,7 @@ public ObjectResponse authenticateWithCredenti @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, AUTH_METHOD_NOT_FOUND, OPERATION_ALREADY_FAILED, OPERATION_ALREADY_FINISHED, OPERATION_ALREADY_CANCELED, INVALID_CONFIGURATION, CREDENTIAL_NOT_FOUND, OPERATION_NOT_FOUND, OTP_NOT_FOUND, OPERATION_NOT_VALID, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "otp", method = RequestMethod.POST) + @PostMapping("otp") public ObjectResponse authenticateWithOtp(@Valid @RequestBody ObjectRequest request) throws InvalidRequestException, AuthMethodNotFoundException, OperationAlreadyFailedException, OperationAlreadyFinishedException, OperationAlreadyCanceledException, InvalidConfigurationException, CredentialNotFoundException, OperationNotFoundException, OtpNotFoundException, OperationNotValidException, EncryptionException { logger.info("Received authenticateWithOtp request, OTP ID: {}, operation ID: {}", request.getRequestObject().getOtpId(), request.getRequestObject().getOperationId()); final OtpAuthenticationResponse response = authenticationService.authenticateWithOtp(request.getRequestObject()); @@ -148,7 +148,7 @@ public ObjectResponse authenticateWithOtp(@Valid @Req @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, AUTH_METHOD_NOT_FOUND, INVALID_CONFIGURATION, USER_IDENTITY_NOT_FOUND, OPERATION_ALREADY_FINISHED, OPERATION_ALREADY_CANCELED, OPERATION_ALREADY_FAILED, CREDENTIAL_NOT_FOUND, OPERATION_NOT_FOUND, OTP_NOT_FOUND, OPERATION_NOT_VALID, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "combined", method = RequestMethod.POST) + @PostMapping("combined") public ObjectResponse authenticateCombined(@Valid @RequestBody ObjectRequest request) throws InvalidRequestException, AuthMethodNotFoundException, InvalidConfigurationException, UserNotFoundException, OperationAlreadyFinishedException, OperationAlreadyCanceledException, OperationAlreadyFailedException, CredentialNotFoundException, OperationNotFoundException, OtpNotFoundException, OperationNotValidException, EncryptionException { logger.info("Received authenticateCombined request, user ID: {}, OTP ID: {}, operation ID: {}", request.getRequestObject().getUserId(), request.getRequestObject().getOperationId(), request.getRequestObject().getOtpId()); final CombinedAuthenticationResponse response = authenticationService.authenticateCombined(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialController.java index 3f8aeb801..e306c1e74 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialController.java @@ -32,10 +32,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * REST controller for credential management. @@ -77,7 +74,7 @@ public CredentialController(CredentialService credentialService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, INVALID_CONFIGURATION, INVALID_REQUEST, CREDENTIAL_VALIDATION_FAILED, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createCredential(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, CredentialDefinitionNotFoundException, InvalidConfigurationException, InvalidRequestException, CredentialValidationFailedException, EncryptionException { logger.info("Received createCredential request, user ID: {}, credential name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getCredentialName()); final CreateCredentialResponse response = credentialService.createCredential(request.getRequestObject()); @@ -103,7 +100,7 @@ public ObjectResponse createCredential(@Valid @Request @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, CREDENTIAL_NOT_FOUND, INVALID_REQUEST, CREDENTIAL_VALIDATION_FAILED, INVALID_CONFIGURATION, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.PUT) + @PutMapping public ObjectResponse updateCredential(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, CredentialDefinitionNotFoundException, CredentialNotFoundException, InvalidRequestException, CredentialValidationFailedException, InvalidConfigurationException, EncryptionException { logger.info("Received updateCredential request, user ID: {}, credential name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getCredentialName()); final UpdateCredentialResponse response = credentialService.updateCredential(request.getRequestObject()); @@ -129,7 +126,7 @@ public ObjectResponse updateCredential(@Valid @Request @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, CREDENTIAL_NOT_FOUND, INVALID_REQUEST, CREDENTIAL_VALIDATION_FAILED, INVALID_CONFIGURATION, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "update", method = RequestMethod.POST) + @PostMapping("update") public ObjectResponse updateCredentialPost(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, CredentialDefinitionNotFoundException, CredentialNotFoundException, InvalidRequestException, CredentialValidationFailedException, InvalidConfigurationException, EncryptionException { logger.info("Received updateCredentialPost request, user ID: {}, credential name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getCredentialName()); final UpdateCredentialResponse response = credentialService.updateCredential(request.getRequestObject()); @@ -152,7 +149,7 @@ public ObjectResponse updateCredentialPost(@Valid @Req @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, CREDENTIAL_DEFINITION_NOT_FOUND, INVALID_REQUEST, USER_IDENTITY_NOT_FOUND, INVALID_CONFIGURATION, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "validate", method = RequestMethod.POST) + @PostMapping("validate") public ObjectResponse validateCredential(@Valid @RequestBody ObjectRequest request) throws CredentialDefinitionNotFoundException, InvalidRequestException, UserNotFoundException, InvalidConfigurationException, EncryptionException { logger.info("Received validateCredential request, user ID: {}, credential name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getCredentialName()); final ValidateCredentialResponse response = credentialService.validateCredential(request.getRequestObject()); @@ -176,7 +173,7 @@ public ObjectResponse validateCredential(@Valid @Req @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, CREDENTIAL_NOT_FOUND, INVALID_CONFIGURATION, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "reset", method = RequestMethod.POST) + @PostMapping("reset") public ObjectResponse resetCredential(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, CredentialDefinitionNotFoundException, CredentialNotFoundException, InvalidConfigurationException, EncryptionException { logger.info("Received resetCredential request, user ID: {}, credential name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getCredentialName()); final ResetCredentialResponse response = credentialService.resetCredential(request.getRequestObject()); @@ -198,7 +195,7 @@ public ObjectResponse resetCredential(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, CREDENTIAL_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteCredential(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, CredentialDefinitionNotFoundException, CredentialNotFoundException { logger.info("Received deleteCredential request, user ID: {}, credential name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getCredentialName()); final DeleteCredentialResponse response = credentialService.deleteCredential(request.getRequestObject()); @@ -221,7 +218,7 @@ public ObjectResponse deleteCredential(@Valid @Request @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, CREDENTIAL_NOT_FOUND, CREDENTIAL_NOT_ACTIVE"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "block", method = RequestMethod.POST) + @PostMapping("block") public ObjectResponse blockCredential(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, CredentialDefinitionNotFoundException, CredentialNotFoundException, CredentialNotActiveException { logger.info("Received blockCredential request, user ID: {}, credential name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getCredentialName()); final BlockCredentialResponse response = credentialService.blockCredential(request.getRequestObject()); @@ -244,7 +241,7 @@ public ObjectResponse blockCredential(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, CREDENTIAL_NOT_FOUND, CREDENTIAL_NOT_BLOCKED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "unblock", method = RequestMethod.POST) + @PostMapping("unblock") public ObjectResponse unblockCredential(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, CredentialDefinitionNotFoundException, CredentialNotFoundException, CredentialNotBlockedException { logger.info("Received unblockCredential request, user ID: {}, credential name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getCredentialName()); final UnblockCredentialResponse response = credentialService.unblockCredential(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialCounterController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialCounterController.java index 31cbdc948..8c7827037 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialCounterController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialCounterController.java @@ -34,10 +34,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * REST controller for counter management. @@ -78,7 +75,7 @@ public CredentialCounterController(CredentialCounterService credentialCounterSer @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, INVALID_REQUEST, CREDENTIAL_NOT_FOUND, CREDENTIAL_NOT_ACTIVE"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.PUT) + @PutMapping public ObjectResponse updateCredentialCounter(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, CredentialDefinitionNotFoundException, InvalidRequestException, CredentialNotFoundException, CredentialNotActiveException { logger.info("Received updateCredentialCounter request, user ID: {}, credential name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getCredentialName()); final UpdateCounterResponse response = credentialCounterService.updateCredentialCounter(request.getRequestObject()); @@ -102,7 +99,7 @@ public ObjectResponse updateCredentialCounter(@Valid @Req @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, INVALID_REQUEST, CREDENTIAL_NOT_FOUND, CREDENTIAL_NOT_ACTIVE"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "update", method = RequestMethod.POST) + @PostMapping("update") public ObjectResponse updateCredentialCounterPost(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, CredentialDefinitionNotFoundException, InvalidRequestException, CredentialNotFoundException, CredentialNotActiveException { logger.info("Received updateCredentialCounterPost request, user ID: {}, credential name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getCredentialName()); final UpdateCounterResponse response = credentialCounterService.updateCredentialCounter(request.getRequestObject()); @@ -122,7 +119,7 @@ public ObjectResponse updateCredentialCounterPost(@Valid @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "reset-all", method = RequestMethod.POST) + @PostMapping("reset-all") public ObjectResponse resetAllCounters(@Valid @RequestBody ObjectRequest request) throws InvalidRequestException { logger.info("Received resetAllCounters request"); final ResetCountersResponse response = credentialCounterService.resetCounters(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialDefinitionController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialDefinitionController.java index 126d4875a..613fab657 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialDefinitionController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialDefinitionController.java @@ -79,7 +79,7 @@ public CredentialDefinitionController(CredentialDefinitionService credentialDefi @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, CREDENTIAL_DEFINITION_ALREADY_EXISTS, APPLICATION_NOT_FOUND, HASHING_CONFIG_NOT_FOUND, CREDENTIAL_POLICY_NOT_FOUND, ORGANIZATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createCredentialDefinition(@Valid @RequestBody ObjectRequest request) throws CredentialDefinitionAlreadyExistsException, ApplicationNotFoundException, HashConfigNotFoundException, CredentialPolicyNotFoundException, OrganizationNotFoundException { logger.info("Received createCredentialDefinition request, credential definition name: {}", request.getRequestObject().getCredentialDefinitionName()); final CreateCredentialDefinitionResponse response = credentialDefinitionService.createCredentialDefinition(request.getRequestObject()); @@ -103,7 +103,7 @@ public ObjectResponse createCredentialDefini @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, CREDENTIAL_DEFINITION_NOT_FOUND, APPLICATION_NOT_FOUND, HASHING_CONFIG_NOT_FOUND, CREDENTIAL_POLICY_NOT_FOUND, ORGANIZATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.PUT) + @PutMapping public ObjectResponse updateCredentialDefinition(@Valid @RequestBody ObjectRequest request) throws CredentialDefinitionNotFoundException, ApplicationNotFoundException, HashConfigNotFoundException, CredentialPolicyNotFoundException, OrganizationNotFoundException { logger.info("Received updateCredentialDefinition request, credential definition name: {}", request.getRequestObject().getCredentialDefinitionName()); final UpdateCredentialDefinitionResponse response = credentialDefinitionService.updateCredentialDefinition(request.getRequestObject()); @@ -127,7 +127,7 @@ public ObjectResponse updateCredentialDefini @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, CREDENTIAL_DEFINITION_NOT_FOUND, APPLICATION_NOT_FOUND, HASHING_CONFIG_NOT_FOUND, CREDENTIAL_POLICY_NOT_FOUND, ORGANIZATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "update", method = RequestMethod.POST) + @PostMapping("update") public ObjectResponse updateCredentialDefinitionPost(@Valid @RequestBody ObjectRequest request) throws CredentialDefinitionNotFoundException, ApplicationNotFoundException, HashConfigNotFoundException, CredentialPolicyNotFoundException, OrganizationNotFoundException { logger.info("Received updateCredentialDefinitionPost request, credential definition name: {}", request.getRequestObject().getCredentialDefinitionName()); final UpdateCredentialDefinitionResponse response = credentialDefinitionService.updateCredentialDefinition(request.getRequestObject()); @@ -146,7 +146,7 @@ public ObjectResponse updateCredentialDefini @ApiResponse(responseCode = "400", description = "Invalid request"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ObjectResponse getCredentialDefinitionList(@RequestParam boolean includeRemoved) { GetCredentialDefinitionListRequest request = new GetCredentialDefinitionListRequest(); request.setIncludeRemoved(includeRemoved); @@ -167,7 +167,7 @@ public ObjectResponse getCredentialDefiniti @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "list", method = RequestMethod.POST) + @PostMapping("list") public ObjectResponse getCredentialDefinitionListPost(@Valid @RequestBody ObjectRequest request) { logger.info("Received getCredentialDefinitionListPost request"); final GetCredentialDefinitionListResponse response = credentialDefinitionService.getCredentialDefinitionList(request.getRequestObject()); @@ -187,7 +187,7 @@ public ObjectResponse getCredentialDefiniti @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, CREDENTIAL_DEFINITION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteCredentialDefinition(@Valid @RequestBody ObjectRequest request) throws CredentialDefinitionNotFoundException { logger.info("Received deleteCredentialDefinition request, credential definition name: {}", request.getRequestObject().getCredentialDefinitionName()); final DeleteCredentialDefinitionResponse response = credentialDefinitionService.deleteCredentialDefinition(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialPolicyController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialPolicyController.java index 8d0c71dbd..492394d8a 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialPolicyController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/CredentialPolicyController.java @@ -79,7 +79,7 @@ public CredentialPolicyController(CredentialPolicyService credentialPolicyServic @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, CREDENTIAL_POLICY_ALREADY_EXISTS"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createCredentialPolicy(@Valid @RequestBody ObjectRequest request) throws CredentialPolicyAlreadyExistsException, InvalidRequestException { logger.info("Received createCredentialPolicy request, credential policy name: {}", request.getRequestObject().getCredentialPolicyName()); final CreateCredentialPolicyResponse response = credentialPolicyService.createCredentialPolicy(request.getRequestObject()); @@ -100,7 +100,7 @@ public ObjectResponse createCredentialPolicy(@Va @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, CREDENTIAL_POLICY_NOT_FOUND, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.PUT) + @PutMapping public ObjectResponse updateCredentialPolicy(@Valid @RequestBody ObjectRequest request) throws CredentialPolicyNotFoundException, InvalidRequestException { logger.info("Received updateCredentialPolicy request, credential policy name: {}", request.getRequestObject().getCredentialPolicyName()); final UpdateCredentialPolicyResponse response = credentialPolicyService.updateCredentialPolicy(request.getRequestObject()); @@ -121,7 +121,7 @@ public ObjectResponse updateCredentialPolicy(@Va @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, CREDENTIAL_POLICY_NOT_FOUND, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "update", method = RequestMethod.POST) + @PostMapping("update") public ObjectResponse updateCredentialPolicyPost(@Valid @RequestBody ObjectRequest request) throws CredentialPolicyNotFoundException, InvalidRequestException { logger.info("Received updateCredentialPolicyPost request, credential policy name: {}", request.getRequestObject().getCredentialPolicyName()); final UpdateCredentialPolicyResponse response = credentialPolicyService.updateCredentialPolicy(request.getRequestObject()); @@ -141,7 +141,7 @@ public ObjectResponse updateCredentialPolicyPost @ApiResponse(responseCode = "400", description = "Invalid request, error codes: INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ObjectResponse getCredentialPolicyList(@RequestParam boolean includeRemoved) throws InvalidConfigurationException { logger.info("Received getCredentialPolicyList request"); GetCredentialPolicyListRequest request = new GetCredentialPolicyListRequest(); @@ -163,7 +163,7 @@ public ObjectResponse getCredentialPolicyList(@ @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "list", method = RequestMethod.POST) + @PostMapping("list") public ObjectResponse getCredentialPolicyListPost(@Valid @RequestBody ObjectRequest request) throws InvalidConfigurationException { logger.info("Received getCredentialPolicyListPost request"); final GetCredentialPolicyListResponse response = credentialPolicyService.getCredentialPolicyList(request.getRequestObject()); @@ -183,7 +183,7 @@ public ObjectResponse getCredentialPolicyListPo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, CREDENTIAL_POLICY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteCredentialPolicy(@Valid @RequestBody ObjectRequest request) throws CredentialPolicyNotFoundException { logger.info("Received deleteCredentialPolicy request, credential policy name: {}", request.getRequestObject().getCredentialPolicyName()); final DeleteCredentialPolicyResponse response = credentialPolicyService.deleteCredentialPolicy(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/HashConfigController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/HashConfigController.java index a31e991cc..ace379f9b 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/HashConfigController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/HashConfigController.java @@ -79,7 +79,7 @@ public HashConfigController(HashConfigService hashConfigService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, HASHING_CONFIG_ALREADY_EXISTS"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createHashConfig(@Valid @RequestBody ObjectRequest request) throws InvalidRequestException, HashConfigAlreadyExistsException { logger.info("Received createHashConfig request, hash config name: {}", request.getRequestObject().getHashConfigName()); final CreateHashConfigResponse response = hashConfigService.createHashConfig(request.getRequestObject()); @@ -100,7 +100,7 @@ public ObjectResponse createHashConfig(@Valid @Request @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, HASHING_CONFIG_NOT_FOUND, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.PUT) + @PutMapping public ObjectResponse updateHashConfig(@Valid @RequestBody ObjectRequest request) throws HashConfigNotFoundException, InvalidRequestException { logger.info("Received updateHashConfig request, hash config name: {}", request.getRequestObject().getHashConfigName()); final UpdateHashConfigResponse response = hashConfigService.updateHashConfig(request.getRequestObject()); @@ -121,7 +121,7 @@ public ObjectResponse updateHashConfig(@Valid @Request @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, HASHING_CONFIG_NOT_FOUND, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "update", method = RequestMethod.POST) + @PostMapping("update") public ObjectResponse updateHashConfigPost(@Valid @RequestBody ObjectRequest request) throws HashConfigNotFoundException, InvalidRequestException { logger.info("Received updateHashConfigPost request, hash config name: {}", request.getRequestObject().getHashConfigName()); final UpdateHashConfigResponse response = hashConfigService.updateHashConfig(request.getRequestObject()); @@ -141,7 +141,7 @@ public ObjectResponse updateHashConfigPost(@Valid @Req @ApiResponse(responseCode = "400", description = "Invalid request, error codes: INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ObjectResponse getHashConfigList(@RequestParam boolean includeRemoved) throws InvalidConfigurationException { logger.info("Received getHashConfigListPost request"); GetHashConfigListRequest request = new GetHashConfigListRequest(); @@ -163,7 +163,7 @@ public ObjectResponse getHashConfigList(@RequestParam @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "list", method = RequestMethod.POST) + @PostMapping("list") public ObjectResponse getHashConfigListPost(@Valid @RequestBody ObjectRequest request) throws InvalidConfigurationException { logger.info("Received getHashConfigListPost request"); final GetHashConfigListResponse response = hashConfigService.getHashConfigList(request.getRequestObject()); @@ -183,7 +183,7 @@ public ObjectResponse getHashConfigListPost(@Valid @R @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, HASHING_CONFIG_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteHashConfig(@Valid @RequestBody ObjectRequest request) throws HashConfigNotFoundException { logger.info("Received deleteHashConfig request, hash config name: {}", request.getRequestObject().getHashConfigName()); final DeleteHashConfigResponse response = hashConfigService.deleteHashConfig(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OperationController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OperationController.java index 60ded508d..f651ea03a 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OperationController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OperationController.java @@ -99,7 +99,7 @@ public OperationController(OperationPersistenceService operationPersistenceServi @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_ALREADY_EXISTS, INVALID_CONFIGURATION, ORGANIZATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation", method = RequestMethod.POST) + @PostMapping("operation") public ObjectResponse createOperation(@Valid @RequestBody ObjectRequest request) throws OperationAlreadyExistsException, InvalidConfigurationException, OrganizationNotFoundException { logger.info("Received createOperation request, operation ID: {}, operation name: {}", request.getRequestObject().getOperationId(), request.getRequestObject().getOperationName()); // resolve response based on dynamic step definitions @@ -136,7 +136,7 @@ public ObjectResponse createOperation(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, AUTH_METHOD_NOT_FOUND, OPERATION_ALREADY_FINISHED, OPERATION_ALREADY_FAILED, OPERATION_ALREADY_CANCELED, OPERATION_NOT_VALID, OPERATION_NOT_FOUND, INVALID_CONFIGURATION, ORGANIZATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation", method = RequestMethod.PUT) + @PutMapping("operation") public ObjectResponse updateOperation(@Valid @RequestBody ObjectRequest request) throws InvalidRequestException, AuthMethodNotFoundException, OperationAlreadyFinishedException, OperationAlreadyFailedException, OperationAlreadyCanceledException, OperationNotValidException, OperationNotFoundException, InvalidConfigurationException, OrganizationNotFoundException { return updateOperationImpl(request); } @@ -162,7 +162,7 @@ public ObjectResponse updateOperation(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, AUTH_METHOD_NOT_FOUND, OPERATION_ALREADY_FINISHED, OPERATION_ALREADY_FAILED, OPERATION_ALREADY_CANCELED, OPERATION_NOT_VALID, OPERATION_NOT_FOUND, INVALID_CONFIGURATION, ORGANIZATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/update", method = RequestMethod.POST) + @PostMapping("operation/update") public ObjectResponse updateOperationPost(@Valid @RequestBody ObjectRequest request) throws InvalidRequestException, AuthMethodNotFoundException, OperationAlreadyFinishedException, OperationAlreadyFailedException, OperationNotValidException, OperationNotFoundException, InvalidConfigurationException, OperationAlreadyCanceledException, OrganizationNotFoundException { return updateOperationImpl(request); } @@ -193,7 +193,7 @@ private ObjectResponse updateOperationImpl(ObjectReques @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_NOT_FOUND, ORGANIZATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/user", method = RequestMethod.PUT) + @PutMapping("operation/user") public Response updateOperationUser(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException, OrganizationNotFoundException { return updateOperationUserImpl(request); } @@ -212,7 +212,7 @@ public Response updateOperationUser(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException, OrganizationNotFoundException { return updateOperationUserImpl(request); } @@ -245,7 +245,7 @@ private Response updateOperationUserImpl(ObjectRequest operationDetail(@RequestParam @NotBlank @Size(min = 1, max = 256) String operationId) throws OperationNotFoundException, OperationNotValidException { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received operationDetail request, operation ID: {}", operationId); @@ -280,7 +280,7 @@ public ObjectResponse operationDetail(@RequestParam @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_NOT_FOUND, OPERATION_NOT_VALID"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/detail", method = RequestMethod.POST) + @PostMapping("operation/detail") public ObjectResponse operationDetailPost(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException, OperationNotValidException { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received operationDetail request, operation ID: {}", request.getRequestObject().getOperationId()); @@ -316,7 +316,7 @@ public ObjectResponse operationDetailPost(@Valid @Re @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_CONFIG_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/config/detail", method = RequestMethod.GET) + @GetMapping("operation/config/detail") public ObjectResponse getOperationConfigDetail(@RequestParam @NotBlank @Size(min = 2, max = 256) String operationName) throws OperationConfigNotFoundException { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received getOperationConfigDetail request, operation name: {}", operationName); @@ -340,7 +340,7 @@ public ObjectResponse getOperationConfigDetail @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_CONFIG_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/config/detail", method = RequestMethod.POST) + @PostMapping("operation/config/detail") public ObjectResponse getOperationConfigDetailPost(@Valid @RequestBody ObjectRequest request) throws OperationConfigNotFoundException { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received getOperationConfigDetail request, operation name: {}", request.getRequestObject().getOperationName()); @@ -364,7 +364,7 @@ public ObjectResponse getOperationConfigDetail @ApiResponse(responseCode = "400", description = "Invalid request"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/config", method = RequestMethod.GET) + @GetMapping("operation/config") public ObjectResponse getOperationConfigList() { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received getOperationConfigList request"); @@ -387,7 +387,7 @@ public ObjectResponse getOperationConfigList() { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/config/list", method = RequestMethod.POST) + @PostMapping("operation/config/list") public ObjectResponse getOperationConfigListPost(@Valid @RequestBody ObjectRequest request) { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received getOperationConfigListPost request"); @@ -411,7 +411,7 @@ public ObjectResponse getOperationConfigListPost @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "user/operation", method = RequestMethod.GET) + @GetMapping("user/operation") public ObjectResponse> getPendingOperations(@RequestParam @NotBlank @Size(min = 1, max = 256) String userId, @RequestParam boolean mobileTokenOnly) { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received getPendingOperations request, user ID: {}", userId); @@ -440,7 +440,7 @@ public ObjectResponse> getPendingOperations(@Re @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "user/operation/list", method = RequestMethod.POST) + @PostMapping("user/operation/list") public ObjectResponse> getPendingOperationsPost(@Valid @RequestBody ObjectRequest request) { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received getPendingOperationsPost request, user ID: {}", request.getRequestObject().getUserId()); @@ -471,7 +471,7 @@ public ObjectResponse> getPendingOperationsPost @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/lookup/external", method = RequestMethod.POST) + @PostMapping("operation/lookup/external") public ObjectResponse lookupOperationsByExternalId(@Valid @RequestBody ObjectRequest request) { // Log level is FINE to avoid flooding logs, this endpoint is used all the time. logger.debug("Received lookupOperationsByExternalId request, external transaction ID: {}", request.getRequestObject().getExternalTransactionId()); @@ -502,7 +502,7 @@ public ObjectResponse lookupOperationsByEx @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/formData", method = RequestMethod.PUT) + @PutMapping("operation/formData") public Response updateOperationFormData(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException { return updateOperationFormDataImpl(request); } @@ -520,7 +520,7 @@ public Response updateOperationFormData(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException { return updateOperationFormDataImpl(request); } @@ -547,7 +547,7 @@ private Response updateOperationFormDataImpl(ObjectRequest request) throws OperationNotFoundException, InvalidRequestException, OperationNotValidException { return updateChosenAuthMethodImpl(request); } @@ -566,7 +566,7 @@ public Response updateChosenAuthMethod(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException, InvalidRequestException, OperationNotValidException { return updateChosenAuthMethodImpl(request); } @@ -593,7 +593,7 @@ private Response updateChosenAuthMethodImpl(ObjectRequest request) throws OperationNotFoundException, OperationNotValidException, InvalidConfigurationException { return updateMobileTokenImpl(request); } @@ -612,7 +612,7 @@ public Response updateMobileToken(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException, OperationNotValidException, InvalidConfigurationException { return updateMobileTokenImpl(request); } @@ -639,7 +639,7 @@ private Response updateMobileTokenImpl(ObjectRequest r @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/mobileToken/config/detail", method = RequestMethod.GET) + @GetMapping("operation/mobileToken/config/detail") public ObjectResponse getMobileTokenConfig(@RequestParam @NotBlank @Size(min = 1, max = 256) String userId, @RequestParam @NotBlank @Size(min = 2, max = 256) String operationName, @RequestParam @NotNull AuthMethod authMethod) throws InvalidConfigurationException { logger.info("Received getMobileTokenConfig request, user ID: {}, operation name: {}, authentication method: {}", userId, operationName, authMethod); final boolean isMobileTokenEnabled = mobileTokenConfigurationService.isMobileTokenActive(userId, operationName, authMethod); @@ -661,7 +661,7 @@ public ObjectResponse getMobileTokenConfig(@Reques @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/mobileToken/config/detail", method = RequestMethod.POST) + @PostMapping("operation/mobileToken/config/detail") public ObjectResponse getMobileTokenConfigPost(@Valid @RequestBody ObjectRequest request) throws InvalidConfigurationException { final String userId = request.getRequestObject().getUserId(); final String operationName = request.getRequestObject().getOperationName(); @@ -686,7 +686,7 @@ public ObjectResponse getMobileTokenConfigPost(@Va @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/application", method = RequestMethod.PUT) + @PutMapping("operation/application") public Response updateApplicationContext(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException { return updateApplicationContextImpl(request); } @@ -703,7 +703,7 @@ public Response updateApplicationContext(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException { return updateApplicationContextImpl(request); } @@ -719,7 +719,7 @@ public Response updateApplicationContextPost(@Valid @RequestBody ObjectRequest request) { final CreateAfsActionRequest afsRequest = request.getRequestObject(); logger.info("Received createAfsAction request, operation ID: {}, AFS action: {}", afsRequest.getOperationId(), afsRequest.getAfsAction()); @@ -750,7 +750,7 @@ private Response updateApplicationContextImpl(ObjectRequest createOperationConfig(@Valid @RequestBody ObjectRequest request) throws OperationConfigAlreadyExists { logger.info("Received createOperationConfig request, operation name: {}", request.getRequestObject().getOperationName()); final CreateOperationConfigResponse response = operationConfigurationService.createOperationConfig(request.getRequestObject()); @@ -771,7 +771,7 @@ public ObjectResponse createOperationConfig(@Vali @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_CONFIG_NOT_FOUND, DELETE_NOT_ALLOWED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/config/delete", method = RequestMethod.POST) + @PostMapping("operation/config/delete") public ObjectResponse deleteOperationConfig(@Valid @RequestBody ObjectRequest request) throws OperationConfigNotFoundException, DeleteNotAllowedException { logger.info("Received deleteOperationConfig request, operation name: {}", request.getRequestObject().getOperationName()); final DeleteOperationConfigResponse response = operationConfigurationService.deleteOperationConfig(request.getRequestObject()); @@ -793,7 +793,7 @@ public ObjectResponse deleteOperationConfig(@Vali @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_METHOD_CONFIG_ALREADY_EXISTS, OPERATION_CONFIG_NOT_FOUND, AUTH_METHOD_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/auth-method/config", method = RequestMethod.POST) + @PostMapping("operation/auth-method/config") public ObjectResponse createOperationMethodConfig(@Valid @RequestBody ObjectRequest request) throws OperationMethodConfigAlreadyExists, OperationConfigNotFoundException, AuthMethodNotFoundException { logger.info("Received createOperationMethodConfig request, operation name: {}, authentication method: {}", request.getRequestObject().getOperationName(), request.getRequestObject().getAuthMethod()); final CreateOperationMethodConfigResponse response = operationConfigurationService.createOperationMethodConfig(request.getRequestObject()); @@ -814,7 +814,7 @@ public ObjectResponse createOperationMethod @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_METHOD_CONFIG_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/auth-method/config/detail", method = RequestMethod.GET) + @GetMapping("operation/auth-method/config/detail") public ObjectResponse getOperationMethodConfigDetail(@RequestParam @NotBlank @Size(min = 2, max = 256) String operationName, @RequestParam @NotNull AuthMethod authMethod) throws OperationMethodConfigNotFoundException { logger.info("Received getOperationMethodConfigDetail request, operation name: {}, authentication method: {}", operationName, authMethod); GetOperationMethodConfigDetailRequest request = new GetOperationMethodConfigDetailRequest(); @@ -837,7 +837,7 @@ public ObjectResponse getOperationMethod @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_METHOD_CONFIG_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/auth-method/config/detail", method = RequestMethod.POST) + @PostMapping("operation/auth-method/config/detail") public ObjectResponse getOperationMethodConfigDetailPost(@Valid @RequestBody ObjectRequest request) throws OperationMethodConfigNotFoundException { logger.info("Received getOperationMethodConfigDetailPost request, operation name: {}, authentication method: {}", request.getRequestObject().getOperationName(), request.getRequestObject().getAuthMethod()); final GetOperationMethodConfigDetailResponse response = operationConfigurationService.getOperationMethodConfigDetail(request.getRequestObject()); @@ -857,7 +857,7 @@ public ObjectResponse getOperationMethod @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_METHOD_CONFIG_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "operation/auth-method/config/delete", method = RequestMethod.POST) + @PostMapping("operation/auth-method/config/delete") public ObjectResponse deleteOperationMethodConfig(@Valid @RequestBody ObjectRequest request) throws OperationMethodConfigNotFoundException { logger.info("Received deleteOperationMethodConfig request, operation name: {}, authentication method: {}", request.getRequestObject().getOperationName(), request.getRequestObject().getAuthMethod()); final DeleteOperationMethodConfigResponse response = operationConfigurationService.deleteOperationMethodConfig(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OrganizationController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OrganizationController.java index e7c96c39a..2e8c4ff39 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OrganizationController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OrganizationController.java @@ -78,7 +78,7 @@ public OrganizationController(OrganizationService organizationService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, ORGANIZATION_ALREADY_EXISTS"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createOrganization(@Valid @RequestBody ObjectRequest request) throws OrganizationAlreadyExistsException { logger.info("Received createOrganization request, organization ID: {}", request.getRequestObject().getOrganizationId()); final CreateOrganizationResponse response = organizationService.createOrganization(request.getRequestObject()); @@ -99,7 +99,7 @@ public ObjectResponse createOrganization(@Valid @Req @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, ORGANIZATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "detail", method = RequestMethod.GET) + @GetMapping("detail") public ObjectResponse getOrganizationDetail(@RequestParam @NotBlank @Size(min = 2, max = 256) String organizationId) throws OrganizationNotFoundException { logger.info("Received getOrganizationDetail request, organization ID: {}", organizationId); GetOrganizationDetailRequest request = new GetOrganizationDetailRequest(); @@ -122,7 +122,7 @@ public ObjectResponse getOrganizationDetail(@Requ @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, ORGANIZATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "detail", method = RequestMethod.POST) + @PostMapping("detail") public ObjectResponse getOrganizationDetailPost(@Valid @RequestBody ObjectRequest request) throws OrganizationNotFoundException { logger.info("Received getOrganizationDetailPost request, organization ID: {}", request.getRequestObject().getOrganizationId()); final GetOrganizationDetailResponse response = organizationService.getOrganizationDetail(request.getRequestObject()); @@ -141,7 +141,7 @@ public ObjectResponse getOrganizationDetailPost(@ @ApiResponse(responseCode = "400", description = "Invalid request"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ObjectResponse getOrganizationList() { logger.info("Received getOrganizationList request"); final GetOrganizationListResponse response = organizationService.getOrganizationList(); @@ -161,7 +161,7 @@ public ObjectResponse getOrganizationList() { @ApiResponse(responseCode = "400", description = "Invalid request"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "list", method = RequestMethod.POST) + @PostMapping("list") public ObjectResponse getOrganizationListPost(@Valid @RequestBody ObjectRequest request) { logger.info("Received getOrganizationList request"); final GetOrganizationListResponse response = organizationService.getOrganizationList(); @@ -181,7 +181,7 @@ public ObjectResponse getOrganizationListPost(@Vali @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, ORGANIZATION_NOT_FOUND, DELETE_NOT_ALLOWED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteOrganization(@Valid @RequestBody ObjectRequest request) throws OrganizationNotFoundException { logger.info("Received deleteOrganization request, organization ID: {}", request.getRequestObject().getOrganizationId()); final DeleteOrganizationResponse response = organizationService.deleteOrganization(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpController.java index 945d6bf5a..654f8c2ae 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpController.java @@ -84,7 +84,7 @@ public OtpController(OtpService otpService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OTP_DEFINITION_NOT_FOUND, CREDENTIAL_DEFINITION_NOT_FOUND, OPERATION_NOT_FOUND, INVALID_REQUEST, OTP_GEN_ALGORITHM_NOT_SUPPORTED, INVALID_CONFIGURATION, OPERATION_ALREADY_FINISHED, OPERATION_ALREADY_FAILED, USER_IDENTITY_NOT_ACTIVE, CREDENTIAL_NOT_ACTIVE, CREDENTIAL_NOT_FOUND, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createOtp(@Valid @RequestBody ObjectRequest request) throws OtpDefinitionNotFoundException, CredentialDefinitionNotFoundException, OperationNotFoundException, InvalidRequestException, OtpGenAlgorithmNotSupportedException, InvalidConfigurationException, OperationAlreadyFinishedException, OperationAlreadyFailedException, UserNotActiveException, CredentialNotActiveException, CredentialNotFoundException, EncryptionException { logger.info("Received createOtp request, operation ID: {}, user ID: {}, OTP name: {}", request.getRequestObject().getOperationId(), request.getRequestObject().getUserId(), request.getRequestObject().getOtpName()); final CreateOtpResponse response = otpService.createOtp(request.getRequestObject()); @@ -115,7 +115,7 @@ public ObjectResponse createOtp(@Valid @RequestBody ObjectReq @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_ACTIVE, CREDENTIAL_NOT_ACTIVE, INVALID_REQUEST, CREDENTIAL_DEFINITION_NOT_FOUND, OPERATION_ALREADY_FINISHED, OPERATION_ALREADY_FAILED, OTP_GEN_ALGORITHM_NOT_SUPPORTED, INVALID_CONFIGURATION, CREDENTIAL_NOT_FOUND, OTP_DEFINITION_NOT_FOUND, OPERATION_NOT_FOUND, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "send", method = RequestMethod.POST) + @PostMapping("send") public ObjectResponse createAndSendOtp(@Valid @RequestBody ObjectRequest request) throws UserNotActiveException, CredentialNotActiveException, InvalidRequestException, CredentialDefinitionNotFoundException, OperationAlreadyFinishedException, OperationAlreadyFailedException, OtpGenAlgorithmNotSupportedException, InvalidConfigurationException, CredentialNotFoundException, OtpDefinitionNotFoundException, OperationNotFoundException, EncryptionException { logger.info("Received createAndSendOtp request, operation ID: {}, user ID: {}, OTP name: {}", request.getRequestObject().getOperationId(), request.getRequestObject().getUserId(), request.getRequestObject().getOtpName()); final CreateAndSendOtpResponse response = otpService.createAndSendOtp(request.getRequestObject()); @@ -136,7 +136,7 @@ public ObjectResponse createAndSendOtp(@Valid @Request @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_NOT_FOUND, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ObjectResponse getOptList(@RequestParam @NotBlank @Size(min = 1, max = 256) String operationId, @RequestParam boolean includeRemoved) throws OperationNotFoundException { logger.info("Received getOptList request, operation ID: {}", operationId); GetOtpListRequest request = new GetOtpListRequest(); @@ -159,7 +159,7 @@ public ObjectResponse getOptList(@RequestParam @NotBlank @Si @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_NOT_FOUND, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "list", method = RequestMethod.POST) + @PostMapping("list") public ObjectResponse getOptListPost(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException { logger.info("Received getOptListPost request, operation ID: {}", request.getRequestObject().getOperationId()); final GetOtpListResponse response = otpService.getOtpList(request.getRequestObject()); @@ -183,7 +183,7 @@ public ObjectResponse getOptListPost(@Valid @RequestBody Obj @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_NOT_FOUND, INVALID_REQUEST, OTP_NOT_FOUND, INVALID_CONFIGURATION, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "detail", method = RequestMethod.GET) + @GetMapping("detail") public ObjectResponse getOtpDetail(@RequestParam @Nullable @Size(min = 36, max = 36) String otpId, @RequestParam @Nullable @Size(min = 1, max = 256) String operationId) throws OperationNotFoundException, InvalidRequestException, OtpNotFoundException, InvalidConfigurationException, EncryptionException { logger.info("Received getOtpDetail request, OTP ID: {}, operation ID: {}", otpId, operationId); GetOtpDetailRequest request = new GetOtpDetailRequest(); @@ -209,7 +209,7 @@ public ObjectResponse getOtpDetail(@RequestParam @Nullable @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OPERATION_NOT_FOUND, INVALID_REQUEST, OTP_NOT_FOUND, INVALID_CONFIGURATION, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "detail", method = RequestMethod.POST) + @PostMapping("detail") public ObjectResponse getOtpDetailPost(@Valid @RequestBody ObjectRequest request) throws OperationNotFoundException, InvalidRequestException, OtpNotFoundException, InvalidConfigurationException, EncryptionException { logger.info("Received getOtpDetailPost request, OTP ID: {}, operation ID: {}", request.getRequestObject().getOtpId(), request.getRequestObject().getOperationId()); final GetOtpDetailResponse response = otpService.getOtpDetail(request.getRequestObject()); @@ -231,7 +231,7 @@ public ObjectResponse getOtpDetailPost(@Valid @RequestBody @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OTP_NOT_FOUND, INVALID_REQUEST, OPERATION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public @ResponseBody ObjectResponse deleteOtp(@Valid @RequestBody ObjectRequest request) throws OtpNotFoundException, InvalidRequestException, OperationNotFoundException { logger.info("Received deleteOtp request, OTP ID: {}, operation ID: {}", request.getRequestObject().getOtpId(), request.getRequestObject().getOperationId()); final DeleteOtpResponse response = otpService.deleteOtp(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpDefinitionController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpDefinitionController.java index 8617d58cf..1bf2e1aa3 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpDefinitionController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpDefinitionController.java @@ -80,7 +80,7 @@ public OtpDefinitionController(OtpDefinitionService otpDefinitionService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OTP_DEFINITION_ALREADY_EXISTS, APPLICATION_NOT_FOUND, OTP_POLICY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createOtpDefinition(@Valid @RequestBody ObjectRequest request) throws OtpDefinitionAlreadyExistsException, ApplicationNotFoundException, OtpPolicyNotFoundException { logger.info("Received createOtpDefinition request, OTP definition name: {}", request.getRequestObject().getOtpDefinitionName()); final CreateOtpDefinitionResponse response = otpDefinitionService.createOtpDefinition(request.getRequestObject()); @@ -102,7 +102,7 @@ public ObjectResponse createOtpDefinition(@Valid @R @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OTP_DEFINITION_NOT_FOUND, APPLICATION_NOT_FOUND, OTP_POLICY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.PUT) + @PutMapping public ObjectResponse updateOtpDefinition(@Valid @RequestBody ObjectRequest request) throws OtpDefinitionNotFoundException, ApplicationNotFoundException, OtpPolicyNotFoundException { logger.info("Received updateOtpDefinition request, OTP definition name: {}", request.getRequestObject().getOtpDefinitionName()); final UpdateOtpDefinitionResponse response = otpDefinitionService.updateOtpDefinition(request.getRequestObject()); @@ -124,7 +124,7 @@ public ObjectResponse updateOtpDefinition(@Valid @R @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OTP_DEFINITION_NOT_FOUND, APPLICATION_NOT_FOUND, OTP_POLICY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "update", method = RequestMethod.POST) + @PostMapping("update") public ObjectResponse updateOtpDefinitionPost(@Valid @RequestBody ObjectRequest request) throws OtpDefinitionNotFoundException, ApplicationNotFoundException, OtpPolicyNotFoundException { logger.info("Received updateOtpDefinitionPost request, OTP definition name: {}", request.getRequestObject().getOtpDefinitionName()); final UpdateOtpDefinitionResponse response = otpDefinitionService.updateOtpDefinition(request.getRequestObject()); @@ -143,7 +143,7 @@ public ObjectResponse updateOtpDefinitionPost(@Vali @ApiResponse(responseCode = "400", description = "Invalid request"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ObjectResponse getOtpDefinitionList(@RequestParam boolean includeRemoved) { logger.info("Received getOtpDefinitionList request"); GetOtpDefinitionListRequest request = new GetOtpDefinitionListRequest(); @@ -164,7 +164,7 @@ public ObjectResponse getOtpDefinitionList(@Reques @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "list", method = RequestMethod.POST) + @PostMapping("list") public ObjectResponse getOtpDefinitionListPost(@Valid @RequestBody ObjectRequest request) { logger.info("Received getOtpDefinitionListPost request"); final GetOtpDefinitionListResponse response = otpDefinitionService.getOtpDefinitionList(request.getRequestObject()); @@ -184,7 +184,7 @@ public ObjectResponse getOtpDefinitionListPost(@Va @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OTP_DEFINITION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteOtpDefinition(@Valid @RequestBody ObjectRequest request) throws OtpDefinitionNotFoundException { logger.info("Received deleteOtpDefinition request, OTP definition name: {}", request.getRequestObject().getOtpDefinitionName()); final DeleteOtpDefinitionResponse response = otpDefinitionService.deleteOtpDefinition(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpPolicyController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpPolicyController.java index d02386a20..43774f33a 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpPolicyController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/OtpPolicyController.java @@ -79,7 +79,7 @@ public OtpPolicyController(OtpPolicyService otpPolicyService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OTP_POLICY_ALREADY_EXISTS, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createOtpPolicy(@Valid @RequestBody ObjectRequest request) throws OtpPolicyAlreadyExistsException, InvalidRequestException { logger.info("Received createOtpPolicy request, OTP policy name: {}", request.getRequestObject().getOtpPolicyName()); final CreateOtpPolicyResponse response = otpPolicyService.createOtpPolicy(request.getRequestObject()); @@ -100,7 +100,7 @@ public ObjectResponse createOtpPolicy(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OTP_POLICY_NOT_FOUND, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.PUT) + @PutMapping public ObjectResponse updateOtpPolicy(@Valid @RequestBody ObjectRequest request) throws OtpPolicyNotFoundException, InvalidRequestException { logger.info("Received updateOtpPolicy request, OTP policy name: {}", request.getRequestObject().getOtpPolicyName()); final UpdateOtpPolicyResponse response = otpPolicyService.updateOtpPolicy(request.getRequestObject()); @@ -121,7 +121,7 @@ public ObjectResponse updateOtpPolicy(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OTP_POLICY_NOT_FOUND, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "update", method = RequestMethod.POST) + @PostMapping("update") public ObjectResponse updateOtpPolicyPost(@Valid @RequestBody ObjectRequest request) throws OtpPolicyNotFoundException, InvalidRequestException { logger.info("Received updateOtpPolicyPost request, OTP policy name: {}", request.getRequestObject().getOtpPolicyName()); final UpdateOtpPolicyResponse response = otpPolicyService.updateOtpPolicy(request.getRequestObject()); @@ -141,7 +141,7 @@ public ObjectResponse updateOtpPolicyPost(@Valid @Reque @ApiResponse(responseCode = "400", description = "Invalid request, error codes: INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ObjectResponse getOtpPolicyList(@RequestParam boolean includeRemoved) throws InvalidConfigurationException { logger.info("Received getOtpPolicyListPost request"); GetOtpPolicyListRequest request = new GetOtpPolicyListRequest(); @@ -163,7 +163,7 @@ public ObjectResponse getOtpPolicyList(@RequestParam b @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_CONFIGURATION"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "list", method = RequestMethod.POST) + @PostMapping("list") public ObjectResponse getOtpPolicyListPost(@Valid @RequestBody ObjectRequest request) throws InvalidConfigurationException { logger.info("Received getOtpPolicyListPost request"); final GetOtpPolicyListResponse response = otpPolicyService.getOtpPolicyList(request.getRequestObject()); @@ -183,7 +183,7 @@ public ObjectResponse getOtpPolicyListPost(@Valid @Req @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, OTP_POLICY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteOtpPolicy(@Valid @RequestBody ObjectRequest request) throws OtpPolicyNotFoundException { logger.info("Received deleteOtpPolicy request, OTP policy name: {}", request.getRequestObject().getOtpPolicyName()); final DeleteOtpPolicyResponse response = otpPolicyService.deleteOtpPolicy(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/RoleController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/RoleController.java index cac87e8b4..ff175be1e 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/RoleController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/RoleController.java @@ -38,10 +38,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * REST controller for user roles. @@ -78,7 +75,7 @@ public RoleController(RoleService roleService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, ROLE_ALREADY_EXISTS"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createRole(@Valid @RequestBody ObjectRequest request) throws RoleAlreadyExistsException { logger.info("Received createRole request, role name: {}", request.getRequestObject().getRoleName()); final CreateRoleResponse response = roleService.createRole(request.getRequestObject()); @@ -96,7 +93,7 @@ public ObjectResponse createRole(@Valid @RequestBody ObjectR @ApiResponse(responseCode = "400", description = "Invalid request"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ObjectResponse getRoleList() { logger.info("Received getRoleList request"); final GetRoleListResponse response = roleService.getRoleList(); @@ -115,7 +112,7 @@ public ObjectResponse getRoleList() { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "list", method = RequestMethod.POST) + @PostMapping("list") public ObjectResponse getRoleListPost(@Valid @RequestBody ObjectRequest request) { logger.info("Received getRoleListPost request"); final GetRoleListResponse response = roleService.getRoleList(); @@ -136,7 +133,7 @@ public ObjectResponse getRoleListPost(@Valid @RequestBody O @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, ROLE_NOT_FOUND, DELETE_NOT_ALLOWED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteRole(@Valid @RequestBody ObjectRequest request) throws RoleNotFoundException, DeleteNotAllowedException { logger.info("Received deleteRole request, role name: {}", request.getRequestObject().getRoleName()); final DeleteRoleResponse response = roleService.deleteRole(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/ServiceController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/ServiceController.java index 0906d0f85..2cf4e5dca 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/ServiceController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/ServiceController.java @@ -29,8 +29,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.info.BuildProperties; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.Date; @@ -78,7 +78,7 @@ public void setBuildProperties(BuildProperties buildProperties) { @ApiResponse(responseCode = "400", description = "Invalid request"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "status", method = RequestMethod.GET) + @GetMapping("status") public ObjectResponse getServiceStatus() { logger.debug("Received getServiceStatus request"); final ServiceStatusResponse response = new ServiceStatusResponse(); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/StepDefinitionController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/StepDefinitionController.java index 17771330e..0f02ec26b 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/StepDefinitionController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/StepDefinitionController.java @@ -35,10 +35,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * REST controller class related to step definitions. @@ -75,7 +72,7 @@ public StepDefinitionController(StepDefinitionService stepDefinitionService) { @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, STEP_DEFINITION_ALREADY_EXISTS"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createStepDefinition(@Valid @RequestBody ObjectRequest request) throws StepDefinitionAlreadyExistsException { logger.info("Received createStepDefinition request, step definition ID: {}", request.getRequestObject().getStepDefinitionId()); final CreateStepDefinitionResponse response = stepDefinitionService.createStepDefinition(request.getRequestObject()); @@ -95,7 +92,7 @@ public ObjectResponse createStepDefinition(@Valid @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, STEP_DEFINITION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteStepDefinition(@Valid @RequestBody ObjectRequest request) throws StepDefinitionNotFoundException { logger.info("Received deleteStepDefinition request, step definition ID: {}", request.getRequestObject().getStepDefinitionId()); final DeleteStepDefinitionResponse response = stepDefinitionService.deleteStepDefinition(request.getRequestObject()); diff --git a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/UserController.java b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/UserController.java index ea9d4333c..461ff9b2c 100644 --- a/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/UserController.java +++ b/powerauth-nextstep/src/main/java/io/getlime/security/powerauth/app/nextstep/controller/UserController.java @@ -97,7 +97,7 @@ public UserController(UserIdentityService userIdentityService, UserIdentityLooku @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_ALREADY_EXISTS, INVALID_REQUEST, CREDENTIAL_DEFINITION_NOT_FOUND, INVALID_CONFIGURATION, CREDENTIAL_VALIDATION_FAILED, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.POST) + @PostMapping public ObjectResponse createUser(@Valid @RequestBody ObjectRequest request) throws UserAlreadyExistsException, InvalidRequestException, CredentialDefinitionNotFoundException, InvalidConfigurationException, CredentialValidationFailedException, EncryptionException { logger.info("Received createUser request, user ID: {}", request.getRequestObject().getUserId()); final CreateUserResponse response = userIdentityService.createUserIdentity(request.getRequestObject()); @@ -122,7 +122,7 @@ public ObjectResponse createUser(@Valid @RequestBody ObjectR @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, INVALID_REQUEST, CREDENTIAL_DEFINITION_NOT_FOUND, INVALID_CONFIGURATION, CREDENTIAL_VALIDATION_FAILED, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(method = RequestMethod.PUT) + @PutMapping public ObjectResponse updateUser(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, InvalidRequestException, CredentialDefinitionNotFoundException, InvalidConfigurationException, CredentialValidationFailedException, EncryptionException { logger.info("Received updateUser request, user ID: {}", request.getRequestObject().getUserId()); final UpdateUserResponse response = userIdentityService.updateUserIdentity(request.getRequestObject()); @@ -147,7 +147,7 @@ public ObjectResponse updateUser(@Valid @RequestBody ObjectR @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, INVALID_REQUEST, CREDENTIAL_DEFINITION_NOT_FOUND, INVALID_CONFIGURATION, CREDENTIAL_VALIDATION_FAILED, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "update", method = RequestMethod.POST) + @PostMapping("update") public ObjectResponse updateUserPost(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, InvalidRequestException, CredentialDefinitionNotFoundException, InvalidConfigurationException, CredentialValidationFailedException, EncryptionException { logger.info("Received updateUserPost request, user ID: {}", request.getRequestObject().getUserId()); final UpdateUserResponse response = userIdentityService.updateUserIdentity(request.getRequestObject()); @@ -173,7 +173,7 @@ public ObjectResponse updateUserPost(@Valid @RequestBody Obj @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, INVALID_REQUEST, INVALID_CONFIGURATION, ENCRYPTION_FAILED, CREDENTIAL_DEFINITION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "detail", method = RequestMethod.GET) + @GetMapping("detail") public ObjectResponse getUserDetail(@RequestParam @NotBlank @Size(min = 1, max = 256) String userId, @RequestParam @Nullable @Size(min = 2, max = 256) String credentialName, @RequestParam boolean includeRemoved) throws UserNotFoundException, InvalidRequestException, InvalidConfigurationException, EncryptionException, CredentialDefinitionNotFoundException { GetUserDetailRequest request = new GetUserDetailRequest(); request.setUserId(userId); @@ -201,7 +201,7 @@ public ObjectResponse getUserDetail(@RequestParam @NotBla @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, INVALID_REQUEST, INVALID_CONFIGURATION, ENCRYPTION_FAILED, CREDENTIAL_DEFINITION_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "detail", method = RequestMethod.POST) + @PostMapping("detail") public ObjectResponse getUserDetailPost(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, InvalidRequestException, InvalidConfigurationException, EncryptionException, CredentialDefinitionNotFoundException { logger.debug("Received getUserDetailPost request, user ID: {}", request.getRequestObject().getUserId()); final GetUserDetailResponse response = userIdentityService.getUserDetail(request.getRequestObject()); @@ -224,7 +224,7 @@ public ObjectResponse getUserDetailPost(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, INVALID_REQUEST, INVALID_CONFIGURATION, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "lookup", method = RequestMethod.POST) + @PostMapping("lookup") public ObjectResponse lookupUsers(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, InvalidRequestException, InvalidConfigurationException, EncryptionException { logger.info("Received lookupUsers request"); final LookupUsersResponse response = userIdentityLookupService.lookupUsers(request.getRequestObject()); @@ -248,7 +248,7 @@ public ObjectResponse lookupUsers(@Valid @RequestBody Objec @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, INVALID_REQUEST, INVALID_CONFIGURATION, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "lookup/single", method = RequestMethod.POST) + @PostMapping("lookup/single") public ObjectResponse lookupSingleUser(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, InvalidRequestException, InvalidConfigurationException, OperationNotFoundException, EncryptionException { logger.info("Received lookupSingleUser request, username: {}, credential name: {}", request.getRequestObject().getUsername(), request.getRequestObject().getCredentialName()); final LookupUserResponse response = userIdentityLookupService.lookupUser(request.getRequestObject()); @@ -268,7 +268,7 @@ public ObjectResponse lookupSingleUser(@Valid @RequestBody O @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "multi", method = RequestMethod.PUT) + @PutMapping("multi") public ObjectResponse updateMultipleUsers(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException { logger.info("Received updateMultipleUsers request"); final UpdateUsersResponse response = userIdentityService.updateUsers(request.getRequestObject()); @@ -288,7 +288,7 @@ public ObjectResponse updateMultipleUsers(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "update/multi", method = RequestMethod.POST) + @PostMapping("update/multi") public ObjectResponse updateMultipleUsersPost(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException { logger.info("Received updateMultipleUsersPost request"); final UpdateUsersResponse response = userIdentityService.updateUsers(request.getRequestObject()); @@ -310,7 +310,7 @@ public ObjectResponse updateMultipleUsersPost(@Valid @Reque @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_ROLE_ALREADY_ASSIGNED, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "role", method = RequestMethod.POST) + @PostMapping("role") public ObjectResponse addRole(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserRoleAlreadyAssignedException, InvalidRequestException { logger.info("Received addRole request, user ID: {}, role name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getRoleName()); final AddUserRoleResponse response = userRoleService.addUserRole(request.getRequestObject()); @@ -332,7 +332,7 @@ public ObjectResponse addRole(@Valid @RequestBody ObjectReq @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_ROLE_NOT_ASSIGNED, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "role/remove", method = RequestMethod.POST) + @PostMapping("role/remove") public ObjectResponse removeRole(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserRoleNotAssignedException, InvalidRequestException { logger.info("Received removeRole request, user ID: {}, role name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getRoleName()); final RemoveUserRoleResponse response = userRoleService.removeUserRole(request.getRequestObject()); @@ -353,7 +353,7 @@ public ObjectResponse removeRole(@Valid @RequestBody Obj @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_CONTACT_ALREADY_EXISTS"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "contact", method = RequestMethod.POST) + @PostMapping("contact") public ObjectResponse createUserContact(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserContactAlreadyExistsException { logger.info("Received createUserContact request, user ID: {}, contact name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getContactName()); final CreateUserContactResponse response = userContactService.createUserContact(request.getRequestObject()); @@ -373,7 +373,7 @@ public ObjectResponse createUserContact(@Valid @Reque @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "contact", method = RequestMethod.GET) + @GetMapping("contact") public ObjectResponse getUserContactList(@RequestParam @NotBlank @Size(min = 1, max = 256) String userId) throws UserNotFoundException { logger.info("Received getUserContactList request, user ID: {}", userId); GetUserContactListRequest request = new GetUserContactListRequest(); @@ -395,7 +395,7 @@ public ObjectResponse getUserContactList(@RequestPar @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "contact/list", method = RequestMethod.POST) + @PostMapping("contact/list") public ObjectResponse getUserContactListPost(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException { logger.info("Received getUserContactListPost request, user ID: {}", request.getRequestObject().getUserId()); final GetUserContactListResponse response = userContactService.getUserContactList(request.getRequestObject()); @@ -416,7 +416,7 @@ public ObjectResponse getUserContactListPost(@Valid @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_CONTACT_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "contact", method = RequestMethod.PUT) + @PutMapping("contact") public ObjectResponse updateUserContact(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserContactNotFoundException { logger.info("Received updateUserContact request, user ID: {}, contact name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getContactName()); final UpdateUserContactResponse response = userContactService.updateUserContact(request.getRequestObject()); @@ -437,7 +437,7 @@ public ObjectResponse updateUserContact(@Valid @Reque @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_CONTACT_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "contact/update", method = RequestMethod.POST) + @PostMapping("contact/update") public ObjectResponse updateUserContactPost(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserContactNotFoundException { logger.info("Received updateUserContactPost request, user ID: {}, contact name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getContactName()); final UpdateUserContactResponse response = userContactService.updateUserContact(request.getRequestObject()); @@ -458,7 +458,7 @@ public ObjectResponse updateUserContactPost(@Valid @R @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_CONTACT_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "contact/delete", method = RequestMethod.POST) + @PostMapping("contact/delete") public ObjectResponse deleteUserContact(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserContactNotFoundException { logger.info("Received deleteUserContact request, user ID: {}, contact name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getContactName()); final DeleteUserContactResponse response = userContactService.deleteUserContact(request.getRequestObject()); @@ -480,7 +480,7 @@ public ObjectResponse deleteUserContact(@Valid @Reque @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_ALIAS_ALREADY_EXISTS, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "alias", method = RequestMethod.POST) + @PostMapping("alias") public ObjectResponse createUserAlias(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserAliasAlreadyExistsException, InvalidRequestException { logger.info("Received createUserAlias request, user ID: {}, alias name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getAliasName()); final CreateUserAliasResponse response = userAliasService.createUserAlias(request.getRequestObject()); @@ -502,7 +502,7 @@ public ObjectResponse createUserAlias(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, USER_IDENTITY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "alias", method = RequestMethod.GET) + @GetMapping("alias") public ObjectResponse getUserAliasList(@RequestParam @NotBlank @Size(min = 1, max = 256) String userId, @RequestParam boolean includeRemoved) throws InvalidRequestException, UserNotFoundException { logger.info("Received getUserAliasList request, user ID: {}", userId); GetUserAliasListRequest request = new GetUserAliasListRequest(); @@ -526,7 +526,7 @@ public ObjectResponse getUserAliasList(@RequestParam @ @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, INVALID_REQUEST, USER_IDENTITY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "alias/list", method = RequestMethod.POST) + @PostMapping("alias/list") public ObjectResponse getUserAliasListPost(@Valid @RequestBody ObjectRequest request) throws InvalidRequestException, UserNotFoundException { logger.info("Received getUserAliasListPost request, user ID: {}", request.getRequestObject().getUserId()); final GetUserAliasListResponse response = userAliasService.getUserAliasList(request.getRequestObject()); @@ -548,7 +548,7 @@ public ObjectResponse getUserAliasListPost(@Valid @Req @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_ALIAS_NOT_FOUND, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "alias", method = RequestMethod.PUT) + @PutMapping("alias") public ObjectResponse updateUserAlias(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserAliasNotFoundException, InvalidRequestException { logger.info("Received updateUserAlias request, user ID: {}, alias name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getAliasName()); final UpdateUserAliasResponse response = userAliasService.updateUserAlias(request.getRequestObject()); @@ -570,7 +570,7 @@ public ObjectResponse updateUserAlias(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_ALIAS_NOT_FOUND, INVALID_REQUEST"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "alias/update", method = RequestMethod.POST) + @PostMapping("alias/update") public ObjectResponse updateUserAliasPost(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserAliasNotFoundException, InvalidRequestException { logger.info("Received updateUserAliasPost request, user ID: {}, alias name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getAliasName()); final UpdateUserAliasResponse response = userAliasService.updateUserAlias(request.getRequestObject()); @@ -591,7 +591,7 @@ public ObjectResponse updateUserAliasPost(@Valid @Reque @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_ALIAS_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "alias/delete", method = RequestMethod.POST) + @PostMapping("alias/delete") public ObjectResponse deleteUserAlias(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserAliasNotFoundException { logger.info("Received deleteUserAlias request, user ID: {}, alias name: {}", request.getRequestObject().getUserId(), request.getRequestObject().getAliasName()); final DeleteUserAliasResponse response = userAliasService.deleteUserAlias(request.getRequestObject()); @@ -614,7 +614,7 @@ public ObjectResponse deleteUserAlias(@Valid @RequestBo @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, INVALID_CONFIGURATION, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "credential", method = RequestMethod.GET) + @GetMapping("credential") public ObjectResponse getUserCredentialList(@RequestParam @NotBlank @Size(min = 1, max = 256) String userId, @RequestParam boolean includeRemoved) throws UserNotFoundException, InvalidConfigurationException, EncryptionException { logger.info("Received getUserCredentialList request, user ID: {}", userId); GetUserCredentialListRequest request = new GetUserCredentialListRequest(); @@ -639,7 +639,7 @@ public ObjectResponse getUserCredentialList(@Requ @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, INVALID_CONFIGURATION, ENCRYPTION_FAILED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "credential/list", method = RequestMethod.POST) + @PostMapping("credential/list") public ObjectResponse getUserCredentialListPost(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, InvalidConfigurationException, EncryptionException { logger.info("Received getUserCredentialListPost request, user ID: {}", request.getRequestObject().getUserId()); final GetUserCredentialListResponse response = credentialService.getCredentialList(request.getRequestObject()); @@ -661,7 +661,7 @@ public ObjectResponse getUserCredentialListPost(@ @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "authentication", method = RequestMethod.GET) + @GetMapping("authentication") public ObjectResponse getUserAuthenticationList(@RequestParam @NotBlank @Size(min = 1, max = 256) String userId, @RequestParam @Nullable Date createdStartDate, @RequestParam @Nullable Date createdEndDate) throws UserNotFoundException { logger.info("Received getUserAuthenticationList request, user ID: {}", userId); GetUserAuthenticationListRequest request = new GetUserAuthenticationListRequest(); @@ -685,7 +685,7 @@ public ObjectResponse getUserAuthenticationLi @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "authentication/list", method = RequestMethod.POST) + @PostMapping("authentication/list") public ObjectResponse getUserAuthenticationListPost(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException { logger.info("Received getUserAuthenticationListPost request, user ID: {}", request.getRequestObject().getUserId()); final GetUserAuthenticationListResponse response = authenticationService.getUserAuthenticationList(request.getRequestObject()); @@ -705,7 +705,7 @@ public ObjectResponse getUserAuthenticationLi @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "delete", method = RequestMethod.POST) + @PostMapping("delete") public ObjectResponse deleteUser(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException { logger.info("Received deleteUser request, user ID: {}", request.getRequestObject().getUserId()); final DeleteUserResponse response = userIdentityService.deleteUser(request.getRequestObject()); @@ -726,7 +726,7 @@ public ObjectResponse deleteUser(@Valid @RequestBody ObjectR @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_IDENTITY_NOT_ACTIVE"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "block", method = RequestMethod.POST) + @PostMapping("block") public ObjectResponse blockUser(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserNotActiveException { logger.info("Received blockUser request, user ID: {}", request.getRequestObject().getUserId()); final BlockUserResponse response = userIdentityService.blockUser(request.getRequestObject()); @@ -747,7 +747,7 @@ public ObjectResponse blockUser(@Valid @RequestBody ObjectReq @ApiResponse(responseCode = "400", description = "Invalid request, error codes: REQUEST_VALIDATION_FAILED, USER_IDENTITY_NOT_FOUND, USER_IDENTITY_NOT_BLOCKED"), @ApiResponse(responseCode = "500", description = "Unexpected error") }) - @RequestMapping(value = "unblock", method = RequestMethod.POST) + @PostMapping("unblock") public ObjectResponse unblockUser(@Valid @RequestBody ObjectRequest request) throws UserNotFoundException, UserNotBlockedException { logger.info("Received unblockUser request, user ID: {}", request.getRequestObject().getUserId()); final UnblockUserResponse response = userIdentityService.unblockUser(request.getRequestObject()); diff --git a/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/ConsentInfoController.java b/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/ConsentInfoController.java index c295af86f..a3aec7f8b 100644 --- a/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/ConsentInfoController.java +++ b/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/ConsentInfoController.java @@ -41,7 +41,7 @@ public ConsentInfoController(ConsentService consentService) { this.consentService = consentService; } - @RequestMapping(method = RequestMethod.GET) + @GetMapping public ObjectResponse consentDetail(@RequestParam("id") String id) throws ConsentNotFoundException { final ConsentDetailResponse response = consentService.consentDetail(id); if (response == null) { diff --git a/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/ServiceController.java b/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/ServiceController.java index ae6f39c78..2c4b94ab9 100644 --- a/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/ServiceController.java +++ b/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/ServiceController.java @@ -26,8 +26,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.info.BuildProperties; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.util.Date; @@ -68,7 +68,7 @@ public void setBuildProperties(BuildProperties buildProperties) { * Controller resource with system information. * @return System status info. */ - @RequestMapping(value = "status", method = RequestMethod.GET) + @GetMapping("status") public @ResponseBody ObjectResponse getServiceStatus() { logger.info("Received getServiceStatus request"); ServiceStatusResponse response = new ServiceStatusResponse(); diff --git a/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/TppRegistryController.java b/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/TppRegistryController.java index b83b36507..80e2ec237 100644 --- a/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/TppRegistryController.java +++ b/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/TppRegistryController.java @@ -50,7 +50,7 @@ public TppRegistryController(TppService tppService) { this.tppService = tppService; } - @RequestMapping(value = "app", method = RequestMethod.GET) + @GetMapping("app") public ObjectResponse fetchAppInfoFromClientId( @RequestParam("clientId") String clientId, @RequestParam(value = "tppLicense", required = false) String tppLicense) throws TppAppNotFoundException, TppNotFoundException { @@ -63,7 +63,7 @@ public ObjectResponse fetchAppInfoFromClientId( } } - @RequestMapping(value = "app/list", method = RequestMethod.GET) + @GetMapping("app/list") public ObjectResponse> getAppList(@RequestParam("tppLicense") String tppLicense) throws TppNotFoundException { final List response = tppService.fetchAppListByTppLicense(tppLicense); if (response != null) { @@ -73,7 +73,7 @@ public ObjectResponse> getAppList(@RequestParam("tppL } } - @RequestMapping(value = "app", method = RequestMethod.POST) + @PostMapping("app") public ObjectResponse createApp(@RequestBody ObjectRequest request) throws UnableToCreateAppException { final CreateTppAppRequest requestObject = request.getRequestObject(); final List errors = CreateTppAppRequestValidator.validate(requestObject); @@ -84,7 +84,7 @@ public ObjectResponse createApp(@RequestBody ObjectRequest return new ObjectResponse<>(tppAppDetailResponse); } - @RequestMapping(value = "app", method = RequestMethod.PUT) + @PutMapping("app") public ObjectResponse updateApp( @RequestParam("clientId") String clientId, @RequestBody ObjectRequest request) throws UnableToCreateAppException, TppNotFoundException, TppAppNotFoundException { @@ -97,7 +97,7 @@ public ObjectResponse updateApp( return new ObjectResponse<>(tppAppDetailResponse); } - @RequestMapping(value = "app/renewSecret", method = RequestMethod.POST) + @PostMapping("app/renewSecret") public ObjectResponse updateApp( @RequestParam("clientId") String clientId, @RequestParam("tppLicense") String tppLicense) throws TppNotFoundException, TppAppNotFoundException { @@ -105,7 +105,7 @@ public ObjectResponse updateApp( return new ObjectResponse<>(tppAppDetailResponse); } - @RequestMapping(value = "app", method = RequestMethod.DELETE) + @DeleteMapping("app") public Response deleteApp( @RequestParam("clientId") String clientId, @RequestParam("tppLicense") String tppLicense) throws TppNotFoundException, TppAppNotFoundException { @@ -113,13 +113,13 @@ public Response deleteApp( return new Response(); } - @RequestMapping(value = "block", method = RequestMethod.POST) + @PostMapping("block") public ObjectResponse blockTpp(@RequestParam("tppLicense") String tppLicense) throws TppNotFoundException { final TppInfo tppInfo = tppService.blockTpp(tppLicense); return new ObjectResponse<>(tppInfo); } - @RequestMapping(value = "unblock", method = RequestMethod.POST) + @PostMapping("unblock") public ObjectResponse unblockTpp(@RequestParam("tppLicense") String tppLicense) throws TppNotFoundException { final TppInfo tppInfo = tppService.unblockTpp(tppLicense); return new ObjectResponse<>(tppInfo); diff --git a/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/UserConsentController.java b/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/UserConsentController.java index 4e35b9787..8589c0657 100644 --- a/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/UserConsentController.java +++ b/powerauth-tpp-engine/src/main/java/io/getlime/security/powerauth/app/tppengine/controller/UserConsentController.java @@ -55,7 +55,7 @@ public UserConsentController(UserConsentService userConsentService) { * @return Response with consent created. * @throws ConsentNotFoundException In case the consent with given ID is not found. */ - @RequestMapping(value = "consent", method = RequestMethod.POST) + @PostMapping("consent") public ObjectResponse giveConsent(@RequestBody ObjectRequest request) throws ConsentNotFoundException { final GiveConsentRequest requestObject = request.getRequestObject(); //TODO: add validator @@ -70,7 +70,7 @@ public ObjectResponse giveConsent(@RequestBody ObjectReques * @return Information about success or failure. * @throws ConsentNotFoundException In case the consent with given ID is not found. */ - @RequestMapping(value = "consent", method = RequestMethod.DELETE) + @DeleteMapping("consent") public Response removeConsent(@RequestBody ObjectRequest request) throws ConsentNotFoundException { RemoveConsentRequest requestObject = request.getRequestObject(); //TODO: add validator @@ -85,7 +85,7 @@ public Response removeConsent(@RequestBody ObjectRequest r * @return Information about success or failure. * @throws ConsentNotFoundException In case the consent with given ID is not found. */ - @RequestMapping(value = "consent/delete", method = RequestMethod.POST) + @PostMapping("consent/delete") public Response removeConsentPost(@RequestBody ObjectRequest request) throws ConsentNotFoundException { RemoveConsentRequest requestObject = request.getRequestObject(); //TODO: add validator @@ -100,7 +100,7 @@ public Response removeConsentPost(@RequestBody ObjectRequest consentList(@RequestParam("userId") String userId, @RequestParam(value = "clientId", required = false) String clientId) throws ConsentNotFoundException { final ConsentListResponse response = userConsentService.consentListForUser(userId, clientId); return new ObjectResponse<>(response); @@ -142,7 +142,7 @@ public ObjectResponse consentList(@RequestParam("userId") S * @return Check the consent status * @throws ConsentNotFoundException In case the consent with given ID is not found. */ - @RequestMapping(value = "consent/status", method = RequestMethod.GET) + @GetMapping("consent/status") public ObjectResponse consentStatus(@RequestParam("userId") String userId, @RequestParam("clientId") String clientId, @RequestParam("consentId") String consentId) throws ConsentNotFoundException { UserConsentDetailResponse response = userConsentService.consentStatus(userId, consentId, clientId); return new ObjectResponse<>(response); @@ -157,7 +157,7 @@ public ObjectResponse consentStatus(@RequestParam("us * @return List of history items. * @throws ConsentNotFoundException In case the consent with given ID is not found. */ - @RequestMapping(value = "consent/history", method = RequestMethod.GET) + @GetMapping("consent/history") public ObjectResponse consentHistory(@RequestParam("userId") String userId, @RequestParam(value = "clientId", required = false) String clientId) throws ConsentNotFoundException { ConsentHistoryListResponse response = userConsentService.consentHistoryForUser(userId, clientId); return new ObjectResponse<>(response); diff --git a/powerauth-webflow-authentication-approval-sca/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/approvalsca/controller/ApprovalScaController.java b/powerauth-webflow-authentication-approval-sca/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/approvalsca/controller/ApprovalScaController.java index dc7776956..cb55bfb99 100644 --- a/powerauth-webflow-authentication-approval-sca/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/approvalsca/controller/ApprovalScaController.java +++ b/powerauth-webflow-authentication-approval-sca/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/approvalsca/controller/ApprovalScaController.java @@ -49,9 +49,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; /** @@ -96,7 +96,7 @@ public ApprovalScaController(DataAdapterClient dataAdapterClient, NextStepClient * @return SCA approval authentication response. * @throws AuthStepException In case SCA approval authentication fails. */ - @RequestMapping(value = "/authenticate", method = RequestMethod.POST) + @PostMapping("/authenticate") public ApprovalScaAuthResponse authenticateScaApproval(@RequestBody ApprovalScaAuthRequest request) throws AuthStepException { GetOperationDetailResponse operation = getOperation(); logger.info("Step authentication started, operation ID: {}, authentication method: {}", operation.getOperationId(), getAuthMethodName().toString()); @@ -143,7 +143,7 @@ public ApprovalScaAuthResponse authenticateScaApproval(@RequestBody ApprovalScaA * @return SCA approval initialization response. * @throws AuthStepException In case SCA approval initialization fails. */ - @RequestMapping(value = "/init", method = RequestMethod.POST) + @PostMapping("/init") public ApprovalScaInitResponse initScaApproval(@RequestBody ApprovalScaInitRequest request) throws AuthStepException { final GetOperationDetailResponse operation = getOperation(); try { @@ -193,7 +193,7 @@ protected AuthMethod getAuthMethodName() { * @return Object response. * @throws AuthStepException Thrown when operation could not be canceled. */ - @RequestMapping(value = "/cancel", method = RequestMethod.POST) + @PostMapping("/cancel") public AuthStepResponse cancelAuthentication() throws AuthStepException { try { final GetOperationDetailResponse operation = getOperation(); diff --git a/powerauth-webflow-authentication-consent/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/consent/controller/ConsentController.java b/powerauth-webflow-authentication-consent/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/consent/controller/ConsentController.java index 65b811287..1b9ae3611 100644 --- a/powerauth-webflow-authentication-consent/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/consent/controller/ConsentController.java +++ b/powerauth-webflow-authentication-consent/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/consent/controller/ConsentController.java @@ -55,9 +55,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -185,7 +185,7 @@ protected AuthMethod getAuthMethodName() { * @return Authorization response. * @throws AuthStepException Thrown when operation is invalid or not available. */ - @RequestMapping(value = "/init", method = RequestMethod.POST) + @PostMapping("/init") public ConsentInitResponse initConsentForm() throws AuthStepException { final GetOperationDetailResponse operation = getOperation(); logger.info("Init step started, operation ID: {}, authentication method: {}", operation.getOperationId(), getAuthMethodName().toString()); @@ -269,7 +269,7 @@ private void cleanHttpSession() { * @param request Authorization request which includes the authorization code. * @return Authorization response. */ - @RequestMapping(value = "/authenticate", method = RequestMethod.POST) + @PostMapping("/authenticate") public ConsentAuthResponse authenticateHandler(@RequestBody ConsentAuthRequest request) { try { return buildAuthorizationResponse(request, new AuthResponseProvider() { @@ -335,7 +335,7 @@ public ConsentAuthResponse continueAuthentication(String operationId, String use * @return Authorization response. * @throws AuthStepException Thrown when operation is invalid or not available. */ - @RequestMapping(value = "/cancel", method = RequestMethod.POST) + @PostMapping("/cancel") public ConsentAuthResponse cancelAuthentication() throws AuthStepException { try { final GetOperationDetailResponse operation = getOperation(); diff --git a/powerauth-webflow-authentication-form/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/form/controller/FormLoginController.java b/powerauth-webflow-authentication-form/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/form/controller/FormLoginController.java index 18f4c451b..68ff9a4a8 100644 --- a/powerauth-webflow-authentication-form/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/form/controller/FormLoginController.java +++ b/powerauth-webflow-authentication-form/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/form/controller/FormLoginController.java @@ -60,9 +60,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; @@ -233,7 +233,7 @@ protected AuthMethod getAuthMethodName() { * @return Authentication response. * @throws AuthStepException Thrown in case authentication fails. */ - @RequestMapping(value = "/authenticate", method = RequestMethod.POST) + @PostMapping("/authenticate") public @ResponseBody UsernamePasswordAuthResponse authenticateHandler(@RequestBody UsernamePasswordAuthRequest request) throws AuthStepException { final GetOperationDetailResponse operation = getOperation(); final String username = request.getUsername(); @@ -323,7 +323,7 @@ public UsernamePasswordAuthResponse continueAuthentication(String operationId, S * @return Object response. * @throws AuthStepException Thrown when operation could not be canceled. */ - @RequestMapping(value = "/cancel", method = RequestMethod.POST) + @PostMapping("/cancel") public @ResponseBody UsernamePasswordAuthResponse cancelAuthentication() throws AuthStepException { try { @@ -349,7 +349,7 @@ UsernamePasswordAuthResponse cancelAuthentication() throws AuthStepException { * @return Prepare login form response. * @throws AuthStepException Thrown when request is invalid or communication with Next Step fails. */ - @RequestMapping(value = "/init", method = RequestMethod.POST) + @PostMapping("/init") public @ResponseBody UsernamePasswordInitResponse initLoginForm(@RequestBody UsernamePasswordInitRequest request) throws AuthStepException { if (request == null) { throw new AuthStepException("Invalid request", "error.invalidRequest"); diff --git a/powerauth-webflow-authentication-init/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/init/controller/ApiController.java b/powerauth-webflow-authentication-init/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/init/controller/ApiController.java index 276e14d5a..fe2f72b17 100644 --- a/powerauth-webflow-authentication-init/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/init/controller/ApiController.java +++ b/powerauth-webflow-authentication-init/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/init/controller/ApiController.java @@ -42,9 +42,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.web.savedrequest.DefaultSavedRequest; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; @@ -84,7 +84,7 @@ public ApiController(OperationSessionService operationSessionService) { * @return Authentication initialization response. * @throws CommunicationFailedException In case the network communication fails when creating an implicit login operation. */ - @RequestMapping(value = "/authenticate", method = RequestMethod.POST) + @PostMapping("/authenticate") public @ResponseBody InitOperationResponse register(@RequestBody InitOperationRequest request) throws CommunicationFailedException { logger.info("Operation INIT started"); diff --git a/powerauth-webflow-authentication-init/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/init/controller/TimeoutController.java b/powerauth-webflow-authentication-init/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/init/controller/TimeoutController.java index 6b1782d81..503477474 100644 --- a/powerauth-webflow-authentication-init/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/init/controller/TimeoutController.java +++ b/powerauth-webflow-authentication-init/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/init/controller/TimeoutController.java @@ -27,8 +27,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; /** @@ -60,7 +60,7 @@ public TimeoutController(TimeoutInformationService timeoutService) { * @return Init timeout response. * @throws AuthStepException Thrown when request is invalid. */ - @RequestMapping(value = "/verify", method = RequestMethod.POST) + @PostMapping("/verify") public VerifyTimeoutResponse verifyTimeout(VerifyTimeoutRequest request) throws AuthStepException { if (request == null) { throw new AuthStepException("Invalid request in verifyTimeout", "error.invalidRequest"); diff --git a/powerauth-webflow-authentication-login-sca/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/loginsca/controller/LoginScaController.java b/powerauth-webflow-authentication-login-sca/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/loginsca/controller/LoginScaController.java index e7a57efa6..808beda77 100644 --- a/powerauth-webflow-authentication-login-sca/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/loginsca/controller/LoginScaController.java +++ b/powerauth-webflow-authentication-login-sca/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/loginsca/controller/LoginScaController.java @@ -62,9 +62,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.Collections; @@ -117,7 +117,7 @@ public LoginScaController(DataAdapterClient dataAdapterClient, NextStepClient ne * @return SCA login initialization response. * @throws AuthStepException In case SCA login initialization fails. */ - @RequestMapping(value = "/authenticate", method = RequestMethod.POST) + @PostMapping("/authenticate") public LoginScaAuthResponse authenticateScaLogin(@Valid @RequestBody LoginScaAuthRequest request) throws AuthStepException { GetOperationDetailResponse operation = getOperation(); logger.info("Step authentication started, operation ID: {}, authentication method: {}", operation.getOperationId(), getAuthMethodName().toString()); @@ -258,7 +258,7 @@ public LoginScaAuthResponse authenticateScaLogin(@Valid @RequestBody LoginScaAut * @return Prepare login form response. * @throws AuthStepException Thrown when request is invalid or communication with Next Step fails. */ - @RequestMapping(value = "/init", method = RequestMethod.POST) + @PostMapping("/init") public LoginScaInitResponse initScaLogin(@RequestBody LoginScaInitRequest request) throws AuthStepException { final LoginScaInitResponse response = new LoginScaInitResponse(); final GetOperationDetailResponse operation = getOperation(); @@ -358,7 +358,7 @@ private String getClientCertificateFromHttpSession() { * @return Object response. * @throws AuthStepException Thrown when operation could not be canceled. */ - @RequestMapping(value = "/cancel", method = RequestMethod.POST) + @PostMapping("/cancel") public AuthStepResponse cancelAuthentication() throws AuthStepException { try { final GetOperationDetailResponse operation = getOperation(); diff --git a/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileAppApiController.java b/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileAppApiController.java index 218757685..871003fb4 100644 --- a/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileAppApiController.java +++ b/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileAppApiController.java @@ -66,9 +66,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.util.Collections; @@ -126,7 +126,7 @@ protected AuthMethod getAuthMethodName() { * @throws InvalidActivationException Thrown in case activation is not valid. * @throws PowerAuthAuthenticationException Thrown in case PowerAuth authentication fails. */ - @RequestMapping(value = "/operation/list/signature", method = RequestMethod.POST) + @PostMapping("/operation/list/signature") @PowerAuth(resourceId = "/operation/list/signature", signatureType = {PowerAuthSignatureTypes.POSSESSION}) public @ResponseBody ObjectResponse getOperationList(PowerAuthApiAuthentication apiAuthentication) throws InvalidActivationException, PowerAuthAuthenticationException { return getOperationListImpl(apiAuthentication); @@ -139,7 +139,7 @@ protected AuthMethod getAuthMethodName() { * @throws InvalidActivationException Thrown in case activation is not valid. * @throws PowerAuthAuthenticationException Thrown in case PowerAuth authentication fails. */ - @RequestMapping(value = "/operation/list", method = RequestMethod.POST) + @PostMapping("/operation/list") @PowerAuthToken(signatureType = { PowerAuthSignatureTypes.POSSESSION, PowerAuthSignatureTypes.POSSESSION_BIOMETRY, @@ -234,7 +234,7 @@ private Map getOperationConfigs(List getOperationConfigs(List request, PowerAuthApiAuthentication apiAuthentication) throws MobileAppApiException, PowerAuthAuthenticationException, AuthStepException { diff --git a/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileTokenOfflineController.java b/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileTokenOfflineController.java index b23275a0d..4a292f1f6 100644 --- a/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileTokenOfflineController.java +++ b/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileTokenOfflineController.java @@ -63,9 +63,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.math.BigInteger; @@ -213,7 +213,7 @@ protected AuthMethod getAuthMethodName() { * @return Response with QR code as String-based PNG image. * @throws AuthStepException In case authorization fails. */ - @RequestMapping(value = "/init", method = RequestMethod.POST) + @PostMapping("/init") @ResponseBody public QrCodeInitResponse initQrCode(@RequestBody QrCodeInitRequest request) throws AuthStepException { if (!webFlowServicesConfiguration.isOfflineModeAvailable()) { @@ -292,7 +292,7 @@ public QrCodeInitResponse initQrCode(@RequestBody QrCodeInitRequest request) thr * @return Authorization response. * @throws AuthStepException Thrown when authentication fails. */ - @RequestMapping(value = "/authenticate", method = RequestMethod.POST) + @PostMapping("/authenticate") @ResponseBody public QrCodeAuthenticationResponse verifyAuthCode(@RequestBody QrCodeAuthenticationRequest request) throws AuthStepException { GetOperationDetailResponse operation = getOperation(); @@ -356,7 +356,7 @@ public QrCodeAuthenticationResponse continueAuthentication(String operationId, S * @return Authorization response. * @throws AuthStepException In case authorization fails. */ - @RequestMapping(value = "/cancel", method = RequestMethod.POST) + @PostMapping("/cancel") @ResponseBody public QrCodeAuthenticationResponse cancelAuthentication() throws AuthStepException { if (!webFlowServicesConfiguration.isOfflineModeAvailable()) { diff --git a/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileTokenOnlineController.java b/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileTokenOnlineController.java index 3b04c8812..1e6740ae2 100644 --- a/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileTokenOnlineController.java +++ b/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/MobileTokenOnlineController.java @@ -41,9 +41,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; @@ -112,7 +112,7 @@ protected AuthMethod getAuthMethodName() { * @return Initialization response. * @throws AuthStepException Thrown when authentication fails. */ - @RequestMapping(value = "/init", method = RequestMethod.POST) + @PostMapping("/init") public @ResponseBody MobileTokenInitResponse initPushMessage() throws AuthStepException { try { final GetOperationDetailResponse operation = getOperation(); @@ -152,7 +152,7 @@ protected AuthMethod getAuthMethodName() { * @return Authentication result. * @throws AuthStepException Thrown when authentication fails. */ - @RequestMapping(value = "/authenticate", method = RequestMethod.POST) + @PostMapping("/authenticate") public @ResponseBody MobileTokenAuthenticationResponse authenticateHandler(@RequestBody MobileTokenAuthenticationRequest request) throws AuthStepException { final GetOperationDetailResponse operation = getOperation(false); @@ -277,7 +277,7 @@ protected AuthMethod getAuthMethodName() { * @return Object response. * @throws AuthStepException Thrown when operation could not be canceled. */ - @RequestMapping(value = "/cancel", method = RequestMethod.POST) + @PostMapping("/cancel") public @ResponseBody MobileTokenAuthenticationResponse cancelAuthentication() throws AuthStepException { try { GetOperationDetailResponse operation = getOperation(); diff --git a/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/PushRegistrationController.java b/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/PushRegistrationController.java index d31df77c2..dd71c2b0c 100644 --- a/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/PushRegistrationController.java +++ b/powerauth-webflow-authentication-mtoken/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/mtoken/controller/PushRegistrationController.java @@ -35,9 +35,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; /** @@ -71,7 +71,7 @@ public PushRegistrationController(PushServerClient pushServerClient) { * @throws PowerAuthAuthenticationException Thrown when PowerAuth authentication fails. * @throws MobileAppApiException Thrown when registration fails. */ - @RequestMapping(value = "/device/register/signature", method = RequestMethod.POST) + @PostMapping("/device/register/signature") @PowerAuth(resourceId = "/device/register/signature", signatureType = {PowerAuthSignatureTypes.POSSESSION}) public @ResponseBody Response registerDevice(@RequestBody ObjectRequest request, PowerAuthApiAuthentication apiAuthentication) throws PowerAuthAuthenticationException, MobileAppApiException { return registerDeviceImpl(request, apiAuthentication); @@ -85,7 +85,7 @@ public PushRegistrationController(PushServerClient pushServerClient) { * @throws PowerAuthAuthenticationException Thrown when PowerAuth authentication fails. * @throws MobileAppApiException Thrown when registration fails. */ - @RequestMapping(value = "/device/register/token", method = RequestMethod.POST) + @PostMapping("/device/register/token") @PowerAuthToken(signatureType = { PowerAuthSignatureTypes.POSSESSION, PowerAuthSignatureTypes.POSSESSION_BIOMETRY, @@ -104,7 +104,7 @@ public PushRegistrationController(PushServerClient pushServerClient) { * @throws PowerAuthAuthenticationException Thrown when PowerAuth authentication fails. * @throws MobileAppApiException Thrown when registration fails. */ - @RequestMapping(value = "/device/register", method = RequestMethod.POST) + @PostMapping("/device/register") @PowerAuthToken(signatureType = { PowerAuthSignatureTypes.POSSESSION, PowerAuthSignatureTypes.POSSESSION_BIOMETRY, diff --git a/powerauth-webflow-authentication-operation-review/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/operation/controller/OperationReviewController.java b/powerauth-webflow-authentication-operation-review/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/operation/controller/OperationReviewController.java index 5aadd11d5..5ddb0f8e6 100644 --- a/powerauth-webflow-authentication-operation-review/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/operation/controller/OperationReviewController.java +++ b/powerauth-webflow-authentication-operation-review/src/main/java/io/getlime/security/powerauth/lib/webflow/authentication/method/operation/controller/OperationReviewController.java @@ -52,10 +52,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Map; @@ -124,7 +121,7 @@ protected AuthMethod getAuthMethodName() { * @return Operation detail response. * @throws AuthStepException Thrown when operation is invalid or not available. */ - @RequestMapping(value = "/detail", method = RequestMethod.POST) + @PostMapping("/detail") public @ResponseBody OperationReviewDetailResponse getOperationDetails(@RequestBody OperationDetailRequest request) throws AuthStepException { try { final GetOperationDetailResponse operation = getOperation(); @@ -151,7 +148,7 @@ protected AuthMethod getAuthMethodName() { * @param request Operation review request. * @return Operation review response. */ - @RequestMapping(value = "/authenticate", method = RequestMethod.POST) + @PostMapping("/authenticate") public @ResponseBody OperationReviewResponse getOperationDetails(@RequestBody OperationReviewRequest request) { try { return buildAuthorizationResponse(request, new AuthResponseProvider() { @@ -206,7 +203,7 @@ public OperationReviewResponse continueAuthentication(String operationId, String * @return Object response. * @throws AuthStepException Thrown when operation could not be canceled. */ - @RequestMapping(value = "/cancel", method = RequestMethod.POST) + @PostMapping("/cancel") public @ResponseBody OperationReviewResponse cancelAuthentication() throws AuthStepException { try { GetOperationDetailResponse operation = getOperation(); @@ -231,7 +228,7 @@ public OperationReviewResponse continueAuthentication(String operationId, String * @return Object response. * @throws AuthStepException Thrown when operation is invalid or not available. */ - @RequestMapping(value = "/formData", method = RequestMethod.PUT) + @PutMapping("/formData") public @ResponseBody Response updateFormData(@RequestBody UpdateOperationFormDataRequest request) throws AuthStepException { return updateFormDataImpl(request); } @@ -242,7 +239,7 @@ public OperationReviewResponse continueAuthentication(String operationId, String * @return Object response. * @throws AuthStepException Thrown when operation is invalid or not available. */ - @RequestMapping(value = "/formData/update", method = RequestMethod.POST) + @PostMapping("/formData/update") public @ResponseBody Response updateFormDataPost(@RequestBody UpdateOperationFormDataRequest request) throws AuthStepException { return updateFormDataImpl(request); } @@ -275,7 +272,7 @@ private Response updateFormDataImpl(UpdateOperationFormDataRequest request) thro * @param request Update chosen authentication method request. * @return Object response. */ - @RequestMapping(value = "/chosenAuthMethod", method = RequestMethod.PUT) + @PutMapping("/chosenAuthMethod") public @ResponseBody Response updateChosenAuthenticationMethod(@RequestBody UpdateOperationChosenAuthMethodRequest request) throws AuthStepException { return updateChosenAuthenticationMethodImpl(request); } @@ -286,7 +283,7 @@ private Response updateFormDataImpl(UpdateOperationFormDataRequest request) thro * @return Object response. * @throws AuthStepException Thrown when operation is invalid or not available. */ - @RequestMapping(value = "/chosenAuthMethod/update", method = RequestMethod.POST) + @PostMapping("/chosenAuthMethod/update") public @ResponseBody Response updateChosenAuthenticationMethodPost(@RequestBody UpdateOperationChosenAuthMethodRequest request) throws AuthStepException { return updateChosenAuthenticationMethodImpl(request); } 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 bd151b1d0..6b42c46f6 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 @@ -59,9 +59,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.nio.charset.StandardCharsets; @@ -410,7 +410,7 @@ private void cleanHttpSession() { * @return Authorization response. * @throws AuthStepException Thrown when operation is invalid or not available. */ - @RequestMapping(value = "/init", method = RequestMethod.POST) + @PostMapping("/init") public InitSmsAuthorizationResponse initSmsAuthorization() throws AuthStepException { final GetOperationDetailResponse operation = getOperation(); final AuthMethod authMethod = getAuthMethodName(operation); @@ -509,7 +509,7 @@ public InitSmsAuthorizationResponse initSmsAuthorization() throws AuthStepExcept * @return Authorization response. * @throws AuthStepException Thrown when operation is invalid or not available. */ - @RequestMapping(value = "/resend", method = RequestMethod.POST) + @PostMapping("/resend") public ResendSmsAuthorizationResponse resendSmsAuthorization() throws AuthStepException { final GetOperationDetailResponse operation = getOperation(); final AuthMethod authMethod = getAuthMethodName(operation); @@ -551,7 +551,7 @@ public ResendSmsAuthorizationResponse resendSmsAuthorization() throws AuthStepEx * @return Authorization response. * @throws AuthStepException In case authentication fails. */ - @RequestMapping(value = "/authenticate", method = RequestMethod.POST) + @PostMapping("/authenticate") public SmsAuthorizationResponse authenticateHandler(@Valid @RequestBody SmsAuthorizationRequest request) throws AuthStepException { final GetOperationDetailResponse operation = getOperation(); final AuthMethod authMethod = getAuthMethodName(operation); @@ -651,7 +651,7 @@ public SmsAuthorizationResponse continueAuthentication(String operationId, Strin * @return Authorization response. * @throws AuthStepException Thrown when operation is invalid or not available. */ - @RequestMapping(value = "/cancel", method = RequestMethod.POST) + @PostMapping("/cancel") public SmsAuthorizationResponse cancelAuthentication() throws AuthStepException { try { final GetOperationDetailResponse operation = getOperation(); diff --git a/powerauth-webflow-client/src/main/java/io/getlime/security/powerauth/app/webflow/demo/controller/ServiceController.java b/powerauth-webflow-client/src/main/java/io/getlime/security/powerauth/app/webflow/demo/controller/ServiceController.java index f8bbbf27d..656126059 100644 --- a/powerauth-webflow-client/src/main/java/io/getlime/security/powerauth/app/webflow/demo/controller/ServiceController.java +++ b/powerauth-webflow-client/src/main/java/io/getlime/security/powerauth/app/webflow/demo/controller/ServiceController.java @@ -24,8 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.info.BuildProperties; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.util.Date; @@ -60,7 +60,7 @@ public void setBuildProperties(BuildProperties buildProperties) { * Controller resource with system information. * @return System status info. */ - @RequestMapping(value = "status", method = RequestMethod.GET) + @GetMapping("status") public @ResponseBody ObjectResponse getServiceStatus() { ServiceStatusResponse response = new ServiceStatusResponse(); response.setApplicationName(webFlowServiceConfiguration.getApplicationName()); diff --git a/powerauth-webflow-resources/src/main/java/io/getlime/security/powerauth/lib/webflow/resource/controller/UserProfileController.java b/powerauth-webflow-resources/src/main/java/io/getlime/security/powerauth/lib/webflow/resource/controller/UserProfileController.java index 213b7e350..bbe561b03 100644 --- a/powerauth-webflow-resources/src/main/java/io/getlime/security/powerauth/lib/webflow/resource/controller/UserProfileController.java +++ b/powerauth-webflow-resources/src/main/java/io/getlime/security/powerauth/lib/webflow/resource/controller/UserProfileController.java @@ -32,6 +32,7 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.oauth2.core.OAuth2AuthenticatedPrincipal; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -74,7 +75,7 @@ public UserProfileController(DataAdapterClient client, WebFlowResourcesServerCon * @param principal Original authentication principal of the currently logged user. * @return User profile. */ - @RequestMapping(value = "me", method = RequestMethod.GET) + @GetMapping("me") public @ResponseBody UserResponse me(@AuthenticationPrincipal OAuth2AuthenticatedPrincipal principal) { final UserResponse userResponse = new UserResponse(); diff --git a/powerauth-webflow/src/main/java/io/getlime/security/powerauth/app/webflow/controller/HomeController.java b/powerauth-webflow/src/main/java/io/getlime/security/powerauth/app/webflow/controller/HomeController.java index de15e6593..08cb8f371 100644 --- a/powerauth-webflow/src/main/java/io/getlime/security/powerauth/app/webflow/controller/HomeController.java +++ b/powerauth-webflow/src/main/java/io/getlime/security/powerauth/app/webflow/controller/HomeController.java @@ -46,8 +46,7 @@ import org.springframework.security.web.savedrequest.HttpSessionRequestCache; import org.springframework.security.web.savedrequest.SavedRequest; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.util.UriComponentsBuilder; import java.util.Locale; @@ -105,7 +104,7 @@ public HomeController(AuthenticationManagementService authenticationManagementSe * * @return Redirect to /authenticate endpoint. */ - @RequestMapping(value = "/", method = RequestMethod.GET) + @GetMapping("/") public String index() { return "redirect:/authenticate"; } @@ -118,7 +117,7 @@ public String index() { * @param response Reference to current HttpServletResponse. * @return index page */ - @RequestMapping(value = "/authenticate", method = RequestMethod.GET) + @GetMapping("/authenticate") public String authenticate(Map model, HttpServletRequest request, HttpServletResponse response) { logger.info("Received /authenticate request"); HttpSessionRequestCache cache = new HttpSessionRequestCache(); @@ -219,7 +218,7 @@ public String authenticate(Map model, HttpServletRequest request * @param response Reference to current HttpServletResponse. * @return Redirect to the /oauth/authorize page */ - @RequestMapping(value = "/authenticate/continue", method = RequestMethod.GET) + @GetMapping("/authenticate/continue") public String continueToRedirect(HttpServletRequest request, HttpServletResponse response) { logger.info("Received /authenticate/continue request"); final HttpSessionRequestCache cache = new HttpSessionRequestCache(); @@ -253,7 +252,7 @@ public String continueToRedirect(HttpServletRequest request, HttpServletResponse * @param response Reference to current HttpServletResponse. * @return Redirect to the originating page */ - @RequestMapping(value = "/authenticate/cancel", method = RequestMethod.GET) + @GetMapping("/authenticate/cancel") public String cancelAuthentication(HttpServletRequest request, HttpServletResponse response) { logger.info("Received /authenticate/cancel request"); final HttpSessionRequestCache cache = new HttpSessionRequestCache(); @@ -367,7 +366,7 @@ public String cancelAuthentication(HttpServletRequest request, HttpServletRespon * @param model Model. * @return Return oauth/error template. */ - @RequestMapping(value = "/oauth2/error", method = RequestMethod.GET) + @GetMapping("/oauth2/error") public String oauthError(Map model) { // Make sure HTTP session is cleaned when error is displayed cleanHttpSession(); diff --git a/powerauth-webflow/src/main/java/io/getlime/security/powerauth/app/webflow/controller/ServiceController.java b/powerauth-webflow/src/main/java/io/getlime/security/powerauth/app/webflow/controller/ServiceController.java index 538763d42..af435ac22 100644 --- a/powerauth-webflow/src/main/java/io/getlime/security/powerauth/app/webflow/controller/ServiceController.java +++ b/powerauth-webflow/src/main/java/io/getlime/security/powerauth/app/webflow/controller/ServiceController.java @@ -26,8 +26,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.info.BuildProperties; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import java.util.Date; @@ -68,7 +68,7 @@ public void setBuildProperties(BuildProperties buildProperties) { * Controller resource with system information. * @return System status info. */ - @RequestMapping(value = "status", method = RequestMethod.GET) + @GetMapping("status") public @ResponseBody ObjectResponse getServiceStatus() { logger.info("Received getServiceStatus request"); ServiceStatusResponse response = new ServiceStatusResponse();